default specs file

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

 



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