From: H.J. Lu Date: Fri, 14 Sep 2001 23:43:17 +0000 (+0000) Subject: 2001-09-14 H.J. Lu X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=0c52a746f7537f9adc57c9b6b9980139fa2632cf;p=binutils-gdb.git 2001-09-14 H.J. Lu * ld-elfweak/bar.c: Updated. * ld-elfweak/bar1a.c: Likewise. * ld-elfweak/main.c: Likewise. * ld-elfweak/main1.c: Likewise. * ld-elfweak/elfweak.exp: Likewise. * ld-elfweak/weakdata.dsym: Updated. --- diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 72e9cff40c9..4512ad86c8a 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2001-09-14 H.J. Lu + + * ld-elfweak/bar.c: Updated. + * ld-elfweak/bar1a.c: Likewise. + * ld-elfweak/main.c: Likewise. + * ld-elfweak/main1.c: Likewise. + * ld-elfweak/elfweak.exp: Likewise. + * ld-elfweak/weakdata.dsym: Updated. + 2001-09-11 H.J. Lu * ld-elfweak/elfweak.exp (build_lib): Take a list of object diff --git a/ld/testsuite/ld-elfweak/bar.c b/ld/testsuite/ld-elfweak/bar.c index 2245e8da967..631751884b6 100644 --- a/ld/testsuite/ld-elfweak/bar.c +++ b/ld/testsuite/ld-elfweak/bar.c @@ -1,9 +1,16 @@ #include extern void foo (); +extern void foobar (); void foo () { printf ("strong foo\n"); } + +void +foobar () +{ + foo (); +} diff --git a/ld/testsuite/ld-elfweak/bar1a.c b/ld/testsuite/ld-elfweak/bar1a.c index 7ca1f041321..daf0c58bb7d 100644 --- a/ld/testsuite/ld-elfweak/bar1a.c +++ b/ld/testsuite/ld-elfweak/bar1a.c @@ -1,6 +1,23 @@ -#pragma weak deallocate_foo +#include -int deallocate_foo = 1; +extern int deallocate_foo; + +extern int * bar (); +extern int * foo (); +extern void abort (); +extern void foobar (); + +void +foobar () +{ + if (&deallocate_foo != bar () || &deallocate_foo != foo ()) + abort (); + + if (deallocate_foo) + printf ("weak deallocate_foo\n"); + else + printf ("strong deallocate_foo\n"); +} int * bar() diff --git a/ld/testsuite/ld-elfweak/elfweak.exp b/ld/testsuite/ld-elfweak/elfweak.exp index ea751f36844..bfefa115f11 100644 --- a/ld/testsuite/ld-elfweak/elfweak.exp +++ b/ld/testsuite/ld-elfweak/elfweak.exp @@ -434,6 +434,11 @@ if {![ld_link $ld $tmpdir/libfoo1b.so "$shared $tmpdir/foo1b.o"]} { return } +if {![ld_link $ld $tmpdir/libbar1a.so "$shared $tmpdir/bar1a.o $tmpdir/libfoo1a.so"]} { + fail "ELF weak" + return +} + build_lib "ELF DSO weak func first" libfoo "foo.o bar.o" dso.dsym build_lib "ELF DSO weak func last" libfoo "bar.o foo.o" dso.dsym setup_xfail "*-*-*" @@ -450,22 +455,22 @@ build_exec "ELF weak func last DSO" foo "libbar.so main.o" "-rpath ." weak weak. build_lib "ELF DSO weak data first" libfoo "bar1a.o foo1a.o" dsodata.dsym build_lib "ELF DSO weak data last" libfoo "foo1a.o bar1a.o" dsodata.dsym setup_xfail "*-*-*" -build_lib "ELF DSO weak data first DSO" libfoo "bar1a.o libfoo1a.so" dsowdata.dsym +build_lib "ELF DSO weak data first DSO" libfoo "main1.o libfoo1a.so" dsowdata.dsym setup_xfail "*-*-*" -build_lib "ELF DSO weak data last DSO" libfoo "libfoo1a.so bar1a.o" dsowdata.dsym +build_lib "ELF DSO weak data last DSO" libfoo "libfoo1a.so main1.o" dsowdata.dsym setup_xfail "*-*-*" -build_lib "ELF DSO weak data first DSO common" libfoo "bar1a.o libfoo1b.so" dsowdata.dsym +build_lib "ELF DSO weak data first DSO common" libfoo "main1.o libfoo1b.so" dsowdata.dsym setup_xfail "*-*-*" -build_lib "ELF DSO weak data last DSO common" libfoo "libfoo1b.so bar1a.o" dsowdata.dsym +build_lib "ELF DSO weak data last DSO common" libfoo "libfoo1b.so main1.o" dsowdata.dsym build_exec "ELF weak data first" foo "main1.o bar1a.o foo1a.o" "" strongdata "" strongdata.sym build_exec "ELF weak data last" foo "foo1a.o main1.o bar1a.o" "" strongdata "" strongdata.sym build_exec "ELF weak data first common" foo "main1.o bar1a.o foo1b.o" "" strongdata "" strongcomm.sym build_exec "ELF weak data last common" foo "foo1b.o main1.o bar1a.o" "" strongdata "" strongcomm.sym setup_xfail "*-*-*" -build_exec "ELF weak data first DSO" foo "main1.o bar1a.o libfoo1a.so" "-rpath ." weakdata weakdata.dsym "" +build_exec "ELF weak data first DSO" foo "main1.o libbar1a.so libfoo1a.so" "-rpath ." weakdata weakdata.dsym "" setup_xfail "*-*-*" -build_exec "ELF weak data last DSO" foo "libfoo1a.so main1.o bar1a.o" "-rpath ." weakdata weakdata.dsym "" +build_exec "ELF weak data last DSO" foo "libfoo1a.so main1.o libbar1a.so" "-rpath ." weakdata weakdata.dsym "" setup_xfail "*-*-*" -build_exec "ELF weak data first DSO common" foo "main1.o bar1a.o libfoo1b.so" "-rpath ." weakdata weakdata.dsym "" +build_exec "ELF weak data first DSO common" foo "main1.o libbar1a.so libfoo1b.so" "-rpath ." weakdata weakdata.dsym "" setup_xfail "*-*-*" -build_exec "ELF weak data last DSO common" foo "libfoo1b.so main1.o bar1a.o" "-rpath ." weakdata weakdata.dsym "" +build_exec "ELF weak data last DSO common" foo "libfoo1b.so main1.o libbar1a.so" "-rpath ." weakdata weakdata.dsym "" diff --git a/ld/testsuite/ld-elfweak/main.c b/ld/testsuite/ld-elfweak/main.c index 9daaceb685c..5ea170c8b05 100644 --- a/ld/testsuite/ld-elfweak/main.c +++ b/ld/testsuite/ld-elfweak/main.c @@ -3,6 +3,7 @@ #pragma weak foo extern void foo (); +extern void foobar (); void foo () @@ -13,6 +14,6 @@ foo () int main () { - foo (); + foobar (); return 0; } diff --git a/ld/testsuite/ld-elfweak/main1.c b/ld/testsuite/ld-elfweak/main1.c index 8a897a29141..39f819eb930 100644 --- a/ld/testsuite/ld-elfweak/main1.c +++ b/ld/testsuite/ld-elfweak/main1.c @@ -1,22 +1,11 @@ -#include - #pragma weak deallocate_foo int deallocate_foo = 1; -extern int * bar (); -extern int * foo (); -extern void abort (); +extern void foobar (); int main () { - if (&deallocate_foo != bar () || &deallocate_foo != foo ()) - abort (); - - if (deallocate_foo) - printf ("weak deallocate_foo\n"); - else - printf ("strong deallocate_foo\n"); - + foobar (); return 0; } diff --git a/ld/testsuite/ld-elfweak/weakdata.dsym b/ld/testsuite/ld-elfweak/weakdata.dsym index 4f1873b9a5b..0b5cca3a15c 100644 --- a/ld/testsuite/ld-elfweak/weakdata.dsym +++ b/ld/testsuite/ld-elfweak/weakdata.dsym @@ -1,2 +1 @@ [0-9a-f]*[ ]+w[ ]+DO[ ]+.data[ ]+[0-9a-f]*[ ]+(Base[ ]+|[ ]*)deallocate_foo -[0-9a-f]*[ ]+DF[ ]+\*UND\*[ ]+[0-9a-f]*[ ]+(Base[ ]+|[ ]*)foo