[Bug target/65837] [arm-linux-gnueabihf] lto1 target specific builtin not available

prathamesh3492 at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 28 22:40:00 GMT 2015


--- Comment #18 from prathamesh3492 at gcc dot gnu.org ---
Created attachment 35420
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35420&action=edit
patch to override default options by options in object file


The following untested patch gives preference to option value in object file.
In run_gcc(),
options from COLLECT_GCC_OPTIONS which are taken from command line are stored
in decoded_options.
options from object file are stored in fdecoded_options.
so override the option in decoded_options if it is present in fdecoded_options.

With the patch this works:
arm-linux-gnueabihf-gcc test.c -mfpu=neon -flto -c
arm-linux-gnueabihf-gcc test.o -flto 
only passes -mfpu=neon to lto1

However the patch doesn't work when same option is passed different values at
compile and link-time:
arm-linux-gnuebihf-gcc test.c -mfpu=neon -flto -c
arm-linux-gnueabihf-gcc test.o -mfpu=vfpv3-d16 -flto

In this case, -mfpu=neon is still passed to lto1, since the patch prefers
option value from object file.
Without the patch, the option from the command line was given preference.

for both the following cases: 
arm-linux-gnueabihf-gcc test.o -flto
arm-linux-gnueabihf-gcc test.o -flto -mfpu=vfpv3-d16

COLLECT_GCC_OPTIONS contains "-mfpu=vfpv3-d16", however in the first case it
isn't explictly passed by user, so passing -mfpu=neon
would be correct. In the second case, since -mfpu=vfpv3-d16 is passed
intentionally by user, should it be considered
as an error - "conflicting options" ?

Unfortunately, it looks like there is no way to distinguish between options
defined by default and explicitly passed options from COLLECT_GCC_OPTIONS and
that's the only way command line options are passed to lto-wrapper from the
driver. One way would be to modify COLLECT_GCC_OPTIONS in the driver to
indicate which options were explicitly passed from command line.
For instance, additionally COLLECT_GCC_OPTIONS would contain 
"-mfpu=vfpv3-d16-explicit" to indiciate that -mfpu=vfpv3-d16 was
passed from command line and not set by default. In lto-wrapper the options
could be parsed to check if they have "explicit" suffix and thus distinguish
between explicit and defualt defined options.
Does that sound reasonable ? I would be grateful for suggestions.

Thank you,

More information about the Gcc-bugs mailing list