PATCH: Add an undefined weak size change test
H. J. Lu
hjl@lucon.org
Sat Apr 17 08:07:00 GMT 2004
On Sat, Apr 17, 2004 at 12:51:15AM -0400, Daniel Jacobowitz wrote:
> On Fri, Apr 16, 2004 at 11:24:26AM -0700, H. J. Lu wrote:
> > This patch adds a testcase for PR/113:
> >
> > http://sources.redhat.com/bugzilla/show_bug.cgi?id=113
>
> Did you mean to include the patch?
Oops. I thought I did. Sorry for that. Here it is.
H.J.
-------------- next part --------------
2004-04-16 H.J. Lu <hongjiu.lu@intel.com>
* ld-elfweak/elfweak.exp: Add an undefined weak size change
test.
* ld-elfweak/size.dat: New file.
* ld-elfweak/size_bar.c: Likewise.
* ld-elfweak/size_foo.c: Likewise.
* ld-elfweak/size_main.c: Likewise.
--- ld/testsuite/ld-elfweak/elfweak.exp.size 2003-05-19 08:23:00.000000000 -0700
+++ ld/testsuite/ld-elfweak/elfweak.exp 2004-04-16 11:15:19.000000000 -0700
@@ -287,7 +287,8 @@ proc build_lib {test libname objs dynsym
return
}
- if {![objdump_dynsymstuff $objdump $tmpdir/$libname.so $srcdir/$subdir/$dynsymexp]} {
+ if {![string match "" $dynsymexp] \
+ && ![objdump_dynsymstuff $objdump $tmpdir/$libname.so $srcdir/$subdir/$dynsymexp]} {
fail $test
return
}
@@ -465,3 +466,30 @@ build_exec "ELF weak data first DSO" foo
build_exec "ELF weak data last DSO" foo "libfoo1a.so main1.o libbar1a.so" "-Wl,-rpath,." weakdata weakdata.dsym ""
build_exec "ELF weak data first DSO common" foo "main1.o libbar1a.so libfoo1b.so" "-Wl,-rpath,." weakdata weakdata.dsym ""
build_exec "ELF weak data last DSO common" foo "libfoo1b.so main1.o libbar1a.so" "-Wl,-rpath,." weakdata weakdata.dsym ""
+
+if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/size_foo.c $tmpdir/size_foo.o] {
+ unresolved "ELF weak (size)"
+ return
+}
+
+if ![ld_compile "$CC $CFLAGS $picflag" $srcdir/$subdir/size_bar.c $tmpdir/size_bar.o] {
+ unresolved "ELF weak (size)"
+ return
+}
+
+build_lib "ELF DSO small bar (size)" libsize_bar "size_bar.o" ""
+build_lib "ELF DSO foo with small bar (size)" libsize_foo "size_foo.o libsize_bar.so" ""
+
+if ![ld_compile "$CC $CFLAGS $picflag -DSIZE_BIG" $srcdir/$subdir/size_bar.c $tmpdir/size_bar.o] {
+ unresolved "ELF weak (size)"
+ return
+}
+
+build_lib "ELF DSO big bar (size)" libsize_bar "size_bar.o" ""
+
+if ![ld_compile "$CC $CFLAGS" $srcdir/$subdir/size_main.c $tmpdir/size_main.o] {
+ unresolved "ELF weak (size)"
+ return
+}
+
+build_exec "ELF weak size" size_main "size_main.o libsize_foo.so libsize_bar.so" "-Wl,-rpath,." size "" ""
--- ld/testsuite/ld-elfweak/size.dat.size 2004-04-16 11:15:33.000000000 -0700
+++ ld/testsuite/ld-elfweak/size.dat 2004-04-16 11:15:28.000000000 -0700
@@ -0,0 +1,3 @@
+1
+2
+3
--- ld/testsuite/ld-elfweak/size_bar.c.size 2004-04-16 10:57:25.000000000 -0700
+++ ld/testsuite/ld-elfweak/size_bar.c 2004-04-16 10:57:11.000000000 -0700
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+void
+bar ()
+{
+#ifdef SIZE_BIG
+ printf ("1\n");
+ printf ("2\n");
+ printf ("3\n");
+#endif
+}
--- ld/testsuite/ld-elfweak/size_foo.c.size 2004-04-16 10:57:28.000000000 -0700
+++ ld/testsuite/ld-elfweak/size_foo.c 2004-04-16 10:43:15.000000000 -0700
@@ -0,0 +1,8 @@
+#pragma weak bar
+
+extern void bar ();
+
+foo ()
+{
+ bar ();
+}
--- ld/testsuite/ld-elfweak/size_main.c.size 2004-04-16 10:57:31.000000000 -0700
+++ ld/testsuite/ld-elfweak/size_main.c 2004-04-16 10:42:48.000000000 -0700
@@ -0,0 +1,8 @@
+extern void foo ();
+
+int
+main ()
+{
+ foo ();
+ return 0;
+}
More information about the Binutils
mailing list