This is the mail archive of the
mailing list for the GCC project.
Re: [testsuite, Android] Add <stdlib.h> to pr56407.c
- From: Maxim Kuvyrkov <maxim at kugelworks dot com>
- To: Alexander Ivchenko <aivchenk at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 6 Aug 2013 07:07:19 +1200
- Subject: Re: [testsuite, Android] Add <stdlib.h> to pr56407.c
- References: <CACysShjXTPPE1E36a60J9A9TosTS=GzC+zYTkOaOHogKZoymQA at mail dot gmail dot com>
On 5/08/2013, at 10:57 PM, Alexander Ivchenko wrote:
> The following test case fails to compile on Android: gcc.dg/torture/pr56407.c
> /tmp/ccA08Isw.o:pr56407.c:function test: error: undefined reference to 'rand'
> collect2: error: ld returned 1 exit status
> Which is not surprising at all, since the testcase has only the
> declarations of abort() and rand()
> and doesn't have any headers included.
It *is* surprising given that the testcase does have declarations of abort() or rand() -- which are the only two external functions referenced.
> The following patch adds <stdlib.h> to the test.
I don't think this a correct fix. [In most such cases the real problem can be found out by examining why linking a test against glibc works, but against bionic -- doesn't.]
How are you linking this testcase? Please post both the link line from testsuite log and verbose output of linking (obtainable by adding "-v" to the link line).