This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [GOLD][PATCH] Fix a sort order breakage of the zero-length script output sections.
- From: Viktor Kutuzov <vkutuzov at accesssoftek dot com>
- To: Ian Lance Taylor <iant at google dot com>
- Cc: binutils <binutils at sourceware dot org>
- Date: Thu, 21 Oct 2010 11:21:30 -0700
- Subject: Re: [GOLD][PATCH] Fix a sort order breakage of the zero-length script output sections.
- References: <1286572778.1642.3200.camel@dp690-dev5v11.accesssoftek.com> <mcrtykrusdh.fsf@google.com>
- Reply-to: <vkutuzov at accesssoftek dot com>
Hi Ian,
we should move the gcctestdir/ld rule from NATIVE_LINKER section to have
a chance to use the tested linker outside of this section (with
script_test_10 in our case). I guess that a place within
NATIVE_OR_CROSS_LINKER will be optimal for this rule to make it
available for the both cases.
I have attached a patch with these changes.
Thanks.
-Viktor.
* testsuite/Makefile.am: Move gcctestdir/ld rule to
NATIVE_OR_CROSS_LINKER.
* testsuite/Makefile.in: Regenerate.
On Tue, 2010-10-12 at 12:24 -0700, Ian Lance Taylor wrote:
> Viktor Kutuzov <vkutuzov@accesssoftek.com> writes:
>
> > * configure.ac: Add NATIVE_OR_CROSS_LINKER condition macro.
> > * configure: Regenerate.
> > * testsuite/Makefile.am: Wrap the cross linker tests and the common
> > tests into NATIVE_OR_CROSS_LINKER;
> > Add the script section order test.
> > * testsuite/Makefile.in: Regenerate.
> > * testsuite/script_test_10.sh: New test. Test script section
> > order.
> > * testsuite/script_test_10.t: Likewise.
> > * testsuite/script_test_10.s: Likewise.
> > * script-sections.h (Script_sections): Sections_elements as public;
> > Add a new member to save a list of the section elements.
> > (Sort_output_sections::ctor): Add new parameter to pass a list
> > of the section elements.
> > * script-sections.cc (Sort_output_sections::swap): New method.
>
> Approved and applied with some changes to script-sections.cc and
> testsuite/Makefile.am, as follows.
>
> Thanks.
>
> Ian
>
>
> 2010-10-12 Viktor Kutuzov <vkutuzov@accesssoftek.com>
>
> * script-sections.h (class Script_sections): Make
> Sections_elements typedef public.
> * script-sections.cc (class Sort_output_sections): Add elements_
> field. Add constructor which sets it; change all callers.
> (Sort_output_sections::is_before): New function.
> (Sort_output_sections::operator()): Call is_before.
> * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
> conditional.
> * testsuite/script_test_10.sh: New test. Test script section
> order.
> * testsuite/script_test_10.t: Likewise.
> * testsuite/script_test_10.s: Likewise.
> * testsuite/Makefile.am: Wrap the cross linker tests and the
> common tests into NATIVE_OR_CROSS_LINKER.
> (check_SCRIPTS): Add script_test_10.sh.
> (check_DATA): Add script_test_10.stdout.
> (script_test_10.o, script_test_10): New targets.
> (script_test_10.stdout): New target.
> * configure, testsuite/Makefile.in: Regenerate.
>
>
Index: gold/testsuite/Makefile.am
===================================================================
RCS file: /cvs/src/src/gold/testsuite/Makefile.am,v
retrieving revision 1.151
diff -u -r1.151 Makefile.am
--- gold/testsuite/Makefile.am 16 Oct 2010 00:37:25 -0000 1.151
+++ gold/testsuite/Makefile.am 21 Oct 2010 17:32:19 -0000
@@ -71,6 +71,17 @@
# The unittests themselves
if NATIVE_OR_CROSS_LINKER
+if GCC
+
+# Infrastucture needed for the unittests: a directory where the linker
+# is named 'ld'. This is because the -B flag appends 'ld' to its arg.
+gcctestdir/ld: ../ld-new
+ test -d gcctestdir || mkdir -p gcctestdir
+ rm -f gcctestdir/ld
+ (cd gcctestdir && $(LN_S) ../../ld-new ld)
+
+endif GCC
+
check_PROGRAMS += object_unittest
object_unittest_SOURCES = object_unittest.cc
@@ -91,13 +102,6 @@
if NATIVE_LINKER
if GCC
-# Infrastucture needed for the unittests: a directory where the linker
-# is named 'ld'. This is because the -B flag appends 'ld' to its arg.
-gcctestdir/ld: ../ld-new
- test -d gcctestdir || mkdir -p gcctestdir
- rm -f gcctestdir/ld
- (cd gcctestdir && $(LN_S) ../../ld-new ld)
-
# Each of these .o's is a useful, small complete program. They're
# particularly useful for making sure ld-new's flags do what they're
# supposed to (hence their names), but are used for many tests that
Index: gold/testsuite/Makefile.in
===================================================================
RCS file: /cvs/src/src/gold/testsuite/Makefile.in,v
retrieving revision 1.160
diff -u -r1.160 Makefile.in
--- gold/testsuite/Makefile.in 16 Oct 2010 00:37:25 -0000 1.160
+++ gold/testsuite/Makefile.in 21 Oct 2010 17:32:22 -0000
@@ -48,8 +48,6 @@
$(am__EXEEXT_16) $(am__EXEEXT_17) $(am__EXEEXT_18) \
$(am__EXEEXT_19) $(am__EXEEXT_20) $(am__EXEEXT_21) \
$(am__EXEEXT_22)
-
-# The unittests themselves
@NATIVE_OR_CROSS_LINKER_TRUE@am__append_1 = object_unittest \
@NATIVE_OR_CROSS_LINKER_TRUE@ binary_unittest
@@ -3760,6 +3758,15 @@
recheck recheck-html tags uninstall uninstall-am
+# The unittests themselves
+
+# Infrastucture needed for the unittests: a directory where the linker
+# is named 'ld'. This is because the -B flag appends 'ld' to its arg.
+@GCC_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@gcctestdir/ld: ../ld-new
+@GCC_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ test -d gcctestdir || mkdir -p gcctestdir
+@GCC_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ rm -f gcctestdir/ld
+@GCC_TRUE@@NATIVE_OR_CROSS_LINKER_TRUE@ (cd gcctestdir && $(LN_S) ../../ld-new ld)
+
# ---------------------------------------------------------------------
# These tests test the output of gold (end-to-end tests). In
# particular, they make sure that gold can link "difficult" object
@@ -3769,13 +3776,6 @@
# tests. We use the gcc-specific flag '-B' to use our linker instead
# of the default linker, which is why we only run our tests under gcc.
-# Infrastucture needed for the unittests: a directory where the linker
-# is named 'ld'. This is because the -B flag appends 'ld' to its arg.
-@GCC_TRUE@@NATIVE_LINKER_TRUE@gcctestdir/ld: ../ld-new
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ test -d gcctestdir || mkdir -p gcctestdir
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ rm -f gcctestdir/ld
-@GCC_TRUE@@NATIVE_LINKER_TRUE@ (cd gcctestdir && $(LN_S) ../../ld-new ld)
-
# Each of these .o's is a useful, small complete program. They're
# particularly useful for making sure ld-new's flags do what they're
# supposed to (hence their names), but are used for many tests that