mirror of
https://gitlab.com/buildroot.org/buildroot.git
synced 2026-08-01 21:23:51 -09:00
Fixes: https://gitlab.com/buildroot.org/buildroot/-/issues/55
When gcc sees a linker option (-Wl,..) it executes the linker, leading to
confusing error messages if no source files are provided, E.G.:
% gcc
gcc: fatal error: no input files
compilation terminated.
% gcc -Wl,-z,now
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x17): undefined reference to `main'
collect2: error: ld returned 1 exit status
It is not really trivial to detect in the wrapper if linking will be done,
but we can at least check if any non-option arguments (E.G. source/object
files) are passed and skip the -Wl,.. options if not.
% ./host/bin/aarch64-linux-gcc
aarch64-linux-gcc.br_real: fatal error: no input files
compilation terminated.
With this fixed we no longer need the special case for --help -v from commit
9954315fc5 ("toolchain/toolchain-wrapper: make gcc --help -v work
correctly"), so drop that.
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>