[PATCH] Make --start-lib/--end-lib block on previous add symbols tasks
Cary Coutant
ccoutant@google.com
Thu Aug 19 23:37:00 GMT 2010
...and here's a testcase to go along with it. In order to get the
tasks to actually run out of order, it was necessary to use a -l
option before the --start-lib, and to have the reference to the
missing symbol in that library.
(Are you going to switch to automake 1.11.1?)
-cary
* testsuite/Makefile.am (start_lib_test): New test case.
* testsuite/Makefile.in: Regenerate.
* testsuite/start_lib_test_main.c: New test case source file.
* testsuite/start_lib_test_1.c: New test case source file.
* testsuite/start_lib_test_2.c: New test case source file.
* testsuite/start_lib_test_3.c: New test case source file.
-------------- next part --------------
Index: testsuite/Makefile.am
===================================================================
RCS file: /cvs/src/src/gold/testsuite/Makefile.am,v
retrieving revision 1.141
diff -u -p -r1.141 Makefile.am
--- testsuite/Makefile.am 19 Aug 2010 22:50:16 -0000 1.141
+++ testsuite/Makefile.am 19 Aug 2010 23:21:38 -0000
@@ -1750,6 +1750,15 @@ strong_ref_weak_def_1.so: strong_ref_wea
strong_ref_weak_def.stdout: strong_ref_weak_def_1.so
$(TEST_READELF) -sWD $< > $@
+# Test that --start-lib and --end-lib function correctly.
+check_PROGRAMS += start_lib_test
+start_lib_test: start_lib_test_main.o lib_start_lib_test.a start_lib_test_2.o start_lib_test_3.o \
+ gcctestdir/ld
+ $(LINK) -o $@ start_lib_test_main.o -L. -lstart_lib_test \
+ -Wl,--start-lib start_lib_test_2.o start_lib_test_3.o -Wl,--end-lib
+lib_start_lib_test.a: start_lib_test_1.o
+ $(TEST_AR) rc $@ $^
+
endif GCC
endif NATIVE_LINKER
Index: testsuite/start_lib_test_1.c
===================================================================
RCS file: testsuite/start_lib_test_1.c
diff -N testsuite/start_lib_test_1.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/start_lib_test_1.c 19 Aug 2010 23:21:38 -0000
@@ -0,0 +1,32 @@
+/* start_lib_test_1.c -- test --start-lib/--end-lib.
+
+ Copyright 2010 Free Software Foundation, Inc.
+ Written by Cary Coutant <ccoutant@google.com>
+
+ This file is part of gold.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ This is a test of the --start-lib and --end-lib options. */
+
+extern void t1 (void);
+extern void t2 (void);
+
+void
+t1 (void)
+{
+ t2 ();
+}
Index: testsuite/start_lib_test_2.c
===================================================================
RCS file: testsuite/start_lib_test_2.c
diff -N testsuite/start_lib_test_2.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/start_lib_test_2.c 19 Aug 2010 23:21:38 -0000
@@ -0,0 +1,30 @@
+/* start_lib_test_2.c -- test --start-lib/--end-lib.
+
+ Copyright 2010 Free Software Foundation, Inc.
+ Written by Cary Coutant <ccoutant@google.com>
+
+ This file is part of gold.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ This is a test of the --start-lib and --end-lib options. */
+
+extern void t2 (void);
+
+void
+t2 (void)
+{
+}
Index: testsuite/start_lib_test_3.c
===================================================================
RCS file: testsuite/start_lib_test_3.c
diff -N testsuite/start_lib_test_3.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/start_lib_test_3.c 19 Aug 2010 23:21:38 -0000
@@ -0,0 +1,30 @@
+/* start_lib_test_3.c -- test --start-lib/--end-lib.
+
+ Copyright 2010 Free Software Foundation, Inc.
+ Written by Cary Coutant <ccoutant@google.com>
+
+ This file is part of gold.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ This is a test of the --start-lib and --end-lib options. */
+
+extern void t3 (void);
+
+void
+t3 (void)
+{
+}
Index: testsuite/start_lib_test_main.c
===================================================================
RCS file: testsuite/start_lib_test_main.c
diff -N testsuite/start_lib_test_main.c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ testsuite/start_lib_test_main.c 19 Aug 2010 23:21:38 -0000
@@ -0,0 +1,33 @@
+/* start_lib_test_main.c -- test --start-lib/--end-lib.
+
+ Copyright 2010 Free Software Foundation, Inc.
+ Written by Cary Coutant <ccoutant@google.com>
+
+ This file is part of gold.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+ MA 02110-1301, USA.
+
+ This is a test of the --start-lib and --end-lib options. */
+
+extern void t1 (void);
+
+int
+main (int argc __attribute__ ((unused)),
+ char** argv __attribute__ ((unused)))
+{
+ t1 ();
+ return 0;
+}
More information about the Binutils
mailing list