This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[PATCH 1/2] ld/testsuite: Check DF_STATIC_TLS is correctly added
- From: Kyle McMartin <kmcmarti at redhat dot com>
- To: binutils at sourceware dot org
- Cc: will dot newton at linaro dot org, nickc at redhat dot com
- Date: Mon, 30 Jun 2014 20:15:30 -0400
- Subject: [PATCH 1/2] ld/testsuite: Check DF_STATIC_TLS is correctly added
- Authentication-results: sourceware.org; auth=none
Most TLS tests appear to be predicated on Linux, so add a check for
static TLS relocs causing DF_STATIC_TLS to be set to shared.exp in the
Linux specific tests section. Checked that this doesn't regress the
existing pair of tests on AArch64 and X86-64, and that the added test
correctly fails on AArch64 and passes elsewhere (where DF_STATIC_TLS is
added already.)
ld/testsuite/ChangeLog:
2014-06-30 Kyle McMartin <kyle@redhat.com>
* ld-elf/shared.exp: Add a test to ensure shared libraries with
static TLS relocs correctly get DF_STATIC_TLS set. Also refactor
the linux specific tests to match the rest of the file.
* ld-elf/tls-flag-static_tls.c: New file.
* ld-elf/tls-flag-static_tls.rd: New file.
--- a/ld/testsuite/ld-elf/shared.exp
+++ b/ld/testsuite/ld-elf/shared.exp
@@ -467,25 +467,19 @@ run_ld_link_exec_tests [] $run_cxx_tests
if { [istarget *-*-linux*]
|| [istarget *-*-nacl*]
|| [istarget *-*-gnu*] } {
- run_cc_link_tests [list \
- [list \
- "Build libpr2404b.a with PIE" \
- "" \
- "-fPIE" \
- { pr2404b.c } \
- {} \
- "libpr2404b.a" \
- ] \
- ]
- run_ld_link_exec_tests [] [list \
- [list \
- "Run pr2404 with PIE" \
- "-pie tmpdir/pr2404b.o tmpdir/libpr2404a.so" \
- "" \
- { dummy.c } \
- "pr2404pie" \
- "pr2404.out" \
- "-fPIE" \
- ] \
- ]
+ set build_gnu_tests {
+ {"Build libpr2404b.a with PIE"
+ "" "-fPIE"
+ {pr2404b.c} {} "libpr2404b.a"}
+ {"Build tls-flag-static_tls.so"
+ "-shared" "-fPIC"
+ {tls-flag-static_tls.c} {{readelf {-d} tls-flag-static_tls.rd}} "tls-flag-static_tls.so"}
+ }
+ run_cc_link_tests $build_gnu_tests
+ set run_gnu_tests {
+ {"Run pr2404 with PIE"
+ "-pie tmpdir/pr2404b.o tmpdir/libpr2404a.so" ""
+ {dummy.c} "pr2404pie" "pr2404.out" "-fPIE"}
+ }
+ run_ld_link_exec_tests [] $run_gnu_tests
}
--- /dev/null
+++ b/ld/testsuite/ld-elf/tls-flag-static_tls.c
@@ -0,0 +1,2 @@
+__thread int tmp_ie __attribute__ ((tls_model ("initial-exec")));
+void *tmp_ie_func(void) { return &tmp_ie; }
--- /dev/null
+++ b/ld/testsuite/ld-elf/tls-flag-static_tls.rd
@@ -0,0 +1,4 @@
+Dynamic section at offset 0x[0-9a-f]+ contains [0-9]+ entries:
+#...
+ +0x[0-9a-f]+ +\(FLAGS\) +STATIC_TLS
+#...