diff options
author | Jakub Jelinek <jakub@redhat.com> | 2003-02-13 22:14:11 +0000 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2003-02-13 22:14:11 +0000 |
commit | 9147e853bf5d168c176eb3993f93bda12de96232 (patch) | |
tree | dd406335a96b74a500bd03985f52327908e76a15 /ld | |
parent | 40f235b7e218cc05a6cc5eea2aaac15d1e292058 (diff) | |
download | gdb-9147e853bf5d168c176eb3993f93bda12de96232.zip gdb-9147e853bf5d168c176eb3993f93bda12de96232.tar.gz gdb-9147e853bf5d168c176eb3993f93bda12de96232.tar.bz2 |
bfd/
* elflink.h (elf_link_add_object_symbols): Handle .symver x, x@FOO.
ld/testsuite/
* ld-shared/shared.exp: Run on s390*-*-linux* and x86_64-*-linux* too.
xfail tests linking non-pic code into shared libs on x86_64-*-linux*.
* ld-elfvsb/elfvsb.exp: Likewise.
* ld-elfvers/vers.exp: Likewise. Add vers24a, vers24b and vers24c
tests.
* ld-elfvers/vers3.ver: Allow VERS_2.0 to come before GLIBC_*
version.
* ld-elfvers/vers19.ver: Likewise.
* ld-elfvers/vers24a.c: New test.
* ld-elfvers/vers24b.c: New test.
* ld-elfvers/vers24c.c: New test.
* ld-elfvers/vers24.map: New test.
* ld-elfvers/vers24.rd: New test.
* lib/ld-lib.exp (run_ld_link_tests): Add optional 7th argument
cflags. If source files have .c extension, compile them first.
Diffstat (limited to 'ld')
-rw-r--r-- | ld/testsuite/ChangeLog | 18 | ||||
-rw-r--r-- | ld/testsuite/ld-elfvers/vers.exp | 29 | ||||
-rw-r--r-- | ld/testsuite/ld-elfvers/vers19.ver | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-elfvers/vers24.map | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-elfvers/vers24.rd | 15 | ||||
-rw-r--r-- | ld/testsuite/ld-elfvers/vers24a.c | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-elfvers/vers24b.c | 5 | ||||
-rw-r--r-- | ld/testsuite/ld-elfvers/vers24c.c | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-elfvers/vers3.ver | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-elfvsb/elfvsb.exp | 9 | ||||
-rw-r--r-- | ld/testsuite/ld-shared/shared.exp | 9 | ||||
-rw-r--r-- | ld/testsuite/lib/ld-lib.exp | 28 |
12 files changed, 120 insertions, 15 deletions
diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index b49ce0c..6a2f5a1 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,21 @@ +2003-02-10 Jakub Jelinek <jakub@redhat.com> + + * ld-shared/shared.exp: Run on s390*-*-linux* and x86_64-*-linux* too. + xfail tests linking non-pic code into shared libs on x86_64-*-linux*. + * ld-elfvsb/elfvsb.exp: Likewise. + * ld-elfvers/vers.exp: Likewise. Add vers24a, vers24b and vers24c + tests. + * ld-elfvers/vers3.ver: Allow VERS_2.0 to come before GLIBC_* + version. + * ld-elfvers/vers19.ver: Likewise. + * ld-elfvers/vers24a.c: New test. + * ld-elfvers/vers24b.c: New test. + * ld-elfvers/vers24c.c: New test. + * ld-elfvers/vers24.map: New test. + * ld-elfvers/vers24.rd: New test. + * lib/ld-lib.exp (run_ld_link_tests): Add optional 7th argument + cflags. If source files have .c extension, compile them first. + 2003-02-10 Kaz kojima <kkojima@rr.iij4u.or.jp> * ld-sh/tlstpoff-1.d: New. diff --git a/ld/testsuite/ld-elfvers/vers.exp b/ld/testsuite/ld-elfvers/vers.exp index 4cd76b9..68b5b08 100644 --- a/ld/testsuite/ld-elfvers/vers.exp +++ b/ld/testsuite/ld-elfvers/vers.exp @@ -43,7 +43,9 @@ if { ![istarget hppa*64*-*-hpux*] \ && ![istarget sparc*-*-linux*] \ && ![istarget arm*-*-linux*] \ && ![istarget mips*-*-linux*] \ - && ![istarget alpha*-*-linux*] } { + && ![istarget alpha*-*-linux*] \ + && ![istarget s390*-*-linux*] \ + && ![istarget x86_64-*-linux*] } { return } @@ -719,7 +721,12 @@ build_vers_lib "vers1" vers1.c vers1 "" vers1.map vers1.ver vers1.dsym vers1.sym # Test #2 - build a library, and link it against the library we built in step # 1. # -build_vers_lib "vers2" vers2.c vers2 vers1.so vers2.map vers2.ver vers2.dsym "" +if [istarget x86_64-*-linux*] { + # x86_64 doesn't like non-pic shared libraries + xfail "vers2" +} else { + build_vers_lib "vers2" vers2.c vers2 vers1.so vers2.map vers2.ver vers2.dsym "" +} # # Test #3 - build an executable, and link it against vers1.so. @@ -838,3 +845,21 @@ build_vers_lib "vers23b" vers23b.c vers23b "" vers23b.map vers23b.ver vers23b.ds build_vers_lib "vers23c" vers23b.c vers23c "vers23a.so" vers23b.map vers23c.ver vers23b.dsym "" build_exec "vers23d" vers23.c vers23d "tmpdir/vers23a.so tmpdir/vers23c.so" "" vers23.ver vers23d.dsym "" build_exec "vers23" vers23.c vers23 "tmpdir/vers23a.so tmpdir/vers23b.o tmpdir/vers23b.so" "" vers23.ver vers23.dsym "" + +# Test .symver x,x@VERS.0 +set as_pic_flags "" +if [istarget sparc*-*-*] { + set as_pic_flags "-K PIC" +} +run_ld_link_tests [list "\"vers24a\" + \"-shared --version-script $srcdir/$subdir/vers24.map\" + \"$as_pic_flags\" {vers24a.c vers24b.c} { { readelf -Wrs vers24.rd } } + \"libvers24a.so\" \"-fpic\""] +run_ld_link_tests [list "\"vers24b\" + \"-shared --version-script $srcdir/$subdir/vers24.map\" + \"$as_pic_flags\" {vers24b.c vers24a.c} { { readelf -Wrs vers24.rd } } + \"libvers24b.so\" \"-fpic\""] +run_ld_link_tests [list "\"vers24c\" + \"-shared --version-script $srcdir/$subdir/vers24.map\" + \"$as_pic_flags\" {vers24c.c} { { readelf -Wrs vers24.rd } } + \"libvers24c.so\" \"-fpic\""] diff --git a/ld/testsuite/ld-elfvers/vers19.ver b/ld/testsuite/ld-elfvers/vers19.ver index e694a27..5969797 100644 --- a/ld/testsuite/ld-elfvers/vers19.ver +++ b/ld/testsuite/ld-elfvers/vers19.ver @@ -1,3 +1,3 @@ Version References: required from vers17.so: - 0x0a7922b0 0x00 02 VERS_2.0 + 0x0a7922b0 0x00 0[23] VERS_2.0 diff --git a/ld/testsuite/ld-elfvers/vers24.map b/ld/testsuite/ld-elfvers/vers24.map new file mode 100644 index 0000000..06ea42f --- /dev/null +++ b/ld/testsuite/ld-elfvers/vers24.map @@ -0,0 +1,4 @@ +VERS.0 { + global: x; foo; + local: *; +}; diff --git a/ld/testsuite/ld-elfvers/vers24.rd b/ld/testsuite/ld-elfvers/vers24.rd new file mode 100644 index 0000000..9ed8762 --- /dev/null +++ b/ld/testsuite/ld-elfvers/vers24.rd @@ -0,0 +1,15 @@ +Relocation section .* +# Ensure there is a dynamic relocation against x +#... +[0-9a-f]+ +[0-9a-f]+ R_.* +x(| \+ 0) +#... +Symbol table '.dynsym' contains [0-9]+ entries: +# And ensure the dynamic symbol table contains at least x@VERS.0 +# and foo@@VERS.0 symbols +#... + +[0-9]+: [0-9a-f]+ +(4 OBJECT +GLOBAL DEFAULT +[0-9]+ x|[0-9]+ FUNC +GLOBAL DEFAULT +[0-9]+ foo@)@VERS\.0 +#... + +[0-9]+: [0-9a-f]+ +(4 OBJECT +GLOBAL DEFAULT +[0-9]+ x|[0-9]+ FUNC +GLOBAL DEFAULT +[0-9]+ foo@)@VERS\.0 +#... +Symbol table '.symtab' contains [0-9]+ entries: +#pass diff --git a/ld/testsuite/ld-elfvers/vers24a.c b/ld/testsuite/ld-elfvers/vers24a.c new file mode 100644 index 0000000..7fef8d8 --- /dev/null +++ b/ld/testsuite/ld-elfvers/vers24a.c @@ -0,0 +1,5 @@ +/* Test whether .symver x, x@foo + causes relocations against x within the same shared library + to become dynamic relocations against x@foo. */ +int x = 12; +__asm__ (".symver x, x@VERS.0"); diff --git a/ld/testsuite/ld-elfvers/vers24b.c b/ld/testsuite/ld-elfvers/vers24b.c new file mode 100644 index 0000000..8a18b3a --- /dev/null +++ b/ld/testsuite/ld-elfvers/vers24b.c @@ -0,0 +1,5 @@ +extern int x; +void foo (void) +{ + x = 24; +} diff --git a/ld/testsuite/ld-elfvers/vers24c.c b/ld/testsuite/ld-elfvers/vers24c.c new file mode 100644 index 0000000..267c424 --- /dev/null +++ b/ld/testsuite/ld-elfvers/vers24c.c @@ -0,0 +1,9 @@ +/* Test whether .symver x, x@foo + causes relocations against x within the same shared library + to become dynamic relocations against x@foo. */ +int x = 12; +__asm__ (".symver x, x@VERS.0"); +void foo (void) +{ + x = 24; +} diff --git a/ld/testsuite/ld-elfvers/vers3.ver b/ld/testsuite/ld-elfvers/vers3.ver index aa230ee..41dad48 100644 --- a/ld/testsuite/ld-elfvers/vers3.ver +++ b/ld/testsuite/ld-elfvers/vers3.ver @@ -1,4 +1,4 @@ Version References: required from tmpdir/vers1.so: - 0x0a7922b0 0x00 02 VERS_2.0 + 0x0a7922b0 0x00 0[23] VERS_2.0 diff --git a/ld/testsuite/ld-elfvsb/elfvsb.exp b/ld/testsuite/ld-elfvsb/elfvsb.exp index d73f679..c4f82f4 100644 --- a/ld/testsuite/ld-elfvsb/elfvsb.exp +++ b/ld/testsuite/ld-elfvsb/elfvsb.exp @@ -1,5 +1,5 @@ # Expect script for ld-visibility tests -# Copyright 2000, 2001 Free Software Foundation, Inc. +# Copyright 2000, 2001, 2003 Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -35,7 +35,9 @@ if { ![istarget hppa*64*-*-hpux*] \ && ![istarget powerpc-*-linux*] \ && ![istarget arm*-*-linux*] \ && ![istarget alpha*-*-linux*] \ - && ![istarget sparc*-*-linux*] } { + && ![istarget sparc*-*-linux*] \ + && ![istarget s390*-*-linux*] \ + && ![istarget x86_64-*-linux*] } { return } @@ -255,6 +257,7 @@ proc visibility_run {visibility} { setup_xfail "ia64-*-linux*" setup_xfail "alpha*-*-linux*" } + setup_xfail "x86_64-*-linux*" visibility_test $visibility vnp "visibility ($visibility) (non PIC)" mainnp.o sh1np.o sh2np.o elfvsb @@ -285,6 +288,7 @@ proc visibility_run {visibility} { setup_xfail "alpha*-*-linux*" setup_xfail "mips*-*-linux*" } + setup_xfail "x86_64-*-linux*" visibility_test $visibility vnp "visibility ($visibility) (non PIC, load offset)" \ mainnp.o sh1np.o sh2np.o elfvsb \ "-T $srcdir/$subdir/elf-offset.ld" @@ -341,6 +345,7 @@ proc visibility_run {visibility} { setup_xfail "ia64-*-linux*" setup_xfail "alpha*-*-linux*" } + setup_xfail "x86_64-*-linux*" visibility_test $visibility vmpnp "visibility ($visibility) (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o elfvsb } } else { diff --git a/ld/testsuite/ld-shared/shared.exp b/ld/testsuite/ld-shared/shared.exp index dfe71dd..a6b8cc2 100644 --- a/ld/testsuite/ld-shared/shared.exp +++ b/ld/testsuite/ld-shared/shared.exp @@ -1,5 +1,5 @@ # Expect script for ld-shared tests -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003 # Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify @@ -49,7 +49,9 @@ if { ![istarget hppa*64*-*-hpux*] \ && ![istarget arm*-*-linux*] \ && ![istarget alpha*-*-linux*] \ && ![istarget rs6000*-*-aix*] \ - && ![istarget powerpc*-*-aix*] } { + && ![istarget powerpc*-*-aix*] \ + && ![istarget s390*-*-linux*] \ + && ![istarget x86_64-*-linux*] } { return } @@ -198,6 +200,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o] setup_xfail "*-*-sunos4*" setup_xfail "ia64-*-linux*" setup_xfail "alpha*-*-linux*" + setup_xfail "x86_64-*-linux*" shared_test shnp "shared (non PIC)" mainnp.o sh1np.o sh2np.o shared # Test ELF shared library relocations with a non-zero load @@ -210,6 +213,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG" $srcdir/$subdir/main.c $tmpdir/mainnp.o] setup_xfail "ia64-*-linux*" setup_xfail "alpha*-*-linux*" setup_xfail "mips*-*-linux*" + setup_xfail "x86_64-*-linux*" shared_test shnp "shared (non PIC, load offset)" \ mainnp.o sh1np.o sh2np.o shared \ "-T $srcdir/$subdir/elf-offset.ld" @@ -251,6 +255,7 @@ if ![ld_compile "$CC $CFLAGS $SHCFLAG $picflag" $srcdir/$subdir/main.c $tmpdir/m setup_xfail "*-*-sunos4*" setup_xfail "ia64-*-linux*" setup_xfail "alpha*-*-linux*" + setup_xfail "x86_64-*-linux*" shared_test shmpnp "shared (PIC main, non PIC so)" mainp.o sh1np.o sh2np.o shared } } else { diff --git a/ld/testsuite/lib/ld-lib.exp b/ld/testsuite/lib/ld-lib.exp index 9a0b739..a58646a 100644 --- a/ld/testsuite/lib/ld-lib.exp +++ b/ld/testsuite/lib/ld-lib.exp @@ -1,5 +1,5 @@ # Support routines for LD testsuite. -# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 # Free Software Foundation, Inc. # # This file is free software; you can redistribute it and/or modify @@ -978,9 +978,11 @@ proc file_contents { filename } { return $contents } -# List contains test-items with 3 items followed by 2 lists: +# List contains test-items with 3 items followed by 2 lists, one item and +# one optional item: # 0:name 1:ld options 2:assembler options # 3:filenames of assembler files 4: action and options. 5: name of output file +# 6:compiler flags (optional) # Actions: # objdump: Apply objdump options on result. Compare with regex (last arg). @@ -996,14 +998,17 @@ proc run_ld_link_tests { ldtests } { global srcdir global subdir global env + global CC + global CFLAGS foreach testitem $ldtests { set testname [lindex $testitem 0] set ld_options [lindex $testitem 1] set as_options [lindex $testitem 2] - set as_files [lindex $testitem 3] + set src_files [lindex $testitem 3] set actions [lindex $testitem 4] set binfile tmpdir/[lindex $testitem 5] + set cflags [lindex $testitem 6] set objfiles {} set is_unresolved 0 set failed 0 @@ -1011,16 +1016,25 @@ proc run_ld_link_tests { ldtests } { # verbose -log "Testname is $testname" # verbose -log "ld_options is $ld_options" # verbose -log "as_options is $as_options" -# verbose -log "as_files is $as_files" +# verbose -log "src_files is $src_files" # verbose -log "actions is $actions" # verbose -log "binfile is $binfile" # Assemble each file in the test. - foreach as_file $as_files { - set objfile "tmpdir/[file rootname $as_file].o" + foreach src_file $src_files { + set objfile "tmpdir/[file rootname $src_file].o" lappend objfiles $objfile - if ![ld_assemble $as "$as_options $srcdir/$subdir/$as_file" $objfile] { + if { [file extension $src_file] == ".c" } { + set as_file "tmpdir/[file rootname $src_file].s" + if ![ld_compile "$CC -S $CFLAGS $cflags" $srcdir/$subdir/$src_file $as_file] { + set is_unresolved 1 + break + } + } else { + set as_file "$srcdir/$subdir/$src_file" + } + if ![ld_assemble $as "$as_options $as_file" $objfile] { set is_unresolved 1 break } |