AW: default specs file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Looking at gcc/gcc.c, it seems that specs files passed to gcc though the -specs switch are handled differently _on_ _purpose_  compared with default specs files:

In the first (good) case, the function read_specs(const char *specs, bool main_p, bool user_p) is called with

read_specs(specsfile, false, true);

while it is called like

read_specs(specsfile, true, false);

with the default specs file. And when parsing the specs file within that function the second way, several documented features in the specs file are considered invalid, e.g. the %rename command, as it does not end with a colon.

Could anyone please tell if this is either a bug or intended behavior?


-----Ursprüngliche Nachricht-----
Von: Warlich, Christof 
Gesendet: Mittwoch, 25. November 2015 11:42
An: gcc-help (gcc-help@xxxxxxxxxxx)
Betreff: default specs file

Hi,

I see a rather unexpected behavior when using a default specs file:

1) Check if the builtin spec is used initially:
$ gcc -v 2>&1  | grep specs
Using built-in specs.

2) Copy the builtin spec to the location of default specs file:
$ sudo bash -c "gcc -dumpspecs >$(dirname $(gcc -print-libgcc-file-name))/specs"

3) Check if the newly created default spec is used now:
$ gcc -v 2>&1  | grep specs
Reading specs from /usr/lib/gcc/x86_64-linux-gnu/4.8/specs

4) Adding a custom gcc command-line switch (--myswitch) by appending
%{-myswitch:-DMYSWITCH}
at the end of the *cpp: section of the default specs file.

5) Testing the new switch:
$ gcc --myswitch  -xc -c /dev/null
gcc: error: unrecognized command line option '--myswitch'

6) But when passing the specs file explicitly, everything works as expected:
$ rm -f /tmp/tst.o
$ gcc --myswitch  -xc -c -specs=$(dirname $(gcc -print-libgcc-file-name))/specs /dev/null -o /tmp/tst.o
$ ls /tmp/tst.o
/tmp/tst.o

To sum up: The modification of the specs file (i.e. adding a custom command line switch) works as expected when passing the specs file to gcc though its -specs option, but seems to be ignored if read from the default specs file.

Did I ran into a gcc bug? Or is this the intended behavior, and if so, why does gcc -v tells me that it is reading from the modified default specs file but then obviously ignores it?

Thanks for any suggestions,

Chris








[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux