On 22/01/2021 10:46, Sebastian Huber wrote:

Hello,

for RTEMS we have in gcc/config/rtems.h the following LIB_SPEC:

#undef LIB_SPEC
#define LIB_SPEC "%{!qrtems:" STD_LIB_SPEC "} " \
"%{qrtems:%{!nostdlib:%{!nodefaultlibs:" \
"--start-group -lrtemsbsp -lrtemscpu -latomic -lc -lgcc --end-group} " \
"%{!qnolinkcmds:-T linkcmds%s}}}"

The intention was that a GCC command line to link an executable with

-qrtems -nodefaultlibs

still uses "-T linkcmds", however, this didn't work. I think this is due to

*link_gcc_c_sequence:
%G %{!nolibc:%L %G}

*link_command:
... %{!nostdlib:%{!r:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}} ...
%(post_link) }}}}}}

So, if nodefaultlib is present, the LIB_SPEC is not evaluated at all?

The problem is that LINK_SPEC is specialized by target. For RTEMS, we have to use the target definitions. In the default definition of LINK_COMMAND_SPEC (gcc/gcc.c) there is no define for operating system customization. Would it be possible to add something this?

I think the STARTFILES_SPEC can be used as a workaround:

https://gcc.gnu.org/pipermail/gcc-patches/2021-January/564101.html

This avoids modifications in "gcc/gcc.c".

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/

Reply via email to