Bug 39790 - gcc.dg/tls/alias-1.c,opt-2.c fail if TLS is not supported by C library
Summary: gcc.dg/tls/alias-1.c,opt-2.c fail if TLS is not supported by C library
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: testsuite (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-04-17 01:10 UTC by Jing Yu
Modified: 2009-04-28 20:58 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: arm-unknown-eabi
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jing Yu 2009-04-17 01:10:56 UTC
I build the toolchain with newlib. gcc.dg/tls/alias-1.c and gcc.dg/tls/opt-2.c fail because symbol '__aeabi_read_tp' is missing in newlib C.

These two tests should be marked unsupported instead of just letting them fail.

The test alias-1.c does linking, and requires test target tls
/* { dg-require-effective-target tls } */
However, the rule of tls is just checking whether a piece of code can be compiled quietly. The rule does not check whether the code can be linked quietly.

Similarly, the test opt-2.c does linking, and requires test target tls_native.
However, the rule of tls_native only checks compilation, not linking.

The failures of the two tests are also observed on test report on target arm-unknown-elf: http://gcc.gnu.org/ml/gcc-testresults/2009-04/msg01691.html

Below is the failure message we get:
Executing on host: /usr/local/google/tmp/gcc4.4_dejagnu/obj/gcc-4.4/gcc/xgcc -B/usr/local/google/tmp/gcc4.4_dejagnu/obj/gcc-4.4/gcc/ /usr/local/google/nightly/sources/arm_toolchain/gcc-4.4/gcc/testsuite/gcc.dg/tls/alias-1.c gcc_tg.o    -ansi -pedantic-errors -DSTACK_SIZE=16384    -L/usr/local/google/tmp/gcc4.4_dejagnu/obj/ld   -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -lm   -o alias-1.exe    (timeout = 800)
/tmp/ccozOlBU.o: In function `main':
alias-1.c:(.text+0x10): undefined reference to `__aeabi_read_tp'
collect2: ld returned 1 exit status
compiler exited with status 1
output is:
/tmp/ccozOlBU.o: In function `main':
alias-1.c:(.text+0x10): undefined reference to `__aeabi_read_tp'
collect2: ld returned 1 exit status

FAIL: gcc.dg/tls/alias-1.c (test for excess errors)
Excess errors:
alias-1.c:(.text+0x10): undefined reference to `__aeabi_read_tp'

Executing on host: /usr/local/google/tmp/gcc4.4_dejagnu/obj/gcc-4.4/gcc/xgcc -B/usr/local/google/tmp/gcc4.4_dejagnu/obj/gcc-4.4/gcc/ /usr/local/google/nightly/sources/arm_toolchain/gcc-4.4/gcc/testsuite/gcc.dg/tls/opt-2.c gcc_tg.o   -O2 -ftls-model=initial-exec -DSTACK_SIZE=16384    -L/usr/local/google/tmp/gcc4.4_dejagnu/obj/ld   -Wl,-wrap,exit -Wl,-wrap,_exit -Wl,-wrap,main -Wl,-wrap,abort -lm -o opt-2.exe    (timeout = 800)
/tmp/ccKCVaB4.o: In function `foo':
opt-2.c:(.text+0x68): undefined reference to `__aeabi_read_tp'
collect2: ld returned 1 exit status
compiler exited with status 1
output is:
/tmp/ccKCVaB4.o: In function `foo':
opt-2.c:(.text+0x68): undefined reference to `__aeabi_read_tp'
collect2: ld returned 1 exit status

FAIL: gcc.dg/tls/opt-2.c (test for excess errors)
Excess errors:
opt-2.c:(.text+0x68): undefined reference to `__aeabi_read_tp'


Target: arm-eabi
Configured with: /usr/local/google/nightly/sources/arm_toolchain/gcc-4.4/configure --prefix=/usr/local/google/tmp/gcc4.4_dejagnu/install --target=arm-eabi --build=x86_64-linux-gnu --host=x86_64-linux-gnu --with-gmp=/usr/local/google/tmp/gcc4.4_dejagnu/install --with-mpfr=/usr/local/google/tmp/gcc4.4_dejagnu/install --enable-multilib --with-newlib --with-gnu-as --with-gnu-ld --enable-languages=c,c++
Thread model: single
gcc version 4.4.0 20090416 (prerelease) (GCC)
Comment 1 Hans-Peter Nilsson 2009-04-18 23:05:29 UTC
Long description just barely missing that you can fix it by changing that dg-line into:
/* { dg-require-effective-target tls_runtime } */
though strictly speaking it's not perfect; you'd want a predicate that checks using a link-test, not a run-test.  But all in all, I don't think the distinction is worthwhile.
Comment 2 Hans-Peter Nilsson 2009-04-18 23:08:03 UTC
(In reply to comment #1)
Bah, I missed the follow-up, as it wasn't in the audit trail.  Feel free to ignore comment #1 and comment #2 (this ;)
Comment 3 Jing Yu 2009-04-28 20:39:24 UTC
Subject: Bug 39790

Author: jingyu
Date: Tue Apr 28 20:39:11 2009
New Revision: 146913

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146913
Log:
	PR testsuite/39790
	* lib/target-supports.exp (check_effective_target_tls): Remove
	comment of caching.
	(check_effective_target_tls_native): Likewise.
	(check_effective_target_tls_runtime): Likewise.
	* gcc.dg/tls/alias-1.c (dg-require-effective-target): Change target
	tls to tls_runtime.
	* gcc.dg/tls/opt-2.c: Add dg-require-effective-target tls_runtime.


Modified:
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/gcc.dg/tls/alias-1.c
    trunk/gcc/testsuite/gcc.dg/tls/opt-2.c
    trunk/gcc/testsuite/lib/target-supports.exp

Comment 4 Jing Yu 2009-04-28 20:57:55 UTC
Subject: Bug 39790

Author: jingyu
Date: Tue Apr 28 20:57:42 2009
New Revision: 146914

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146914
Log:
	Backport from mainline.
	PR testsuite/39790
	* lib/target-supports.exp (check_effective_target_tls): Remove
	comment of caching.
	(check_effective_target_tls_native): Likewise.
	(check_effective_target_tls_runtime): Likewise.
	* gcc.dg/tls/alias-1.c (dg-require-effective-target): Change target
	tls to tls_runtime.
	* gcc.dg/tls/opt-2.c: Add dg-require-effective-target tls_runtime.


Modified:
    branches/gcc-4_4-branch/gcc/testsuite/ChangeLog
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/tls/alias-1.c
    branches/gcc-4_4-branch/gcc/testsuite/gcc.dg/tls/opt-2.c
    branches/gcc-4_4-branch/gcc/testsuite/lib/target-supports.exp

Comment 5 Jing Yu 2009-04-28 20:58:26 UTC
Patch was committed to trunk and branch 4.4.