This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: Committed, MMIX: fix ld orphan placement bugs. Ok for 2.23?
- From: Tristan Gingold <gingold at adacore dot com>
- To: Hans-Peter Nilsson <hp at bitrange dot com>
- Cc: binutils at sourceware dot org
- Date: Mon, 10 Sep 2012 09:48:15 +0200
- Subject: Re: Committed, MMIX: fix ld orphan placement bugs. Ok for 2.23?
- References: <alpine.BSF.2.00.1209091231340.39964@dair.pair.com>
On Sep 9, 2012, at 6:32 PM, Hans-Peter Nilsson wrote:
> I'd like to put this on the 2.23 branch too, please?
> And <http://sourceware.org/ml/binutils/2012-09/msg00008.html>
> (FAIL: gas/mmix/fb-2)?
Yes, ok for 2.23
>
> Fixing orphan section bugs noticed in <http://gcc.gnu.org/PR54373>.
> Testsuite additions obviously derived from that.
>
> Committed to trunk.
>
> Speaking of .tm_clone_table, isn't it needed to add a new output
> section in elf.sc, like for .jcr, with a KEEP, or else the contents
> will be GC:ed? Maybe section groups handle that these days?
>
> ld:
> * emultempl/mmo.em (mmo_place_orphan): Rewrite to also attach
> orphan sections to .data and .bss output sections, not just .text.
> When giving up on finding a suitable output section, attach to any
> output section other than .MMIX.reg_contents, if it exists.
> * scripttempl/mmo.sc: Move output debug sections to just before
> .MMIX.reg_contents. Add .gnu.attributes. Add new . = . NOP
> assignments and move end-of-section provide-symbols after them
> to force the end-of-section symbols to the address after orphan
> placement. Add SORT_NONE to .init and .fini sections.
>
> ld/testsuite:
> * ld-mmix/sec-1.d, ld-mmix/sec-3.d: Force end-of-section symbols
> to be emitted and checked.
> * ld-mmix/data-1.s, ld-mmix/orph-.d, ld-mmix/orph-awp.d,
> ld-mmix/orph-d-a.d, ld-mmix/orph-d-awn.d, ld-mmix/orph-d-awp.d,
> ld-mmix/orph-d-awpe.d, ld-mmix/orph-d.d, ld-mmix/orph-dc-ap.d,
> ld-mmix/orph-dc-awp.d, ld-mmix/orph-dc.d, ld-mmix/tm-ae.s,
> ld-mmix/tm-ape.s, ld-mmix/tm-awne.s, ld-mmix/tm-awpe.s,
> ld-mmix/tm-d-ap.s, ld-mmix/tm-d-awp.s, ld-mmix/tm-d.s,
> ld-mmix/tm-e.s, ld-mmix/tm-orph1.s: New test files.
>
> Index: emultempl/mmo.em
> ===================================================================
> RCS file: /cvs/src/src/ld/emultempl/mmo.em,v
> retrieving revision 1.28
> diff -p -u -r1.28 mmo.em
> --- emultempl/mmo.em 14 May 2012 19:45:28 -0000 1.28
> +++ emultempl/mmo.em 9 Sep 2012 16:12:56 -0000
> @@ -53,22 +53,49 @@ mmo_place_orphan (asection *s,
> const char *secname,
> int constraint ATTRIBUTE_UNUSED)
> {
> - static struct orphan_save hold_text =
> - {
> - MMO_TEXT_SECTION_NAME,
> - SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE,
> - 0, 0, 0, 0
> - };
> - struct orphan_save *place;
> + static struct
> + {
> + flagword nonzero_flags;
> + struct orphan_save orphansave;
> + } holds[] =
> + {
> + {
> + SEC_CODE | SEC_READONLY,
> + {
> + MMO_TEXT_SECTION_NAME,
> + SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_READONLY | SEC_CODE,
> + 0, 0, 0, 0
> + }
> + },
> + {
> + SEC_LOAD | SEC_DATA,
> + {
> + MMO_DATA_SECTION_NAME,
> + SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_DATA,
> + 0, 0, 0, 0
> + }
> + },
> + {
> + SEC_ALLOC,
> + {
> + ".bss",
> + SEC_ALLOC,
> + 0, 0, 0, 0
> + }
> + }
> + };
> +
> + struct orphan_save *place = NULL;
> lang_output_section_statement_type *after;
> lang_output_section_statement_type *os;
> + size_t i;
>
> - /* We have nothing to say for anything other than a final link. */
> + /* We have nothing to say for anything other than a final link or
> + for sections that are excluded. */
> if (link_info.relocatable
> - || (s->flags & (SEC_EXCLUDE | SEC_LOAD)) != SEC_LOAD)
> + || (s->flags & SEC_EXCLUDE) != 0)
> return NULL;
>
> - /* Only care for sections we're going to load. */
> os = lang_output_section_find (secname);
>
> /* We have an output section by this name. Place the section inside it
> @@ -79,30 +106,65 @@ mmo_place_orphan (asection *s,
> return os;
> }
>
> - /* If this section does not have .text-type section flags or there's no
> - MMO_TEXT_SECTION_NAME, we don't have anything to say. */
> - if ((s->flags & (SEC_CODE | SEC_READONLY)) == 0)
> - return NULL;
> + /* Check for matching section type flags for sections we care about.
> + A section without contents can have SEC_LOAD == 0, but we still
> + want it attached to a sane section so the symbols appear as
> + expected. */
> + if ((s->flags & (SEC_ALLOC | SEC_READONLY)) != SEC_READONLY)
> + for (i = 0; i < sizeof (holds) / sizeof (holds[0]); i++)
> + if ((s->flags & holds[i].nonzero_flags) != 0)
> + {
> + place = &holds[i].orphansave;
> + if (place->os == NULL)
> + place->os = lang_output_section_find (place->name);
> + break;
> + }
> +
> + if (place == NULL)
> + {
> + /* For other combinations, we have to give up, except we make
> + sure not to place the orphan section after the
> + linker-generated register section; that'd make it continue
> + the reg section and we never want that to happen for orphan
> + sections. */
> + lang_output_section_statement_type *before;
> + lang_output_section_statement_type *lookup;
> + static struct orphan_save hold_nonreg =
> + {
> + NULL,
> + SEC_READONLY,
> + 0, 0, 0, 0
> + };
>
> - if (hold_text.os == NULL)
> - hold_text.os = lang_output_section_find (hold_text.name);
> + if (hold_nonreg.os == NULL)
> + {
> + before = lang_output_section_find (MMIX_REG_CONTENTS_SECTION_NAME);
>
> - place = &hold_text;
> - if (hold_text.os != NULL)
> - after = hold_text.os;
> - else
> - after = &lang_output_section_statement.head->output_section_statement;
> + /* If we have no such section, all fine; we don't care where
> + it's placed. */
> + if (before == NULL)
> + return NULL;
> +
> + /* We have to find the oss before this one, so we can use that as
> + "after". */
> + for (lookup = &lang_output_section_statement.head->output_section_statement;
> + lookup != NULL && lookup->next != before;
> + lookup = lookup->next)
> + ;
>
> - /* If there's an output section by this name, we'll use it, regardless
> - of section flags, in contrast to what's done in elf32.em. */
> - os = lang_insert_orphan (s, secname, 0, after, place, NULL, NULL);
> + hold_nonreg.os = lookup;
> + }
>
> - /* We need an output section for .text as a root, so if there was none
> - (might happen with a peculiar linker script such as in "map
> - addresses", map-address.exp), we grab the output section created
> - above. */
> - if (hold_text.os == NULL)
> - hold_text.os = os;
> + place = &hold_nonreg;
> + }
> +
> + after = place->os;
> + if (after == NULL)
> + return NULL;
> +
> + /* If there's an output section by *this* name, we'll use it, regardless
> + of actual section flags, in contrast to what's done in elf32.em. */
> + os = lang_insert_orphan (s, secname, 0, after, place, NULL, NULL);
>
> return os;
> }
> Index: scripttempl/mmo.sc
> ===================================================================
> RCS file: /cvs/src/src/ld/scripttempl/mmo.sc,v
> retrieving revision 1.11
> diff -p -u -r1.11 mmo.sc
> --- scripttempl/mmo.sc 29 Jun 2012 07:58:46 -0000 1.11
> +++ scripttempl/mmo.sc 9 Sep 2012 16:12:56 -0000
> @@ -20,12 +20,12 @@ SECTIONS
> /* FIXME: Move .init, .fini, .ctors and .dtors to their own sections. */
> ${RELOCATING+ PROVIDE (_init_start = .);}
> ${RELOCATING+ PROVIDE (_init = .);}
> - ${RELOCATING+ KEEP (*(.init))}
> + ${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
> ${RELOCATING+ PROVIDE (_init_end = .);}
>
> ${RELOCATING+ PROVIDE (_fini_start = .);}
> ${RELOCATING+ PROVIDE (_fini = .);}
> - ${RELOCATING+ KEEP (*(.fini))}
> + ${RELOCATING+ KEEP (*(SORT_NONE(.fini)))}
> ${RELOCATING+ PROVIDE (_fini_end = .);}
>
> /* FIXME: Align ctors, dtors, ehframe. */
> @@ -57,35 +57,17 @@ SECTIONS
> ${RELOCATING+KEEP (*(.eh_frame))}
> ${RELOCATING+*(.gcc_except_table)}
>
> - ${RELOCATING+ PROVIDE(etext = .);}
> - ${RELOCATING+ PROVIDE(_etext = .);}
> - ${RELOCATING+ PROVIDE(__etext = .);}
> ${RELOCATING+Main = DEFINED (Main) ? Main : (DEFINED (_start) ? _start : ADDR (.text));}
> }
>
> - .stab 0 : { *(.stab) }
> - .stabstr 0 : { *(.stabstr) }
> - .stab.excl 0 : { *(.stab.excl) }
> - .stab.exclstr 0 : { *(.stab.exclstr) }
> - .stab.index 0 : { *(.stab.index) }
> - .stab.indexstr 0 : { *(.stab.indexstr) }
> - .debug_aranges 0 : { *(.debug_aranges) }
> - .debug_pubnames 0 : { *(.debug_pubnames) }
> - .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
> - .debug_abbrev 0 : { *(.debug_abbrev) }
> - .debug_line 0 : { *(.debug_line) }
> - .debug_frame 0 : { *(.debug_frame) }
> - .debug_str 0 : { *(.debug_str) }
> - .debug_loc 0 : { *(.debug_loc) }
> - .debug_macinfo 0 : { *(.debug_macinfo) }
> - .debug_ranges 0 : { *(.debug_ranges) }
> -
> - /* DWARF 3 */
> - .debug_pubtypes 0 : { *(.debug_pubtypes) }
> - .debug_ranges 0 : { *(.debug_ranges) }
> -
> - /* DWARF Extension. */
> - .debug_macro 0 : { *(.debug_macro) }
> + /* The following NOP assignment and those after .data and .bss, are
> + necessary to get orphan sections adopted by the .text inserted before
> + the following end-section symbols. An output section would also serve
> + this purpose, but we can't do that. */
> + . = .;
> + ${RELOCATING+ PROVIDE(etext = .);}
> + ${RELOCATING+ PROVIDE(_etext = .);}
> + ${RELOCATING+ PROVIDE(__etext = .);}
>
> .data ${RELOCATING+ ${DATA_ADDR}}:
> {
> @@ -94,14 +76,13 @@ SECTIONS
> *(.data);
> ${RELOCATING+*(.data.*)}
> ${RELOCATING+*(.gnu.linkonce.d*)}
> -
> - ${RELOCATING+ PROVIDE(__Edata = .);}
> -
> - /* Deprecated, use __Edata. */
> - ${RELOCATING+ PROVIDE(edata = .);}
> - ${RELOCATING+ PROVIDE(_edata = .);}
> - ${RELOCATING+ PROVIDE(__edata = .);}
> }
> + . = .;
> + ${RELOCATING+ PROVIDE(__Edata = .);}
> + /* Deprecated, use __Edata. */
> + ${RELOCATING+ PROVIDE(edata = .);}
> + ${RELOCATING+ PROVIDE(_edata = .);}
> + ${RELOCATING+ PROVIDE(__edata = .);}
>
> /* At the moment, although perhaps we should, we can't map sections
> without contents to sections *with* contents due to FIXME: a BFD bug.
> @@ -115,8 +96,9 @@ SECTIONS
> ${RELOCATING+ *(.bss);}
> ${RELOCATING+*(.bss.*)}
> ${RELOCATING+ *(COMMON);}
> - ${RELOCATING+ PROVIDE(__Ebss = .);}
> }
> + . = .;
> + ${RELOCATING+ PROVIDE(__Ebss = .);}
>
> /* Deprecated, use __Ebss or __Eall as appropriate. */
> ${RELOCATING+ PROVIDE(end = .);}
> @@ -124,6 +106,30 @@ SECTIONS
> ${RELOCATING+ PROVIDE(__end = .);}
> ${RELOCATING+ PROVIDE(__Eall = .);}
>
> + .stab 0 : { *(.stab) }
> + .stabstr 0 : { *(.stabstr) }
> + .stab.excl 0 : { *(.stab.excl) }
> + .stab.exclstr 0 : { *(.stab.exclstr) }
> + .stab.index 0 : { *(.stab.index) }
> + .stab.indexstr 0 : { *(.stab.indexstr) }
> + .debug_aranges 0 : { *(.debug_aranges) }
> + .debug_pubnames 0 : { *(.debug_pubnames) }
> + .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
> + .debug_abbrev 0 : { *(.debug_abbrev) }
> + .debug_line 0 : { *(.debug_line) }
> + .debug_frame 0 : { *(.debug_frame) }
> + .debug_str 0 : { *(.debug_str) }
> + .debug_loc 0 : { *(.debug_loc) }
> + .debug_macinfo 0 : { *(.debug_macinfo) }
> + .debug_ranges 0 : { *(.debug_ranges) }
> +
> + /* DWARF 3 */
> + .debug_pubtypes 0 : { *(.debug_pubtypes) }
> + .debug_ranges 0 : { *(.debug_ranges) }
> +
> + /* DWARF Extension. */
> + .debug_macro 0 : { *(.debug_macro) }
> +
> .MMIX.reg_contents :
> {
> /* Note that this section always has a fixed VMA - that of its
> @@ -140,5 +146,7 @@ SECTIONS
> It can probably be fixed with some amount of work. */
> /DISCARD/ :
> { ${RELOCATING+ *(.gnu.warning.*);} }
> +
> + .gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }
> }
> EOF
> Index: ld-mmix/sec-1.d
> ===================================================================
> RCS file: /cvs/src/src/ld/testsuite/ld-mmix/sec-1.d,v
> retrieving revision 1.5
> diff -p -u -r1.5 sec-1.d
> --- ld-mmix/sec-1.d 3 Jan 2006 07:03:26 -0000 1.5
> +++ ld-mmix/sec-1.d 9 Sep 2012 15:42:52 -0000
> @@ -1,8 +1,8 @@
> #source: sec-1.s
> #source: start.s
> -#ld: -m elf64mmix
> +#ld: -m elf64mmix -u _etext -u _edata -u _end
> #objcopy_linked_file: -O mmo
> -#objdump: -sh
> +#objdump: -sht
>
> # Test conversion from ELF to mmo with non-mmo-sections present,
> # testing that support.
> @@ -21,6 +21,15 @@ Idx Name Size VMA
> CONTENTS, ALLOC, LOAD, DATA
> 4 thirdsec 0+a 0+ 0+ 0+ 2\*\*2
> CONTENTS, READONLY
> +
> +SYMBOL TABLE:
> +#...
> +0+1d g +\*ABS\* _etext
> +#...
> +2000000000000013 g +\*ABS\* __bss_start
> +2000000000000013 g +\*ABS\* _edata
> +2000000000000018 g +\*ABS\* _end
> +
> Contents of section \.text:
> 0000 e3fd0001 .*
> Contents of section secname:
> Index: ld-mmix/sec-3.d
> ===================================================================
> RCS file: /cvs/src/src/ld/testsuite/ld-mmix/sec-3.d,v
> retrieving revision 1.4
> diff -p -u -r1.4 sec-3.d
> --- ld-mmix/sec-3.d 11 Oct 2010 08:10:43 -0000 1.4
> +++ ld-mmix/sec-3.d 9 Sep 2012 15:35:31 -0000
> @@ -1,8 +1,8 @@
> #source: sec-1.s
> #source: start.s
> #source: data1.s
> -#ld: -m mmo
> -#objdump: -sh
> +#ld: -m mmo -u __etext -u __Sdata -u __Edata -u __Sbss -u __Ebss -u __Eall
> +#objdump: -sht
>
> .*: file format mmo
>
> @@ -20,6 +20,17 @@ Idx Name Size VMA
> CONTENTS, ALLOC, LOAD, DATA
> 5 thirdsec 0+a 0+ 0+ 0+ 2\*\*2
> CONTENTS, READONLY
> +
> +SYMBOL TABLE:
> +#...
> +0+30 g +\*ABS\* __etext
> +200000000000001c g +\*ABS\* __Ebss
> +200000000000001b g +\*ABS\* __Edata
> +#...
> +200000000000001c g +\*ABS\* __Eall
> +20+ g +\.data __Sdata
> +200000000000001c g +\*ABS\* __Sbss
> +
> Contents of section \.text:
> 0000 e3fd0001 .*
> Contents of section secname:
> Index: ld-mmix/data-1.s
> ===================================================================
> RCS file: ld-mmix/data-1.s
> diff -N ld-mmix/data-1.s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/data-1.s 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,2 @@
> + .data
> + OCTA #42
> Index: ld-mmix/orph-.d
> ===================================================================
> RCS file: ld-mmix/orph-.d
> diff -N ld-mmix/orph-.d
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/orph-.d 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,26 @@
> +#as: -linker-allocated-gregs
> +#source: start.s
> +#source: tm-orph1.s
> +#source: tm-e.s
> +#ld: -m mmo -u __etext -u __Sdata -u __Edata -u __Sbss -u __Ebss -u __Eall
> +#objdump: -rst
> +
> +# Like orph-d.d but without data.
> +
> +.*: file format mmo
> +
> +SYMBOL TABLE:
> +0+ +g +\.text Main
> +0+8 +g +\.text __etext
> +0+ +g +\.text __TMC_END__
> +20+ +g +\*ABS\* __Ebss
> +20+ +g +\*ABS\* __Edata
> +0+ +g +\.text _start
> +20+ +g +\*ABS\* __Eall
> +20+ +g +\*ABS\* __Sdata
> +20+ +g +\*ABS\* __Sbss
> +
> +Contents of section \.text:
> + 0000 e3fd0001 23fcfe00 .*
> +Contents of section .MMIX.reg_contents:
> + 07f0 00000000 00000007 .*
> Index: ld-mmix/orph-awp.d
> ===================================================================
> RCS file: ld-mmix/orph-awp.d
> diff -N ld-mmix/orph-awp.d
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/orph-awp.d 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,26 @@
> +#as: -linker-allocated-gregs
> +#source: start.s
> +#source: tm-orph1.s
> +#source: tm-awpe.s
> +#ld: -m mmo -u __etext -u __Sdata -u __Edata -u __Sbss -u __Ebss -u __Eall
> +#objdump: -rst
> +
> +# Like orph-d-awp.d, but without .data contents.
> +
> +.*: file format mmo
> +
> +SYMBOL TABLE:
> +0+ +g +\.text Main
> +0+8 +g +\.text __etext
> +20+ +g +\*ABS\* __TMC_END__
> +20+ +g +\*ABS\* __Ebss
> +20+ +g +\*ABS\* __Edata
> +0+ +g +\.text _start
> +20+ +g +\*ABS\* __Eall
> +20+ +g +\*ABS\* __Sdata
> +20+ +g +\*ABS\* __Sbss
> +
> +Contents of section \.text:
> + 0000 e3fd0001 23fcfe00 .*
> +Contents of section \.MMIX\.reg_contents:
> + 07f0 20000000 00000007 .*
> Index: ld-mmix/orph-d-a.d
> ===================================================================
> RCS file: ld-mmix/orph-d-a.d
> diff -N ld-mmix/orph-d-a.d
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/orph-d-a.d 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,30 @@
> +#as: -linker-allocated-gregs
> +#source: start.s
> +#source: data-1.s
> +#source: tm-orph1.s
> +#source: tm-ae.s
> +#ld: -m mmo -u __etext -u __Sdata -u __Edata -u __Sbss -u __Ebss -u __Eall
> +#objdump: -rst
> +
> +# A section that's just allocated (but not writable and no @progbits).
> +# Should attach to the .text section due to being read-only.
> +
> +.*: file format mmo
> +
> +SYMBOL TABLE:
> +0+ +g +\.text Main
> +0+8 +g +\.text __etext
> +0+8 +g +\.text __TMC_END__
> +20+8 +g +\.data __Ebss
> +20+8 +g +\.data __Edata
> +0+ +g +\.text _start
> +20+8 +g +\.data __Eall
> +20+ +g +\.data __Sdata
> +20+8 +g +\.data __Sbss
> +
> +Contents of section \.text:
> + 0000 e3fd0001 23fcfe00 .*
> +Contents of section \.data:
> + 2000000000000004 00000042 .*
> +Contents of section \.MMIX\.reg_contents:
> + 07f0 00000000 0000000f .*
> Index: ld-mmix/orph-d-awn.d
> ===================================================================
> RCS file: ld-mmix/orph-d-awn.d
> diff -N ld-mmix/orph-d-awn.d
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/orph-d-awn.d 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,31 @@
> +#as: -linker-allocated-gregs
> +#source: start.s
> +#source: data-1.s
> +#source: tm-orph1.s
> +#source: tm-awne.s
> +#ld: -m mmo -u __etext -u __Sdata -u __Edata -u __Sbss -u __Ebss -u __Eall
> +#objdump: -rst
> +
> +# A section that's "aw",@nobits, i.e. naturally .bss.
> +# Should attach to the .bss section (but we'll see it as attached to
> +# .data).
> +
> +.*: file format mmo
> +
> +SYMBOL TABLE:
> +0+ +g +\.text Main
> +0+8 +g +\.text __etext
> +20+8 +g +\.data __TMC_END__
> +20+8 +g +\.data __Ebss
> +20+8 +g +\.data __Edata
> +0+ +g +\.text _start
> +20+8 +g +\.data __Eall
> +20+ +g +\.data __Sdata
> +20+8 +g +\.data __Sbss
> +
> +Contents of section \.text:
> + 0000 e3fd0001 23fcfe00 .*
> +Contents of section \.data:
> + 2000000000000004 00000042 .*
> +Contents of section \.MMIX\.reg_contents:
> + 07f0 20000000 0000000f .*
> Index: ld-mmix/orph-d-awp.d
> ===================================================================
> RCS file: ld-mmix/orph-d-awp.d
> diff -N ld-mmix/orph-d-awp.d
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/orph-d-awp.d 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,33 @@
> +#as: -linker-allocated-gregs
> +#source: start.s
> +#source: data-1.s
> +#source: tm-orph1.s
> +#source: tm-awpe.s
> +#ld: -m mmo -u __etext -u __Sdata -u __Edata -u __Sbss -u __Ebss -u __Eall
> +#objdump: -rst
> +
> +# An orphan section (.tm_clone_table) would attach after the register
> +# section, and contents and symbols and related relocations would be
> +# reduced to be relative to the register section, which is an error.
> +# We check the original case ("aw",@progbits, to .data or .bss),
> +# PR ld/1xxxx.
> +
> +.*: file format mmo
> +
> +SYMBOL TABLE:
> +0+ +g +\.text Main
> +0+8 +g +\.text __etext
> +20+8 +g +\.data __TMC_END__
> +20+8 +g +\.data __Ebss
> +20+8 +g +\.data __Edata
> +0+ +g +\.text _start
> +20+8 +g +\.data __Eall
> +20+ +g +\.data __Sdata
> +20+8 +g +\.data __Sbss
> +
> +Contents of section \.text:
> + 0000 e3fd0001 23fcfe00 .*
> +Contents of section \.data:
> + 2000000000000004 00000042 .*
> +Contents of section \.MMIX\.reg_contents:
> + 07f0 20000000 0000000f .*
> Index: ld-mmix/orph-d-awpe.d
> ===================================================================
> RCS file: ld-mmix/orph-d-awpe.d
> diff -N ld-mmix/orph-d-awpe.d
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/orph-d-awpe.d 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,13 @@
> +#as: -linker-allocated-gregs
> +#source: start.s
> +#source: data-1.s
> +#source: tm-orph1.s
> +#source: tm-d.s
> +#source: tm-awpe.s
> +#ld: -m mmo -u __etext -u __Sdata -u __Edata -u __Sbss -u __Ebss -u __Eall
> +#error: overlaps section .text
> +
> +# Like orph-d-awp.d but with contents in that section. Also, mismatching
> +# section flags for the contents will cause a linker error, but we'll
> +# call this a doctor-it-hurts situation; either list the section in
> +# the linker script or have consistent section flags.
> Index: ld-mmix/orph-d.d
> ===================================================================
> RCS file: ld-mmix/orph-d.d
> diff -N ld-mmix/orph-d.d
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/orph-d.d 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,30 @@
> +#as: -linker-allocated-gregs
> +#source: start.s
> +#source: data-1.s
> +#source: tm-orph1.s
> +#source: tm-e.s
> +#ld: -m mmo -u __etext -u __Sdata -u __Edata -u __Sbss -u __Ebss -u __Eall
> +#objdump: -rst
> +
> +# Like orph-d-awp.d but a section without specified flags; should
> +# attach to .debug_info, i.e. have address 0.
> +
> +.*: file format mmo
> +
> +SYMBOL TABLE:
> +0+ +g +\.text Main
> +0+8 +g +\.text __etext
> +0+ +g +\.text __TMC_END__
> +20+8 +g +\.data __Ebss
> +20+8 +g +\.data __Edata
> +0+ +g +\.text _start
> +20+8 +g +\.data __Eall
> +20+ +g +\.data __Sdata
> +20+8 +g +\.data __Sbss
> +
> +Contents of section \.text:
> + 0000 e3fd0001 23fcfe00 .*
> +Contents of section \.data:
> + 2000000000000004 00000042 .*
> +Contents of section .MMIX.reg_contents:
> + 07f0 00000000 00000007 .*
> Index: ld-mmix/orph-dc-ap.d
> ===================================================================
> RCS file: ld-mmix/orph-dc-ap.d
> diff -N ld-mmix/orph-dc-ap.d
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/orph-dc-ap.d 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,34 @@
> +#as: -linker-allocated-gregs
> +#source: start.s
> +#source: data-1.s
> +#source: tm-orph1.s
> +#source: tm-d-ap.s
> +#source: tm-ape.s
> +#ld: -m mmo -u __etext -u __Sdata -u __Edata -u __Sbss -u __Ebss -u __Eall
> +#objdump: -rst
> +
> +# Like orph-d-a.d but with contents in that section (and with
> +# @progbits, which doesn't reflect in flags), making sure it's really
> +# treated as .text contents.
> +
> +.*: file format mmo
> +
> +SYMBOL TABLE:
> +0+ +g +\.text Main
> +0+18 +g +\*ABS\* __etext
> +0+18 +g +\*ABS\* __TMC_END__
> +20+8 +g +\.data __Ebss
> +20+8 +g +\.data __Edata
> +0+ +g +\.text _start
> +20+8 +g +\.data __Eall
> +20+ +g +\.data __Sdata
> +20+8 +g +\.data __Sbss
> +
> +Contents of section \.text:
> + 0000 e3fd0001 23fcfe00 .*
> +Contents of section \.tm_clone_table:
> + 0008 000004d2 0000162e 008adf38 00c8860c .*
> +Contents of section \.data:
> + 2000000000000004 00000042 .*
> +Contents of section \.MMIX\.reg_contents:
> + 07f0 00000000 0000001f .*
> Index: ld-mmix/orph-dc-awp.d
> ===================================================================
> RCS file: ld-mmix/orph-dc-awp.d
> diff -N ld-mmix/orph-dc-awp.d
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/orph-dc-awp.d 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,32 @@
> +#as: -linker-allocated-gregs
> +#source: start.s
> +#source: data-1.s
> +#source: tm-orph1.s
> +#source: tm-d-awp.s
> +#source: tm-awpe.s
> +#ld: -m mmo -u __etext -u __Sdata -u __Edata -u __Sbss -u __Ebss -u __Eall
> +#objdump: -rst
> +
> +# Like orph-d-awp.d, but with contents in the extra section.
> +
> +.*: file format mmo
> +
> +SYMBOL TABLE:
> +0+ +g +\.text Main
> +0+8 g +\.text __etext
> +2000000000000018 +g +\*ABS\* __TMC_END__
> +2000000000000018 g +\*ABS\* __Ebss
> +2000000000000018 g +\*ABS\* __Edata
> +0+ g +\.text _start
> +2000000000000018 g +\*ABS\* __Eall
> +20+ g +.data __Sdata
> +2000000000000018 g +\*ABS\* __Sbss
> +
> +Contents of section \.text:
> + 0000 e3fd0001 23fcfe00 .*
> +Contents of section \.data:
> + 2000000000000004 00000042 .*
> +Contents of section \.tm_clone_table:
> + 2000000000000008 000004d2 0000162e 008adf38 00c8860c .*
> +Contents of section \.MMIX\.reg_contents:
> + 07f0 20000000 0000001f .*
> Index: ld-mmix/orph-dc.d
> ===================================================================
> RCS file: ld-mmix/orph-dc.d
> diff -N ld-mmix/orph-dc.d
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/orph-dc.d 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,32 @@
> +#as: -linker-allocated-gregs
> +#source: start.s
> +#source: data-1.s
> +#source: tm-orph1.s
> +#source: tm-d.s
> +#source: tm-e.s
> +#ld: -m mmo -u __etext -u __Sdata -u __Edata -u __Sbss -u __Ebss -u __Eall
> +#objdump: -rst
> +
> +# Like orph-d.d but with contents in the section without specified flags.
> +
> +.*: file format mmo
> +
> +SYMBOL TABLE:
> +0+ +g +\.text Main
> +0+8 g +.text __etext
> +0+10 +g +\*ABS\* __TMC_END__
> +2000000000000008 g +\.data __Ebss
> +2000000000000008 g +\.data __Edata
> +0+ +g +\.text _start
> +2000000000000008 g +\.data __Eall
> +2000000000000000 g +\.data __Sdata
> +2000000000000008 g +\.data __Sbss
> +
> +Contents of section \.text:
> + 0000 e3fd0001 23fcfe00 .*
> +Contents of section \.data:
> + 2000000000000004 00000042 .*
> +Contents of section \.tm_clone_table:
> + 0000 000004d2 0000162e 008adf38 00c8860c .*
> +Contents of section .MMIX.reg_contents:
> + 07f0 00000000 00000017 .*
> Index: ld-mmix/tm-ae.s
> ===================================================================
> RCS file: ld-mmix/tm-ae.s
> diff -N ld-mmix/tm-ae.s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/tm-ae.s 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,3 @@
> + .section .tm_clone_table,"a"
> + .global __TMC_END__
> +__TMC_END__ IS @
> Index: ld-mmix/tm-ape.s
> ===================================================================
> RCS file: ld-mmix/tm-ape.s
> diff -N ld-mmix/tm-ape.s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/tm-ape.s 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,3 @@
> + .section .tm_clone_table,"a",@progbits
> + .global __TMC_END__
> +__TMC_END__ IS @
> Index: ld-mmix/tm-awne.s
> ===================================================================
> RCS file: ld-mmix/tm-awne.s
> diff -N ld-mmix/tm-awne.s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/tm-awne.s 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,3 @@
> + .section .tm_clone_table,"aw",@nobits
> + .global __TMC_END__
> +__TMC_END__ IS @
> Index: ld-mmix/tm-awpe.s
> ===================================================================
> RCS file: ld-mmix/tm-awpe.s
> diff -N ld-mmix/tm-awpe.s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/tm-awpe.s 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,3 @@
> + .section .tm_clone_table,"aw",@progbits
> + .global __TMC_END__
> +__TMC_END__ IS @
> Index: ld-mmix/tm-d-ap.s
> ===================================================================
> RCS file: ld-mmix/tm-d-ap.s
> diff -N ld-mmix/tm-d-ap.s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/tm-d-ap.s 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,3 @@
> + .section .tm_clone_table,"a",@progbits
> + TETRA 1234,5678
> + TETRA 9101112,13141516
> Index: ld-mmix/tm-d-awp.s
> ===================================================================
> RCS file: ld-mmix/tm-d-awp.s
> diff -N ld-mmix/tm-d-awp.s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/tm-d-awp.s 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,3 @@
> + .section .tm_clone_table,"aw",@progbits
> + TETRA 1234,5678
> + TETRA 9101112,13141516
> Index: ld-mmix/tm-d.s
> ===================================================================
> RCS file: ld-mmix/tm-d.s
> diff -N ld-mmix/tm-d.s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/tm-d.s 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,3 @@
> + .section .tm_clone_table
> + TETRA 1234,5678
> + TETRA 9101112,13141516
> Index: ld-mmix/tm-e.s
> ===================================================================
> RCS file: ld-mmix/tm-e.s
> diff -N ld-mmix/tm-e.s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/tm-e.s 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,3 @@
> + .section .tm_clone_table
> + .global __TMC_END__
> +__TMC_END__ IS @
> Index: ld-mmix/tm-orph1.s
> ===================================================================
> RCS file: ld-mmix/tm-orph1.s
> diff -N ld-mmix/tm-orph1.s
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ ld-mmix/tm-orph1.s 9 Sep 2012 15:35:31 -0000
> @@ -0,0 +1,3 @@
> + .text
> +f:
> + LDA $252,__TMC_END__+7
>
> brgds, H-P