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/02/10 22:41:39 UTC

[GitHub] [incubator-nuttx] ptka opened a new pull request #5452: sim: detect clang native compiler on MacOS.

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


   ## Summary
   Detect clang native compiler on MacOS.
   This change is step ahead to get MacOS simulation harmonized to use native compiler.
   
   ## Impact
   Simulation on MacOS/ARM64.
   
   ## Testing
   MacBook Pro Late 2013 running Big Sur (X86_64)
   Testing on MacBook Air 2020 running Monterey (ARM64) will be part of separate PR.


-- 
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] ptka closed pull request #5452: sim: detect clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka closed pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452


   


-- 
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] ptka commented on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034575794


   > maybe we can consider to revert #1817 .
   > it's awkward to require binutils.
   
   I think, we need to distinguish between clang and gcc/binutils based HOST compiler suites (maybe it's even just an MacOS issue). On gcc/binutils based HOST compiler suites objcopy is needed to avoid wrong function calls between the NuttX and the HOST world within the overall simulation. In my opinion we cannot simply revert mentioned PR.


-- 
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] yamt commented on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034406569


   > Native compiler on MacOS doesn't have objcopy installed. I assume, you have additional software installed on your MacOS which (maybe as a side-effect) installs objcopy. Can you check your system regarding this point, please. If current MacOS/X86 is designed to use clang, then the option is most likely not needed, as it was just introduced for backward compatibility.
   
   yes, it requires objcopy from binutils.
   see https://github.com/apache/incubator-nuttx/pull/1817
   maybe we forgot to document it.
   at that point, the llvm version of objcopy didn't work well.
   
   can you explain why objcopy is not necessary for clang?


-- 
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] ptka commented on a change in pull request #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -96,6 +96,12 @@ NM = $(CROSSDEV)nm
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
 
+# clang based native compiler doesn't need opjcopy to build simulation.
+# Note: In fact objcopy is not part of MacOS native compiler suite.
+ifneq ("$(shell $(CC) --version | grep clang)","")
+  OBJCOPY = :

Review comment:
       Got your point ... makes sense. 




-- 
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 #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -96,6 +96,12 @@ NM = $(CROSSDEV)nm
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
 
+# clang based native compiler doesn't need opjcopy to build simulation.
+# Note: In fact objcopy is not part of MacOS native compiler suite.
+ifneq ("$(shell $(CC) --version | grep clang)","")
+  OBJCOPY = :

Review comment:
       how about we guard the follow code directly:
   https://github.com/apache/incubator-nuttx/blob/master/arch/sim/src/Makefile#L288-L292




-- 
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 pull request #5452: sim: detect clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1035210296


   > > more symbol need add default visibility: _up_cpu_started, _up_init_ipi, _netdriver_setmacaddr.
   > 
   > that's the easy part ... the critical part is getting the modules compiled ... there's a hard dependency:
   > 
   > ```
   > MODULECC = x86_64-elf-gcc
   > MODULELD = x86_64-elf-ld
   > ```
   > 
   > to get the elf modules build.
   > 
   > This could be really a show-stopper (or at least an not-easy to fix dependency to homebrew based additional software needed on MacOS).
   
   Yes, elf need gcc toolchain, but this is an advance feature, not used by most people.


-- 
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] yamt commented on a change in pull request #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: arch/sim/src/Makefile
##########
@@ -285,11 +285,14 @@ nuttx-names.dat: nuttx-names.in
 nuttx$(EXEEXT): libarch$(LIBEXT) board/libboard$(LIBEXT) $(HEADOBJ) $(LINKOBJS) $(HOSTOBJS) nuttx-names.dat
 	$(Q) echo "LD:  nuttx$(EXEEXT)"
 	$(Q) $(LD) -r $(LDLINKFLAGS) $(RELPATHS) $(EXTRA_LIBPATHS) -o nuttx.rel $(REQUIREDOBJS) $(LDSTARTGROUP) $(RELLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
+ifeq ("$(shell $(CC) --version | grep clang)","")
+   # none clang based native compilers need opjcopy to build simulation
 	$(Q) $(OBJCOPY) --redefine-syms=nuttx-names.dat nuttx.rel
 	$(Q) $(CC) $(CCLINKFLAGS) -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
 	$(Q) echo "__init_array_start = .; __init_array_end = .; __fini_array_start = .; __fini_array_end = .;" >>nuttx.ld

Review comment:
       https://github.com/apache/incubator-nuttx/pull/5486




-- 
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 #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: arch/sim/Kconfig
##########
@@ -23,6 +23,10 @@ config HOST_ARM
 	bool "arm"
 	select ARCH_HAVE_STACKCHECK
 
+config HOST_ARM64

Review comment:
       since the skip of objcopy is specific to clang toolchain, it's better to fix the visibility issue to a standalone patch




-- 
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 #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: arch/sim/Kconfig
##########
@@ -43,6 +47,10 @@ config SIM_M32
 		beyond.  For those versions, you must add SIM_M32=y to the .config file in
 		order to enable building a 32-bit image on a 64-bit platform.
 
+config HOST_TOOLCHAIN_CLANGL

Review comment:
       don't need




-- 
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] yamt commented on a change in pull request #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: arch/sim/src/Makefile
##########
@@ -285,11 +285,14 @@ nuttx-names.dat: nuttx-names.in
 nuttx$(EXEEXT): libarch$(LIBEXT) board/libboard$(LIBEXT) $(HEADOBJ) $(LINKOBJS) $(HOSTOBJS) nuttx-names.dat
 	$(Q) echo "LD:  nuttx$(EXEEXT)"
 	$(Q) $(LD) -r $(LDLINKFLAGS) $(RELPATHS) $(EXTRA_LIBPATHS) -o nuttx.rel $(REQUIREDOBJS) $(LDSTARTGROUP) $(RELLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
+ifeq ("$(shell $(CC) --version | grep clang)","")
+   # none clang based native compilers need opjcopy to build simulation
 	$(Q) $(OBJCOPY) --redefine-syms=nuttx-names.dat nuttx.rel
 	$(Q) $(CC) $(CCLINKFLAGS) -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
 	$(Q) echo "__init_array_start = .; __init_array_end = .; __fini_array_start = .; __fini_array_end = .;" >>nuttx.ld

Review comment:
       the init array stuff is about linux, not clang/gcc.




-- 
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] ptka commented on a change in pull request #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -96,6 +96,12 @@ NM = $(CROSSDEV)nm
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
 
+# clang based native compiler doesn't need opjcopy to build simulation.
+# Note: In fact objcopy is not part of MacOS native compiler suite.
+ifneq ("$(shell $(CC) --version | grep clang)","")
+  OBJCOPY = :

Review comment:
       That would work, too. If you prefer that solution, I'll update PR. Pro would be, that it's directly at the location, which is not needed. Con, that OBJCOPY is defined although it's not available. I don't mind, both will working have their Charme. 




-- 
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] ptka commented on a change in pull request #5452: sim: enable selecting clang native compiler on MacOS.

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



##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -96,6 +96,12 @@ NM = $(CROSSDEV)nm
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
 
+# clang based native compiler doesn't need opjcopy to build simulation.
+# Note: In fact objcopy is not part of MacOS native compiler suite.
+ifeq ($(CONFIG_HOST_TOOLCHAIN_CLANGL),y)  
+  OBJCOPY = :

Review comment:
       On my MacOS/M1/Monterey on llvm-g++  and llvm-gcc are available. Additionally, any 'llvm-' tool would be not used unless you link them or specify the CROSSDEV prefix as defined in boards/sim/sim/sim/scripts/Make.def.




-- 
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 pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034700835


   If @ptka finding is right, I would prefer that we remove objcopy step for macOS regardless whether it is run on x64 or arm64.


-- 
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] ptka edited a comment on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka edited a comment on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034368486


   Native compiler on MacOS doesn't have objcopy installed. I assume, you have additional software installed on your MacOS which (maybe as a side-effect) installs objcopy. Can you check your system regarding this point, please.
   If current MacOS/X86 is designed to use clang, then the option is most likely not needed, as it was just introduced for backward compatibility.


-- 
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] ptka commented on pull request #5452: sim: detect clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1035611309


   I installed the packages via homebrew to fulfill:
   
       MODULECC = x86_64-elf-gcc
       MODULELD = x86_64-elf-ld
   
   Additionally, I removed all changed except the "objcopy" part and the related symbol export changes. Making this PR focus on a single topic.


-- 
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 #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -96,6 +96,12 @@ NM = $(CROSSDEV)nm
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
 
+# clang based native compiler doesn't need opjcopy to build simulation.
+# Note: In fact objcopy is not part of MacOS native compiler suite.
+ifneq ("$(shell $(CC) --version | grep clang)","")
+  OBJCOPY = :

Review comment:
       how about we guard the follow code directly:
   https://github.com/apache/incubator-nuttx/blob/master/arch/sim/src/Makefile#L288-L292
   and skip the process of  nuttx-names.in




-- 
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 #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -96,6 +96,12 @@ NM = $(CROSSDEV)nm
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
 
+# clang based native compiler doesn't need opjcopy to build simulation.
+# Note: In fact objcopy is not part of MacOS native compiler suite.
+ifneq ("$(shell $(CC) --version | grep clang)","")
+  OBJCOPY = :

Review comment:
       whether OBJCOPY exist depends on user setup, but your finding verify that the renaming process is unnecessary for clang. This is important to explicitly state your finding in Makefile since many people(even me, @liguiding  and @yamt) don't know that the clang/gcc work very differently in this case.




-- 
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 pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034433975


   @ptka does llvm-objcpy and llvm-ojdump exist on macOS?


-- 
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] ptka edited a comment on pull request #5452: sim: detect clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka edited a comment on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034785207


   > > > > Native compiler on MacOS doesn't have objcopy installed. I assume, you have additional software installed on your MacOS which (maybe as a side-effect) installs objcopy. Can you check your system regarding this point, please. If current MacOS/X86 is designed to use clang, then the option is most likely not needed, as it was just introduced for backward compatibility.
   > > > 
   > > > 
   > > > yes, it requires objcopy from binutils. see #1817 maybe we forgot to document it. at that point, the llvm version of objcopy didn't work well.
   > > > can you explain why objcopy is not necessary for clang?
   > > 
   > > 
   > > Afaik: objcopy is used to hide the NuttX world from the HOST world to avoid, that the wrong functions are called. Before linking the final host executable, objcopy renames a list of NuttX symbols. Overall this is a kind of a workaround as in principle is should work in a different way: Compiling code with "-fvisibility=hidden" should mark functions as hidden. Hidden means, they are not exported from any 'ld' created object file. All symbols, which needs to exported, can overwrite the visibility in the code itself. This way 'main()' and 'up_doirq()' gets visible in the HOST world although they are defined in the NuTTX world. On MacOS/clang the compiler/linker behaves exactly that way and objcopy is thus not needed.
   > 
   > ok. thank you for the explanation.
   > 
   > * i guess more functions need to be exported. eg. netdriver_setmacaddr
   > * i don't think it's arm specific.
   > * if it's clang-specific (i dunno) it might be simpler to use `ifneq "$(shell $(CC) --version | grep clang)" ""` than a kconfig
   > * i don't understand the change in up_vfork_x86_64.S. is it somehow tied to the objcopy part of the PR? otherwise, i'd suggest to leave it for a separate PR.
   
   This `ifneq "$(shell $(CC) --version | grep clang)" ""` could be a good approach. I reworked the PR.


-- 
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 #5452: sim: enable selecting clang native compiler on MacOS.

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



##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -96,6 +96,12 @@ NM = $(CROSSDEV)nm
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
 
+# clang based native compiler doesn't need opjcopy to build simulation.
+# Note: In fact objcopy is not part of MacOS native compiler suite.
+ifeq ($(CONFIG_HOST_TOOLCHAIN_CLANGL),y)  
+  OBJCOPY = :

Review comment:
       from this page:
   https://llvm.org/docs/CommandGuide/index.html
   llvm-ar, llvm-strip, llvm-nm, llvm-objdump, llvm-objcopy




-- 
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] ptka edited a comment on pull request #5452: sim: detect clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka edited a comment on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1035091421


   > more symbol need add default visibility: _up_cpu_started, _up_init_ipi, _netdriver_setmacaddr.
   
   that's the easy part ... the critical part is getting the modules compiled ... there's a hard dependency:
   
       MODULECC = x86_64-elf-gcc
       MODULELD = x86_64-elf-ld
   
   to get the elf modules build.
   
   This could be really a show-stopper (or at least an not-easy to fix dependency to homebrew based additional software needed on MacOS).


-- 
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 edited a comment on pull request #5452: sim: detect clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1035210296


   > > more symbol need add default visibility: _up_cpu_started, _up_init_ipi, _netdriver_setmacaddr.
   > 
   > that's the easy part ... the critical part is getting the modules compiled ... there's a hard dependency:
   > 
   > ```
   > MODULECC = x86_64-elf-gcc
   > MODULELD = x86_64-elf-ld
   > ```
   > 
   > to get the elf modules build.
   > 
   > This could be really a show-stopper (or at least an not-easy to fix dependency to homebrew based additional software needed on MacOS).
   
   Yes, elf need gcc toolchain, but this is an advance feature, not used by most people. It's reasonable require the user to install gcc toolchain if they want to try elf.


-- 
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 #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -96,6 +96,12 @@ NM = $(CROSSDEV)nm
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
 
+# clang based native compiler doesn't need opjcopy to build simulation.
+# Note: In fact objcopy is not part of MacOS native compiler suite.
+ifneq ("$(shell $(CC) --version | grep clang)","")
+  OBJCOPY = :

Review comment:
       whether OBJCOPY exist depends on user setup, but your finding verify that the renaming process is unnecessary for clang. This is important to explicitly state your finding in Makefile since many people(even me and @yamt) don't know that the clang/gcc work very differently in this case.




-- 
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] ptka commented on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034785207


   > > > > Native compiler on MacOS doesn't have objcopy installed. I assume, you have additional software installed on your MacOS which (maybe as a side-effect) installs objcopy. Can you check your system regarding this point, please. If current MacOS/X86 is designed to use clang, then the option is most likely not needed, as it was just introduced for backward compatibility.
   > > > 
   > > > 
   > > > yes, it requires objcopy from binutils. see #1817 maybe we forgot to document it. at that point, the llvm version of objcopy didn't work well.
   > > > can you explain why objcopy is not necessary for clang?
   > > 
   > > 
   > > Afaik: objcopy is used to hide the NuttX world from the HOST world to avoid, that the wrong functions are called. Before linking the final host executable, objcopy renames a list of NuttX symbols. Overall this is a kind of a workaround as in principle is should work in a different way: Compiling code with "-fvisibility=hidden" should mark functions as hidden. Hidden means, they are not exported from any 'ld' created object file. All symbols, which needs to exported, can overwrite the visibility in the code itself. This way 'main()' and 'up_doirq()' gets visible in the HOST world although they are defined in the NuTTX world. On MacOS/clang the compiler/linker behaves exactly that way and objcopy is thus not needed.
   > 
   > ok. thank you for the explanation.
   > 
   > * i guess more functions need to be exported. eg. netdriver_setmacaddr
   > * i don't think it's arm specific.
   > * if it's clang-specific (i dunno) it might be simpler to use `ifneq "$(shell $(CC) --version | grep clang)" ""` than a kconfig
   > * i don't understand the change in up_vfork_x86_64.S. is it somehow tied to the objcopy part of the PR? otherwise, i'd suggest to leave it for a separate PR.
   
   This `ifneq "$(shell $(CC) --version | grep clang)" ""` could be a good approach to explicitly set CC=clang in the Makefilesc and depend on the search path order for 'cc'.


-- 
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] ptka commented on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034788369


   > > @ptka does llvm-objcpy and llvm-objdump exist on macOS?
   > 
   > in my environment with Monterey x86-64, Xcode 13.2.1, neither Xcode nor CommandLineTools has them.
   > 
   > llvm from homebrew has them.
   
   I would like to see MacOS based simulation independent from homebrew. There's nothing wrong with homebrew, but native compiler suite should be good enough and there's no need for this dependencies from compiler perspective.


-- 
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] ptka commented on a change in pull request #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -96,6 +96,12 @@ NM = $(CROSSDEV)nm
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
 
+# clang based native compiler doesn't need opjcopy to build simulation.
+# Note: In fact objcopy is not part of MacOS native compiler suite.
+ifeq ($(CONFIG_HOST_TOOLCHAIN_CLANGL),y)  
+  OBJCOPY = :

Review comment:
       On my MacOS/M1/Monterey only llvm-g++  and llvm-gcc are available. Additionally, any 'llvm-' tool would be not used unless you link them or specify the CROSSDEV prefix as defined in boards/sim/sim/sim/scripts/Make.def.




-- 
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] ptka commented on a change in pull request #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -96,6 +96,12 @@ NM = $(CROSSDEV)nm
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
 
+# clang based native compiler doesn't need opjcopy to build simulation.
+# Note: In fact objcopy is not part of MacOS native compiler suite.
+ifeq ($(CONFIG_HOST_TOOLCHAIN_CLANGL),y)  
+  OBJCOPY = :

Review comment:
       On my MacOS/M1/Monterey only llvm-g++  and llvm-gcc are available. Additionally, any 'llvm-' tool would not be used unless you link them or specify the CROSSDEV prefix as defined in boards/sim/sim/sim/scripts/Make.def.




-- 
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] ptka commented on a change in pull request #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: arch/sim/Kconfig
##########
@@ -23,6 +23,10 @@ config HOST_ARM
 	bool "arm"
 	select ARCH_HAVE_STACKCHECK
 
+config HOST_ARM64

Review comment:
       makes sense ... let me park this PR completely ... it's not working, the way it was intended ... I need to re-think.




-- 
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] yamt commented on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034356333


   >  X86_64 based hosts stay on current (gcc/binutils) configuration for backward compatibility.
   
   i guess you misunderstand the situation.
   
   i have always been using clang to develop sim/macOS/x86-64.
   i have not used gcc for the purpose.
   i don't know if it's possible to build sim/macOS with gcc.
   
   also, i usually use clang to build sim/Linux/x86-64 without problems.
   so i'm not sure why this option is necessary.
   
   


-- 
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] ptka commented on pull request #5452: sim: detect clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1035100783


   Let me park this PR completely ... it's not working, they way it was intended ... I need to re-think.


-- 
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] yamt commented on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034572987


   > > > Native compiler on MacOS doesn't have objcopy installed. I assume, you have additional software installed on your MacOS which (maybe as a side-effect) installs objcopy. Can you check your system regarding this point, please. If current MacOS/X86 is designed to use clang, then the option is most likely not needed, as it was just introduced for backward compatibility.
   > > 
   > > 
   > > yes, it requires objcopy from binutils. see #1817 maybe we forgot to document it. at that point, the llvm version of objcopy didn't work well.
   > > can you explain why objcopy is not necessary for clang?
   > 
   > Afaik: objcopy is used to hide the NuttX world from the HOST world to avoid, that the wrong functions are called. Before linking the final host executable, objcopy renames a list of NuttX symbols. Overall this is a kind of a workaround as in principle is should work in a different way: Compiling code with "-fvisibility=hidden" should mark functions as hidden. Hidden means, they are not exported from any 'ld' created object file. All symbols, which needs to exported, can overwrite the visibility in the code itself. This way 'main()' and 'up_doirq()' gets visible in the HOST world although they are defined in the NuTTX world. On MacOS/clang the compiler/linker behaves exactly that way and objcopy is thus not needed.
   
   ok. thank you for the explanation.
   
   * i guess more functions need to be exported. eg. netdriver_setmacaddr
   * i don't think it's arm specific.
   * if it's clang-specific (i dunno) it might be simpler to use `ifneq "$(shell $(CC) --version | grep clang)" ""` than a kconfig
   * i don't understand the change in up_vfork_x86_64.S. is it somehow tied to the objcopy part of the PR? otherwise, i'd suggest to leave it for a separate PR.


-- 
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] ptka edited a comment on pull request #5452: sim: detect clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka edited a comment on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1035100783


   Let me park this PR completely ... it's not working, the way it was intended ... I need to re-think.


-- 
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 edited a comment on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 edited a comment on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034433975


   @ptka does llvm-objcpy and llvm-objdump exist on macOS?


-- 
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 pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034498965


   @ptka found that objcopy isn't really needed, I think.


-- 
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] yamt commented on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034578087


   > > maybe we can consider to revert #1817 .
   > > it's awkward to require binutils.
   > 
   > I think, we need to distinguish between clang and gcc/binutils based HOST compiler suites (maybe it's even just an MacOS issue). On gcc/binutils based HOST compiler suites objcopy is needed to avoid wrong function calls between the NuttX and the HOST world within the overall simulation. In my opinion we cannot simply revert mentioned PR.
   
   as far as your approach works, there is no point to revert.


-- 
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] yamt commented on a change in pull request #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: arch/sim/src/Makefile
##########
@@ -285,11 +285,14 @@ nuttx-names.dat: nuttx-names.in
 nuttx$(EXEEXT): libarch$(LIBEXT) board/libboard$(LIBEXT) $(HEADOBJ) $(LINKOBJS) $(HOSTOBJS) nuttx-names.dat
 	$(Q) echo "LD:  nuttx$(EXEEXT)"
 	$(Q) $(LD) -r $(LDLINKFLAGS) $(RELPATHS) $(EXTRA_LIBPATHS) -o nuttx.rel $(REQUIREDOBJS) $(LDSTARTGROUP) $(RELLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
+ifeq ("$(shell $(CC) --version | grep clang)","")
+   # none clang based native compilers need opjcopy to build simulation
 	$(Q) $(OBJCOPY) --redefine-syms=nuttx-names.dat nuttx.rel
 	$(Q) $(CC) $(CCLINKFLAGS) -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
 	$(Q) echo "__init_array_start = .; __init_array_end = .; __fini_array_start = .; __fini_array_end = .;" >>nuttx.ld

Review comment:
       the init array stuff is about linux, not clang/gcc.




-- 
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] yamt commented on a change in pull request #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: arch/sim/src/Makefile
##########
@@ -285,11 +285,14 @@ nuttx-names.dat: nuttx-names.in
 nuttx$(EXEEXT): libarch$(LIBEXT) board/libboard$(LIBEXT) $(HEADOBJ) $(LINKOBJS) $(HOSTOBJS) nuttx-names.dat
 	$(Q) echo "LD:  nuttx$(EXEEXT)"
 	$(Q) $(LD) -r $(LDLINKFLAGS) $(RELPATHS) $(EXTRA_LIBPATHS) -o nuttx.rel $(REQUIREDOBJS) $(LDSTARTGROUP) $(RELLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
+ifeq ("$(shell $(CC) --version | grep clang)","")
+   # none clang based native compilers need opjcopy to build simulation
 	$(Q) $(OBJCOPY) --redefine-syms=nuttx-names.dat nuttx.rel
 	$(Q) $(CC) $(CCLINKFLAGS) -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
 	$(Q) echo "__init_array_start = .; __init_array_end = .; __fini_array_start = .; __fini_array_end = .;" >>nuttx.ld

Review comment:
       my concern is clang on linux. i can't think of a reason why the init array is not necessary in that case.




-- 
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] yamt commented on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034440072


   > @ptka does llvm-objcpy and llvm-objdump exist on macOS?
   
   in my environment with Monterey x86-64, Xcode 13.2.1,
   neither Xcode nor CommandLineTools has them.
   
   llvm from homebrew has them.
   


-- 
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] ptka edited a comment on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka edited a comment on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034788369


   > > @ptka does llvm-objcpy and llvm-objdump exist on macOS?
   > 
   > in my environment with Monterey x86-64, Xcode 13.2.1, neither Xcode nor CommandLineTools has them.
   > 
   > llvm from homebrew has them.
   
   I would like to see MacOS based simulation independent from homebrew. There's nothing wrong with homebrew, but native compiler suite should be good enough, so there's no need for this dependencies from compiler perspective.


-- 
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] yamt commented on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
yamt commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034443105


   maybe we can consider to revert https://github.com/apache/incubator-nuttx/pull/1817 .
   it's awkward to require binutils.


-- 
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] ptka commented on a change in pull request #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: arch/sim/Kconfig
##########
@@ -43,6 +47,10 @@ config SIM_M32
 		beyond.  For those versions, you must add SIM_M32=y to the .config file in
 		order to enable building a 32-bit image on a 64-bit platform.
 
+config HOST_TOOLCHAIN_CLANGL

Review comment:
       that's right ... it's already removed in my local version.




-- 
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] ptka commented on a change in pull request #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: arch/sim/Kconfig
##########
@@ -23,6 +23,10 @@ config HOST_ARM
 	bool "arm"
 	select ARCH_HAVE_STACKCHECK
 
+config HOST_ARM64

Review comment:
       makes sense ... let me park this PR completely ... it's not working, they way it was intended ... I need to re-think.




-- 
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] ptka edited a comment on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka edited a comment on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034368486


   Native compiler on MacOS doesn't have objcopy installed. I assume, you have additional software installed on your MacOS which (maybe as a side-effect) installs objcopy. Can you check your system regarding this point, please.


-- 
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] ptka commented on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034368486


   Native compiler on MacOS doesn't have objcopy installed. I assume, you have additional software installed on you MacOS which (maybe as a side-effect) installs objcopy. Can you check your system regarding this point, please.


-- 
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 #5452: sim: detect clang native compiler on MacOS.

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


   


-- 
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] ptka commented on pull request #5452: sim: enable selecting clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1034557983


   > > Native compiler on MacOS doesn't have objcopy installed. I assume, you have additional software installed on your MacOS which (maybe as a side-effect) installs objcopy. Can you check your system regarding this point, please. If current MacOS/X86 is designed to use clang, then the option is most likely not needed, as it was just introduced for backward compatibility.
   > 
   > yes, it requires objcopy from binutils. see #1817 maybe we forgot to document it. at that point, the llvm version of objcopy didn't work well.
   > 
   > can you explain why objcopy is not necessary for clang?
   
   Afaik: objcopy is used to hide the NuttX world from the HOST world to avoid, that the wrong functions are called. Before linking the final host executable, objcopy renames a list of NuttX symbols. Overall this is a kind of a workaround as in principle is should work in a different way: Compiling code with "-fvisibility=hidden" should mark functions as hidden. Hidden means, they are not exported from any 'ld' created object file. All symbols, which needs to exported, can overwrite the visibility in the code itself. This way 'main()' and 'up_doirq()' gets visible in the HOST world although they are defined in the NuTTX world. On MacOS/clang the compiler/linker behaves exactly that way and objcopy is thus not needed.


-- 
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] ptka commented on pull request #5452: sim: detect clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
ptka commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1035091421


   > more symbol need add default visibility: _up_cpu_started, _up_init_ipi, _netdriver_setmacaddr.
   
   that's the easy part ... the critical part is getting the modules compiled ... there's a hard dependency:
       MODULECC = x86_64-elf-gcc
       MODULELD = x86_64-elf-ld
   to get the elf modules build.
   
   This could be really a show-stopper (or at least an not-easy to fix dependency to homebrew based additional software needed on MacOS).


-- 
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 pull request #5452: sim: detect clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1035078594


   more symbol need add default visibility: _up_cpu_started, _up_init_ipi, _netdriver_setmacaddr.


-- 
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 #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: boards/sim/sim/sim/scripts/Make.defs
##########
@@ -96,6 +96,12 @@ NM = $(CROSSDEV)nm
 OBJCOPY = $(CROSSDEV)objcopy
 OBJDUMP = $(CROSSDEV)objdump
 
+# clang based native compiler doesn't need opjcopy to build simulation.
+# Note: In fact objcopy is not part of MacOS native compiler suite.
+ifeq ($(CONFIG_HOST_TOOLCHAIN_CLANGL),y)  
+  OBJCOPY = :

Review comment:
       let's directly skip objcopy in arch/sim/Makefile?




-- 
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 pull request #5452: sim: detect clang native compiler on MacOS.

Posted by GitBox <gi...@apache.org>.
xiaoxiang781216 commented on pull request #5452:
URL: https://github.com/apache/incubator-nuttx/pull/5452#issuecomment-1035995714


   @yamt do you ok with the change?


-- 
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 #5452: sim: detect clang native compiler on MacOS.

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



##########
File path: arch/sim/src/Makefile
##########
@@ -285,11 +285,14 @@ nuttx-names.dat: nuttx-names.in
 nuttx$(EXEEXT): libarch$(LIBEXT) board/libboard$(LIBEXT) $(HEADOBJ) $(LINKOBJS) $(HOSTOBJS) nuttx-names.dat
 	$(Q) echo "LD:  nuttx$(EXEEXT)"
 	$(Q) $(LD) -r $(LDLINKFLAGS) $(RELPATHS) $(EXTRA_LIBPATHS) -o nuttx.rel $(REQUIREDOBJS) $(LDSTARTGROUP) $(RELLIBS) $(EXTRA_LIBS) $(LDENDGROUP)
+ifeq ("$(shell $(CC) --version | grep clang)","")
+   # none clang based native compilers need opjcopy to build simulation
 	$(Q) $(OBJCOPY) --redefine-syms=nuttx-names.dat nuttx.rel
 	$(Q) $(CC) $(CCLINKFLAGS) -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
 	$(Q) echo "__init_array_start = .; __init_array_end = .; __fini_array_start = .; __fini_array_end = .;" >>nuttx.ld

Review comment:
       so, gcc on macOS go the dynamical replacement?




-- 
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