> -----Original Message-----
> From: Pavel Pisa <ppisa4li...@pikron.com>
> Sent: Monday, July 19, 2021 10:46 PM
> To: dev@nuttx.apache.org; Xiang Xiao <xiaoxiang781...@gmail.com>
> Cc: Gregory Nutt <spudan...@gmail.com>; Michal Lenc <lencm...@fel.cvut.cz>;
> Abdelatif Guettouche
> <abdelatif.guettou...@gmail.com>; Alan Carvalho de Assis <acas...@gmail.com>
> Subject: Re: NuttX ELF loadable applications and modules build broken
> probably for the most targets.
>
> Hello Xiang Xiao,
>
> Alan has approved pull
>
> https://github.com/apache/incubator-nuttx/pull/4173
>
> There is question what to do with SIM target and others in the longer term. I
> have removed them from the pull which has been merged.
>
> I resent text from previous email with correct identity to pass to the list
> this time and document isssues.
>
> On Sunday 18 of July 2021 18:39:12 Pavel Pisa wrote:
> > From the search, it seems that mips renesas risc-v x86_64 xtensa has
> > not switched to linking by GCC.... so I hope I have not break something
> > there.
>
> For example, correction of SIM target seems to be walk in the minefield.
>
> macOS (sim-02)
> Configuration/Tool: sim/sotest
> ------------------------------------------------------------------------------------
> Cleaning...
> Configuring...
> Building NuttX...
> x86_64-elf-ld: unrecognised emulation mode: cmodel=large Supported
> emulations: elf_x86_64 elf_i386 elf_iamcu elf32_x86_64 elf_l1om
> elf_k1om
> make[5]: *** [sotest] Error 1
> make[5]: Target `install' not remade because of errors.
> make[4]: *** [sotest_install] Error 2
> x86_64-elf-ld: unrecognised emulation mode: cmodel=large Supported
> emulations: elf_x86_64 elf_i386 elf_iamcu elf32_x86_64 elf_l1om
> elf_k1om
> make[5]: *** [modprint] Error 1
> make[5]: Target `install' not remade because of errors.
> make[4]: *** [modprint_install] Error 2
> make[4]: Target `all' not remade because of errors.
> make[3]: *** [build] Error 2
> make[3]: Target `all' not remade because of errors.
> make[2]: ***
> [/Users/runner/work/incubator-nuttx/incubator-nuttx/sources/apps/examples/sotest_all]
> Error 2
> make[2]: Target
> `/Users/runner/work/incubator-nuttx/incubator-nuttx/sources/apps/libapps.a'
> not remade because of errors.
> make[1]: *** [all] Error 2
> make: ***
> [/Users/runner/work/incubator-nuttx/incubator-nuttx/sources/apps/libapps.a]
> Error 2
> make: Target `all' not remade because of errors.
> /Users/runner/work/incubator-nuttx/incubator-nuttx/sources/nuttx/tools/testbuild.sh:
> line
> 252:
> /Users/runner/work/incubator-nuttx/incubator-nuttx/sources/nuttx/../nuttx/nuttx.manifest:
> No such file or directory
> Normalize sim/sotest
>
> As I have checked most of the architectures does not use GCC as LD or doesnot
> define LDMODULEFLAGS or LDELFFLAGS.
>
> So it seems that changes to other ten ARM architectures do not have purpose
> for now.
>
> The sim target is special
>
> It defines GCC as LD at top
>
> CC = $(CROSSDEV)cc
> CXX = $(CROSSDEV)c++
> CPP = $(CROSSDEV)cc -E -P -x c
> LD = $(CROSSDEV)cc
>
> but then plain LD in MAC OS case
>
> # NuttX modules are ELF binaries.
> # Non-ELF platforms like macOS need to use a separate ELF toolchain.
> ifeq ($(CONFIG_HOST_MACOS),y)
> # eg. brew install x86_64-elf-gcc
> MODULECC = x86_64-elf-gcc
> MODULELD = x86_64-elf-ld
How about we change to x86_64-elf-gcc too?
> MODULESTRIP = x86_64-elf-strip --strip-unneeded endif
>
> So I can add
>
> LDMODULEFLAGS += ...
>
> in else when not on MAC OS....
>
> I have removed sim change from the pull request.
>
> Really there should be define which allows to distinguish which link slution
> is used and select right behavior...
>
> Best wishes,
>
> Pavel