This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Committed: fix issues with the default -r scripts causing MMIX testsuite fails


This fixes the issues with the -r linker script I mentioned;
emitting non-relocatable (mmo format) objects and defining the
ENTRY. Another issue was not covered by the test-suite but fixed
anyway; .gnu.warning.* was discarded with -r.  And I think
setting _start. and providing Main at -r were by themselves
benevolent "features", but at least confusing.

The following test-suite failures were fixed by this:
Running /home/hp/binutils/src/ld/testsuite/ld-gc/gc.exp ...
FAIL: --gc-sections -r without -e
...
Running /home/hp/binutils/src/ld/testsuite/ld-libs/libs.exp ...
FAIL: -l: test

Committed.

	* scripttempl/mmo.sc: For relocateable links, set $OUTPUT_FORMAT to
	the new $RELOCATEABLE_OUTPUT_FORMAT, if set.
	(OUTPUT_FORMAT): Use the variable $OUTPUT_FORMAT.
	(ENTRY): Don't emit for relocateable links.
	(/DISCARD/): Don't discard .gnu.warning.* for relocateable links.
	* emulparams/mmo.sh (RELOCATEABLE_OUTPUT_FORMAT): Set, to
	elf64-mmix.
	* emulparams/elf64mmix.sh (OTHER_TEXT_SECTIONS): Empty, don't
	provide "Main" or set "_start.", for relocateable links.

Index: ld/emulparams/elf64mmix.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/elf64mmix.sh,v
retrieving revision 1.6
diff -p -u -r1.6 elf64mmix.sh
--- ld/emulparams/elf64mmix.sh	22 Oct 2008 05:20:44 -0000	1.6
+++ ld/emulparams/elf64mmix.sh	28 Jul 2009 22:50:34 -0000
@@ -35,11 +35,14 @@ EXTRA_EM_FILE=mmixelf
 # DEFINED wouldn't find the symbol if it was at the top; presumably
 # before the definition, if the definition is not in the first file.
 # FIXME: Arguably a linker bug.
-OTHER_TEXT_SECTIONS='
+# Only do this for a final link, or else we'll mess up e.g. error
+# messages.
+OTHER_TEXT_SECTIONS="
+${RELOCATING+
  _start. = (DEFINED (_start) ? _start
             : (DEFINED (Main) ? Main : (DEFINED (.text) ? .text : 0)));
  PROVIDE (Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : _start.));
-'
+}"

 OTHER_SECTIONS='
  .MMIX.reg_contents :
Index: ld/emulparams/mmo.sh
===================================================================
RCS file: /cvs/src/src/ld/emulparams/mmo.sh,v
retrieving revision 1.1
diff -p -u -r1.1 mmo.sh
--- ld/emulparams/mmo.sh	30 Oct 2001 15:20:11 -0000	1.1
+++ ld/emulparams/mmo.sh	28 Jul 2009 22:50:34 -0000
@@ -5,6 +5,7 @@ TARGET_PAGE_SIZE=256
 TEXT_START_ADDR='DEFINED (__.MMIX.start..text) ? __.MMIX.start..text : 0'
 DATA_ADDR='DEFINED (__.MMIX.start..data) ? __.MMIX.start..data : 0x2000000000000000'
 OUTPUT_FORMAT=mmo
+RELOCATEABLE_OUTPUT_FORMAT=elf64-mmix
 ARCH=mmix
 COMPILE_IN=yes
 EXTRA_EM_FILE=mmo
Index: ld/scripttempl/mmo.sc
===================================================================
RCS file: /cvs/src/src/ld/scripttempl/mmo.sc,v
retrieving revision 1.6
diff -p -u -r1.6 mmo.sc
--- ld/scripttempl/mmo.sc	28 Aug 2006 01:52:56 -0000	1.6
+++ ld/scripttempl/mmo.sc	28 Jul 2009 22:50:34 -0000
@@ -1,7 +1,11 @@
+# MMO is not a relocateable format, and we don't want to require an
+# explicit (e.g.) "-m elf64mmix" when -r is used.
+test -z $RELOCATEABLE_OUTPUT_FORMAT && RELOCATEABLE_OUTPUT_FORMAT=$OUTPUT_FORMAT
+test -z ${RELOCATING+0} && OUTPUT_FORMAT=$RELOCATEABLE_OUTPUT_FORMAT
 cat <<EOF
-OUTPUT_FORMAT("mmo")
+OUTPUT_FORMAT("$OUTPUT_FORMAT")
 OUTPUT_ARCH(mmix)
-ENTRY(Main)
+${RELOCATING+ENTRY(Main)}
 SECTIONS
 {
   .text ${RELOCATING+ ${TEXT_START_ADDR}}:
@@ -128,6 +132,6 @@ SECTIONS
   /* Unfortunately, stabs are not mappable from ELF to MMO.
      It can probably be fixed with some amount of work.  */
   /DISCARD/ :
-  { *(.gnu.warning.*); }
+  { ${RELOCATING+ *(.gnu.warning.*);} }
 }
 EOF

brgds, H-P


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]