RFA/RFC: Using weak symbols to work around missing newlib math functions in gcc.dg tests
Nick Clifton
nickc@redhat.com
Thu Dec 2 11:07:00 GMT 2004
Hi Guys,
I made a change to the dejagnu test harness recently that made
newlib header files be included via the -isystem command line switch
and not the -I switch. This broke the gcc.dg/builtins-18.c and
gcc/dg/builtins-20.c tests for targets that use newlib:
http://gcc.gnu.org/ml/gcc-patches/2004-11/msg00881.html
http://sources.redhat.com/ml/binutils/2004-11/msg00258.html
Although I believe that the patch itself was correct - newlib header
files are system header files and should be treated as such -
Richard Earnshaw asked if I could find a way to restore the search
path ordering such that when builtins-config.h includes <limits.h> it
gets the version in newlib and not the version in gcc/include. This
was cause of the new testsuite breakages because the <limits.h> in
gcc/include does not define _NEWLIB_VERSION and so builtins-config,h
defines HAVE_C99_RUNTIME which then leads to linkage errors.
I have not been able to find a way to restore the search path
ordering. GCC places gcc/include before all paths specified by the
-isystem switch, as this is necessary for the fixincludes system to
work. I think that this is the correct behaviour and that we do not
want the newlib include directory to be searched before the gcc
include directory. Instead I believe that we need to fix the
builtin tests in the gcc.dg testsuite.
In my opinion it is wrong for builtins-config.h to rely upon
<limits.h> defining _NEWLIB_VERSION, precisely because of this
fixincludes behaviour. Instead I feel that what should be done is
that the C99 math functions which are not provided by newlib should
be supplied as weak aliases. That way if GCC is not converting
their invocations into the built-in versions the tests will not fail
with link errors.
I am attaching a patch that would implement this idea. What do
people think ? Should this patch be checked in ?
Cheers
Nick
gcc/testsuite/ChangeLog
2004-12-02 Nick Clifton <nickc@redhat.com>
* gcc.dg/builtins-config.h: Remove test for _NEWLIB_VERSION as
<limits.h> is now picked up from the gcc/include directory and
not the newlib/libc/include directory.
* gcc.dg/builtins-18.c: Provide weak aliases of functions not
provided by newlib.
* gcc.dg/builtins-20.c: Likewise.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fred
Type: application/octet-stream
Size: 7369 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20041202/267e9a01/attachment.obj>
More information about the Gcc-patches
mailing list