Update -fno-pie to only be added when relevant. This fixes native_posix
builds on Debian hosts.
* Debian and other Linux distributions have ld with --warn-textrel as
default.
* The option generates a warning when linking on x86.
* The warning make scripts/twister fail because we treat all warnings
as error.
* The warning is issued when no PIE objects are linked against PIE
library.
* PIE (Position Independent Executable) or not can be seen with the
following command.
* When you want to generate non PIE, link with `-no-pie.`
Non PIE
$ readelf -l build/zephyr/zephyr.elf | grep 'Elf file type is'
Elf file type is EXEC (Executable file)
PIE
$ readelf -l /lib/x86_64-linux-gnu/libc.so.6 | \
grep 'Elf file type is'
Elf file type is DYN (Shared object file)
Issue #35244
Signed-off-by: Yuval Peress <peress@google.com>
Fixes#28456
This commit extends `target_ld_options()` with a NO_SPLIT flag.
Specifying `NO_SPLIT` will ensure that all linker flags will be applied
together when testing the compiler and linker.
This allows a caller to ensure that flags are tested together.
This fixes the RISC-V case where the flags `-mabi` and `-march` were
omitted because they were tested individually.
Note, the update of `target_ld_options()` will allow the same flag on
`zephyr_ld_options()`
Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
Move PROPERTY_LINKER_SCRIPT_DEFINES to toolchain_ld_base.
No functional change expected.
This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.
Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
No functional change expected.
This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.
Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
Move --gc-sections flag to toolchain_ld_base()
Move --build-id=none flag to toolchain_ld_base()
No functional change expected.
This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.
Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>
toolchain_ld_base() represents flags that are fundamental to linking or
otherwise does not belong in any further specified linker flag category.
No functional change expected.
This is motivated by the wish to abstract Zephyr's usage of toolchains,
permitting non-intrusive porting to other (commercial) toolchains.
Signed-off-by: Mark Ruvald Pedersen <mped@oticon.com>