You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/03/31 17:57:09 UTC

[GitHub] [incubator-nuttx] gustavonihei opened a new pull request #5923: sim: Fix initialization of static C++ constructors when using glibc >= 2.34

gustavonihei opened a new pull request #5923:
URL: https://github.com/apache/incubator-nuttx/pull/5923


   ## Summary
   This PR intends to fix issue https://github.com/apache/incubator-nuttx/issues/5916.
   
   **glibc 2.34** changed the dynamic linker behavior during the startup process, which makes the previous "__init_array_start" replacement trick non-effective.
   Now the dynamic linker parses the constructors/destructors information from the DYNAMIC segment of the program.
   
   References:
   Patchset on glibc: https://patchwork.ozlabs.org/project/glibc/patch/87lfblmsez.fsf@oldenburg.str.redhat.com/
   Detailed explanation about changes introduced on glibc 2.34: https://stackoverflow.com/a/69837439
   
   ## Impact
   Fix `libc++` usage in NuttX Simulator.
   Closes https://github.com/apache/incubator-nuttx/issues/5916.
   
   ## Testing
   `sim:libcxxtest`
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5923: sim: Fix initialization of static C++ constructors when using glibc >= 2.34

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5923:
URL: https://github.com/apache/incubator-nuttx/pull/5923#discussion_r839885086



##########
File path: arch/sim/src/Makefile
##########
@@ -318,8 +321,11 @@ nuttx$(EXEEXT): libarch$(LIBEXT) board/libboard$(LIBEXT) $(HEADOBJ) $(LINKOBJS)
 ifneq ($(CONFIG_HOST_MACOS),y)
 	$(Q) $(OBJCOPY) --redefine-syms=nuttx-names.dat nuttx.rel
 	$(Q) $(CC) $(CFLAGS) -Wl,-verbose 2>&1 | \
-	     sed -e '/====/,/====/!d;//d' -e 's/__executable_start/_stext/g' -e 's/__init_array_start/_sinit/g' \
-	         -e 's/__init_array_end/_einit/g' -e 's/__fini_array_start/_sfini/g' -e 's/__fini_array_end/_efini/g' >nuttx.ld
+	     sed -e '/====/,/====/!d;//d' -e 's/__executable_start/_stext/g' \

Review comment:
       can we reuse the macOS constructor hack?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5923: sim: Fix initialization of static C++ constructors when using glibc >= 2.34

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5923:
URL: https://github.com/apache/incubator-nuttx/pull/5923#discussion_r840682742



##########
File path: arch/sim/src/Makefile
##########
@@ -318,8 +321,11 @@ nuttx$(EXEEXT): libarch$(LIBEXT) board/libboard$(LIBEXT) $(HEADOBJ) $(LINKOBJS)
 ifneq ($(CONFIG_HOST_MACOS),y)
 	$(Q) $(OBJCOPY) --redefine-syms=nuttx-names.dat nuttx.rel
 	$(Q) $(CC) $(CFLAGS) -Wl,-verbose 2>&1 | \
-	     sed -e '/====/,/====/!d;//d' -e 's/__executable_start/_stext/g' -e 's/__init_array_start/_sinit/g' \
-	         -e 's/__init_array_end/_einit/g' -e 's/__fini_array_start/_sfini/g' -e 's/__fini_array_end/_efini/g' >nuttx.ld
+	     sed -e '/====/,/====/!d;//d' -e 's/__executable_start/_stext/g' \

Review comment:
       Ok.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] gustavonihei commented on a change in pull request #5923: sim: Fix initialization of static C++ constructors when using glibc >= 2.34

Posted by GitBox <gi...@apache.org>.
gustavonihei commented on a change in pull request #5923:
URL: https://github.com/apache/incubator-nuttx/pull/5923#discussion_r840580076



##########
File path: arch/sim/src/Makefile
##########
@@ -318,8 +321,11 @@ nuttx$(EXEEXT): libarch$(LIBEXT) board/libboard$(LIBEXT) $(HEADOBJ) $(LINKOBJS)
 ifneq ($(CONFIG_HOST_MACOS),y)
 	$(Q) $(OBJCOPY) --redefine-syms=nuttx-names.dat nuttx.rel
 	$(Q) $(CC) $(CFLAGS) -Wl,-verbose 2>&1 | \
-	     sed -e '/====/,/====/!d;//d' -e 's/__executable_start/_stext/g' -e 's/__init_array_start/_sinit/g' \
-	         -e 's/__init_array_end/_einit/g' -e 's/__fini_array_start/_sfini/g' -e 's/__fini_array_end/_efini/g' >nuttx.ld
+	     sed -e '/====/,/====/!d;//d' -e 's/__executable_start/_stext/g' \

Review comment:
       I am not sure, it might be possible to follow the same approach.
   But since `sim` is broken, I suggest to first evaluate this quick fix to make the simulator usable again.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 merged pull request #5923: sim: Fix initialization of static C++ constructors when using glibc >= 2.34

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 merged pull request #5923:
URL: https://github.com/apache/incubator-nuttx/pull/5923


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [incubator-nuttx] xiaoxiang781216 commented on a change in pull request #5923: sim: Fix initialization of static C++ constructors when using glibc >= 2.34

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on a change in pull request #5923:
URL: https://github.com/apache/incubator-nuttx/pull/5923#discussion_r839885086



##########
File path: arch/sim/src/Makefile
##########
@@ -318,8 +321,11 @@ nuttx$(EXEEXT): libarch$(LIBEXT) board/libboard$(LIBEXT) $(HEADOBJ) $(LINKOBJS)
 ifneq ($(CONFIG_HOST_MACOS),y)
 	$(Q) $(OBJCOPY) --redefine-syms=nuttx-names.dat nuttx.rel
 	$(Q) $(CC) $(CFLAGS) -Wl,-verbose 2>&1 | \
-	     sed -e '/====/,/====/!d;//d' -e 's/__executable_start/_stext/g' -e 's/__init_array_start/_sinit/g' \
-	         -e 's/__init_array_end/_einit/g' -e 's/__fini_array_start/_sfini/g' -e 's/__fini_array_end/_efini/g' >nuttx.ld
+	     sed -e '/====/,/====/!d;//d' -e 's/__executable_start/_stext/g' \

Review comment:
       can we reuse the macOS constructor hack to reduce the maintain effort?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org