%* in SPEC strings
Joern Rennecke
joern.rennecke@embecosm.com
Thu Feb 17 12:14:00 GMT 2011
In the Specs Language documentation in gcc.c it says:
%* substitute the variable part of a matched option. (See below.)
Note that each comma in the substituted string is replaced by
a single space.
However that is not quite what it does. It actually appends a space
at the end.
For a port that we hope to contribute in the future, besides a Linux version,
we need to support multiple target board variants (a set that is still
growing)
for a bare-metal newlib-based toolchain. We want to do this by linking in
an extra board-specific file in STARTFILE_SPECS.
The board is specified as part of an -m option that also triggers common SPEC
adaptations for the newlib-based toolchain.
According to the documentation, we should be able to specify the file with
name-prefix%*.o . However, because of the undocumented insertion of ' ',
this goes badly awry.
The emission of the extra ' ' goes back all the way to the dawn of RCS control
of GCC sources, so getting rid of it altogether is not likely to be easy.
However, most uses either have a whitespace character next - so the extra ' '
is redundant - or they have a '}' character next - in which case it seems
sensible to keep the ' ' for now.
There are two other cases in config/{,*/}*:
- LINK_SYSROOT_SPEC in config/darwin.h . At the only place where
LINK_SYSROOT_SPEC is used, a space follows.
- LINK_SPEC in config/m68k/uclinux.h . The use is at one of the two
alternative ends of LINK_SPEC; besides, the other end doesnt' have a
trailing space, either.
Thus, it seems safe to stop the emitting of the extra space if the next
character is not '}' .
Would a patch like the one below be considered when 4.7 phase 1 opens?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: bsp-diff-20110216-gcc.c
Type: text/x-c
Size: 831 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc/attachments/20110217/b88eed0c/attachment.bin>
More information about the Gcc
mailing list