[binutils-gdb] PE LD: Merge .CRT .ctors and .dtors into .rdata

Nick Clifton nickc@sourceware.org
Wed Nov 27 14:29:17 GMT 2024


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=db00f6c3aceabbf03acdb69e74b59b2d2b043cd7

commit db00f6c3aceabbf03acdb69e74b59b2d2b043cd7
Author: Liu Hao <lh_mouse@126.com>
Date:   Wed Nov 27 14:27:53 2024 +0000

    PE LD: Merge .CRT .ctors and .dtors into .rdata
    
    PR 32264

Diff:
---
 bfd/peXXigen.c                            |   3 +-
 ld/scripttempl/pe.sc                      | 112 ++++++++++++++++--------------
 ld/scripttempl/pep.sc                     | 111 +++++++++++++++--------------
 ld/testsuite/ld-pe/aarch64.d              |  35 ++++------
 ld/testsuite/ld-pe/longsecn-1.d           |   7 +-
 ld/testsuite/ld-pe/longsecn-2.d           |   7 +-
 ld/testsuite/ld-pe/longsecn.d             |   7 +-
 ld/testsuite/ld-pe/orphan.d               |   9 +--
 ld/testsuite/ld-pe/orphan_nu.d            |   9 +--
 ld/testsuite/ld-pe/pdb2-section-contrib.d |   2 +-
 ld/testsuite/ld-pe/pe-aarch64.d           |  13 +---
 ld/testsuite/ld-pe/secidx.d               |   6 +-
 ld/testsuite/ld-pe/secidx_64.d            |   4 +-
 ld/testsuite/ld-pe/secidx_aarch64.d       |   4 +-
 ld/testsuite/ld-pe/secrel.d               |   2 +-
 ld/testsuite/ld-pe/secrel_64.d            |   4 +-
 ld/testsuite/ld-pe/tlssec64.d             |   2 +-
 17 files changed, 172 insertions(+), 165 deletions(-)

diff --git a/bfd/peXXigen.c b/bfd/peXXigen.c
index c09d16ed0c0..2f81a59e8cf 100644
--- a/bfd/peXXigen.c
+++ b/bfd/peXXigen.c
@@ -995,11 +995,12 @@ _bfd_XXi_swap_scnhdr_out (bfd * abfd, void * in, void * out)
 
     pe_required_section_flags known_sections [] =
       {
+	{ ".CRT",   IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
 	{ ".arch",  IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE | IMAGE_SCN_ALIGN_8BYTES },
 	{ ".bss",   IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_UNINITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
 	{ ".data",  IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
 	{ ".edata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
-	{ ".idata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_WRITE },
+	{ ".idata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
 	{ ".pdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
 	{ ".rdata", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA },
 	{ ".reloc", IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA | IMAGE_SCN_MEM_DISCARDABLE },
diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc
index 70f5194b02f..75730a5b2c7 100644
--- a/ld/scripttempl/pe.sc
+++ b/ld/scripttempl/pe.sc
@@ -44,6 +44,7 @@ if test "${RELOCATING}"; then
   R_CRT_XL='KEEP (*(SORT(.CRT$XL*)))  /* TLS callbacks */'
   R_CRT_XP='KEEP (*(SORT(.CRT$XP*)))  /* Pre-termination */'
   R_CRT_XT='KEEP (*(SORT(.CRT$XT*)))  /* Termination */'
+  R_CRT_XD='KEEP (*(SORT(.CRT$XD*)))  /* Dynamic TLS Initializer */'
   R_TLS='
     KEEP (*(.tls$AAA))
     KEEP (*(.tls))
@@ -65,6 +66,7 @@ else
   R_CRT_XL=
   R_CRT_XP=
   R_CRT_XT=
+  R_CRT_XD=
   R_TLS='*(.tls)'
   R_RSRC='*(.rsrc)'
 fi
@@ -97,6 +99,40 @@ SECTIONS
     ${RELOCATING+ *(.gnu.linkonce.t.*)}
     ${RELOCATING+*(.glue_7t)}
     ${RELOCATING+*(.glue_7)}
+    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
+    ${RELOCATING+/* ??? Why is .gcc_exc here?  */}
+    ${RELOCATING+ *(.gcc_exc)}
+    ${RELOCATING+PROVIDE (etext = .);}
+    ${RELOCATING+PROVIDE (_etext = .);}
+    ${RELOCATING+ KEEP (*(.gcc_except_table))}
+  }
+
+  /* The Cygwin32 library uses a section to avoid copying certain data
+     on fork.  This used to be named ".data$nocopy".  The linker used
+     to include this between __data_start__ and __data_end__, but that
+     breaks building the cygwin32 dll.  Instead, we name the section
+     ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
+
+  .data ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    ${RELOCATING+__data_start__ = . ;}
+    *(.data)
+    ${RELOCATING+*(.data2)}
+    ${R_DATA}
+    KEEP(*(.jcr))
+    ${RELOCATING+__data_end__ = . ;}
+    ${RELOCATING+*(.data_cygwin_nocopy)}
+  }
+
+  .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    ${R_RDATA}
+    . = ALIGN(4);
+    ${RELOCATING+__rt_psrelocs_start = .;}
+    ${RELOCATING+KEEP(*(.rdata_runtime_pseudo_reloc))}
+    ${RELOCATING+__rt_psrelocs_end = .;}
+
+    /* .ctors & .dtors */
     ${CONSTRUCTING+
        /* Note: we always define __CTOR_LIST__ and ___CTOR_LIST__ here,
           we do not PROVIDE them.  This is because the ctors.o startup
@@ -136,44 +172,32 @@ SECTIONS
        KEEP(*(SORT_BY_NAME(.dtors.*)));
        LONG (0);
      }
-    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
-    ${RELOCATING+/* ??? Why is .gcc_exc here?  */}
-    ${RELOCATING+ *(.gcc_exc)}
-    ${RELOCATING+PROVIDE (etext = .);}
-    ${RELOCATING+PROVIDE (_etext = .);}
-    ${RELOCATING+ KEEP (*(.gcc_except_table))}
-  }
-
-  /* The Cygwin32 library uses a section to avoid copying certain data
-     on fork.  This used to be named ".data$nocopy".  The linker used
-     to include this between __data_start__ and __data_end__, but that
-     breaks building the cygwin32 dll.  Instead, we name the section
-     ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
 
-  .data ${RELOCATING+BLOCK(__section_alignment__)} :
-  {
-    ${RELOCATING+__data_start__ = . ;}
-    *(.data)
-    ${RELOCATING+*(.data2)}
-    ${R_DATA}
-    KEEP(*(.jcr))
-    ${RELOCATING+__data_end__ = . ;}
-    ${RELOCATING+*(.data_cygwin_nocopy)}
+    /* .CRT */
+    ${RELOCATING+___crt_xc_start__ = . ;}
+    ${R_CRT_XC}
+    ${RELOCATING+___crt_xc_end__ = . ;}
+    ${RELOCATING+___crt_xi_start__ = . ;}
+    ${R_CRT_XI}
+    ${RELOCATING+___crt_xi_end__ = . ;}
+    ${RELOCATING+___crt_xl_start__ = . ;}
+    ${R_CRT_XL}
+    /* ___crt_xl_end__ is defined in the TLS Directory support code */
+    ${RELOCATING+___crt_xp_start__ = . ;}
+    ${R_CRT_XP}
+    ${RELOCATING+___crt_xp_end__ = . ;}
+    ${RELOCATING+___crt_xt_start__ = . ;}
+    ${R_CRT_XT}
+    ${RELOCATING+___crt_xt_end__ = . ;}
+    ${RELOCATING+___crt_xd_start__ = . ;}
+    ${R_CRT_XD}
+    ${RELOCATING+___crt_xd_end__ = . ;}
   }
 
-  .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
-  {
-    ${R_RDATA}
-    . = ALIGN(4);
-    ${RELOCATING+__rt_psrelocs_start = .;}
-    ${RELOCATING+KEEP(*(.rdata_runtime_pseudo_reloc))}
-    ${RELOCATING+__rt_psrelocs_end = .;}
-  }
-  ${RELOCATING+__rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;}
-  ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
-  ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
-  ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
-  ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
+  ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = __rt_psrelocs_end;}
+  ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = __rt_psrelocs_end;}
+  ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = __rt_psrelocs_start;}
+  ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = __rt_psrelocs_start;}
 
   .eh_frame ${RELOCATING+BLOCK(__section_alignment__)} :
   {
@@ -218,24 +242,6 @@ SECTIONS
     ${RELOCATING+__IAT_end__ = .;}
     ${R_IDATA67}
   }
-  .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
-  {
-    ${RELOCATING+___crt_xc_start__ = . ;}
-    ${R_CRT_XC}
-    ${RELOCATING+___crt_xc_end__ = . ;}
-    ${RELOCATING+___crt_xi_start__ = . ;}
-    ${R_CRT_XI}
-    ${RELOCATING+___crt_xi_end__ = . ;}
-    ${RELOCATING+___crt_xl_start__ = . ;}
-    ${R_CRT_XL}
-    /* ___crt_xl_end__ is defined in the TLS Directory support code */
-    ${RELOCATING+___crt_xp_start__ = . ;}
-    ${R_CRT_XP}
-    ${RELOCATING+___crt_xp_end__ = . ;}
-    ${RELOCATING+___crt_xt_start__ = . ;}
-    ${R_CRT_XT}
-    ${RELOCATING+___crt_xt_end__ = . ;}
-  }
 
   /* Windows TLS expects .tls\$AAA to be at the start and .tls\$ZZZ to be
      at the end of section.  This is important because _tls_start MUST
diff --git a/ld/scripttempl/pep.sc b/ld/scripttempl/pep.sc
index 63039f11574..b9c11cd74ed 100644
--- a/ld/scripttempl/pep.sc
+++ b/ld/scripttempl/pep.sc
@@ -45,6 +45,7 @@ if test "${RELOCATING}"; then
   R_CRT_XL='KEEP (*(SORT(.CRT$XL*)))  /* TLS callbacks */'
   R_CRT_XP='KEEP (*(SORT(.CRT$XP*)))  /* Pre-termination */'
   R_CRT_XT='KEEP (*(SORT(.CRT$XT*)))  /* Termination */'
+  R_CRT_XD='KEEP (*(SORT(.CRT$XD*)))  /* Dynamic TLS Initializer */'
   R_TLS='
     KEEP (*(.tls$AAA))
     KEEP (*(.tls))
@@ -66,6 +67,7 @@ else
   R_CRT_XL=
   R_CRT_XP=
   R_CRT_XT=
+  R_CRT_XD=
   R_TLS='*(.tls)'
   R_RSRC='*(.rsrc)'
 fi
@@ -99,6 +101,40 @@ SECTIONS
     ${RELOCATING+*(.glue_7t)}
     ${RELOCATING+*(.glue_7)}
     ${CONSTRUCTING+. = ALIGN(8);}
+    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
+    ${RELOCATING+/* ??? Why is .gcc_exc here?  */}
+    ${RELOCATING+ *(.gcc_exc)}
+    ${RELOCATING+PROVIDE (etext = .);}
+    ${RELOCATING+ KEEP (*(.gcc_except_table))}
+  }
+
+  /* The Cygwin32 library uses a section to avoid copying certain data
+     on fork.  This used to be named ".data$nocopy".  The linker used
+     to include this between __data_start__ and __data_end__, but that
+     breaks building the cygwin32 dll.  Instead, we name the section
+     ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
+
+  .data ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    ${RELOCATING+__data_start__ = . ;}
+    *(.data)
+    ${RELOCATING+*(.data2)}
+    ${R_DATA}
+    KEEP(*(.jcr))
+    ${RELOCATING+__data_end__ = . ;}
+    ${RELOCATING+*(.data_cygwin_nocopy)}
+  }
+
+  .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
+  {
+    ${R_RDATA}
+    . = ALIGN(4);
+    ${RELOCATING+__rt_psrelocs_start = .;}
+    ${RELOCATING+KEEP(*(.rdata_runtime_pseudo_reloc))}
+    ${RELOCATING+__rt_psrelocs_end = .;}
+
+    /* .ctors & .dtors */
+    ${CONSTRUCTING+. = ALIGN(8);}
     ${CONSTRUCTING+
        /* Note: we always define __CTOR_LIST__ and ___CTOR_LIST__ here,
           we do not PROVIDE them.  This is because the ctors.o startup
@@ -138,43 +174,32 @@ SECTIONS
        KEEP (*(SORT_BY_NAME(.dtors.*)));
        LONG (0); LONG (0);
      }
-    ${RELOCATING+KEEP (*(SORT_NONE(.fini)))}
-    ${RELOCATING+/* ??? Why is .gcc_exc here?  */}
-    ${RELOCATING+ *(.gcc_exc)}
-    ${RELOCATING+PROVIDE (etext = .);}
-    ${RELOCATING+ KEEP (*(.gcc_except_table))}
-  }
 
-  /* The Cygwin32 library uses a section to avoid copying certain data
-     on fork.  This used to be named ".data$nocopy".  The linker used
-     to include this between __data_start__ and __data_end__, but that
-     breaks building the cygwin32 dll.  Instead, we name the section
-     ".data_cygwin_nocopy" and explicitly include it after __data_end__. */
-
-  .data ${RELOCATING+BLOCK(__section_alignment__)} :
-  {
-    ${RELOCATING+__data_start__ = . ;}
-    *(.data)
-    ${RELOCATING+*(.data2)}
-    ${R_DATA}
-    KEEP(*(.jcr))
-    ${RELOCATING+__data_end__ = . ;}
-    ${RELOCATING+*(.data_cygwin_nocopy)}
+    /* .CRT */
+    ${RELOCATING+___crt_xc_start__ = . ;}
+    ${R_CRT_XC}
+    ${RELOCATING+___crt_xc_end__ = . ;}
+    ${RELOCATING+___crt_xi_start__ = . ;}
+    ${R_CRT_XI}
+    ${RELOCATING+___crt_xi_end__ = . ;}
+    ${RELOCATING+___crt_xl_start__ = . ;}
+    ${R_CRT_XL}
+    /* ___crt_xl_end__ is defined in the TLS Directory support code */
+    ${RELOCATING+___crt_xp_start__ = . ;}
+    ${R_CRT_XP}
+    ${RELOCATING+___crt_xp_end__ = . ;}
+    ${RELOCATING+___crt_xt_start__ = . ;}
+    ${R_CRT_XT}
+    ${RELOCATING+___crt_xt_end__ = . ;}
+    ${RELOCATING+___crt_xd_start__ = . ;}
+    ${R_CRT_XD}
+    ${RELOCATING+___crt_xd_end__ = . ;}
   }
 
-  .rdata ${RELOCATING+BLOCK(__section_alignment__)} :
-  {
-    ${R_RDATA}
-    . = ALIGN(4);
-    ${RELOCATING+__rt_psrelocs_start = .;}
-    ${RELOCATING+KEEP(*(.rdata_runtime_pseudo_reloc))}
-    ${RELOCATING+__rt_psrelocs_end = .;}
-  }
-  ${RELOCATING+__rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;}
-  ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
-  ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = .;}
-  ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
-  ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = . - __rt_psrelocs_size;}
+  ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST_END__ = __rt_psrelocs_end;}
+  ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST_END__ = __rt_psrelocs_end;}
+  ${RELOCATING+___RUNTIME_PSEUDO_RELOC_LIST__ = __rt_psrelocs_start;}
+  ${RELOCATING+__RUNTIME_PSEUDO_RELOC_LIST__ = __rt_psrelocs_start;}
 
   .eh_frame ${RELOCATING+BLOCK(__section_alignment__)} :
   {
@@ -224,24 +249,6 @@ SECTIONS
     ${RELOCATING+__IAT_end__ = .;}
     ${R_IDATA67}
   }
-  .CRT ${RELOCATING+BLOCK(__section_alignment__)} :
-  {
-    ${RELOCATING+___crt_xc_start__ = . ;}
-    ${R_CRT_XC}
-    ${RELOCATING+___crt_xc_end__ = . ;}
-    ${RELOCATING+___crt_xi_start__ = . ;}
-    ${R_CRT_XI}
-    ${RELOCATING+___crt_xi_end__ = . ;}
-    ${RELOCATING+___crt_xl_start__ = . ;}
-    ${R_CRT_XL}
-    /* ___crt_xl_end__ is defined in the TLS Directory support code */
-    ${RELOCATING+___crt_xp_start__ = . ;}
-    ${R_CRT_XP}
-    ${RELOCATING+___crt_xp_end__ = . ;}
-    ${RELOCATING+___crt_xt_start__ = . ;}
-    ${R_CRT_XT}
-    ${RELOCATING+___crt_xt_end__ = . ;}
-  }
 
   /* Windows TLS expects .tls\$AAA to be at the start and .tls\$ZZZ to be
      at the end of the .tls section.  This is important because _tls_start MUST
diff --git a/ld/testsuite/ld-pe/aarch64.d b/ld/testsuite/ld-pe/aarch64.d
index eea52e10fe2..074c09916f7 100644
--- a/ld/testsuite/ld-pe/aarch64.d
+++ b/ld/testsuite/ld-pe/aarch64.d
@@ -4,7 +4,7 @@ tmpdir/aarch64.x:     file format pei-aarch64-little
 
 Disassembly of section .text:
 
-0000000000002000 <__rt_psrelocs_end>:
+0000000000002000 <.text>:
 	...
 
 0000000000002010 <foo>:
@@ -58,41 +58,41 @@ Disassembly of section .text:
     20cc:	0000121f 	udf	#4639
     20d0:	17ffffd0 	b	2010 <foo>
     20d4:	17ffffd0 	b	2014 <foo\+0x4>
-    20d8:	17ffffcd 	b	200c <__rt_psrelocs_end\+0xc>
+    20d8:	17ffffcd 	b	200c <.text\+0xc>
     20dc:	14000051 	b	2220 <bar>
     20e0:	14000051 	b	2224 <bar\+0x4>
     20e4:	1400004e 	b	221c <.text>
     20e8:	97ffffca 	bl	2010 <foo>
     20ec:	97ffffca 	bl	2014 <foo\+0x4>
-    20f0:	97ffffc7 	bl	200c <__rt_psrelocs_end\+0xc>
+    20f0:	97ffffc7 	bl	200c <.text\+0xc>
     20f4:	9400004b 	bl	2220 <bar>
     20f8:	9400004b 	bl	2224 <bar\+0x4>
     20fc:	94000048 	bl	221c <.text>
     2100:	97ffffbf 	bl	1ffc <__ImageBase\+0xffc>
     2104:	b4fff860 	cbz	x0, 2010 <foo>
     2108:	b4fff860 	cbz	x0, 2014 <foo\+0x4>
-    210c:	b4fff800 	cbz	x0, 200c <__rt_psrelocs_end\+0xc>
+    210c:	b4fff800 	cbz	x0, 200c <.text\+0xc>
     2110:	b4000880 	cbz	x0, 2220 <bar>
     2114:	b4000880 	cbz	x0, 2224 <bar\+0x4>
     2118:	b4000820 	cbz	x0, 221c <.text>
     211c:	b4fff700 	cbz	x0, 1ffc <__ImageBase\+0xffc>
     2120:	3607f780 	tbz	w0, #0, 2010 <foo>
     2124:	3607f780 	tbz	w0, #0, 2014 <foo\+0x4>
-    2128:	3607f720 	tbz	w0, #0, 200c <__rt_psrelocs_end\+0xc>
+    2128:	3607f720 	tbz	w0, #0, 200c <.text\+0xc>
     212c:	360007a0 	tbz	w0, #0, 2220 <bar>
     2130:	360007a0 	tbz	w0, #0, 2224 <bar\+0x4>
     2134:	36000740 	tbz	w0, #0, 221c <.text>
     2138:	3607f620 	tbz	w0, #0, 1ffc <__ImageBase\+0xffc>
-    213c:	90000000 	adrp	x0, 2000 <__rt_psrelocs_end>
-    2140:	90000000 	adrp	x0, 2000 <__rt_psrelocs_end>
-    2144:	90000000 	adrp	x0, 2000 <__rt_psrelocs_end>
-    2148:	90000000 	adrp	x0, 2000 <__rt_psrelocs_end>
-    214c:	90000000 	adrp	x0, 2000 <__rt_psrelocs_end>
-    2150:	90000000 	adrp	x0, 2000 <__rt_psrelocs_end>
+    213c:	90000000 	adrp	x0, 2000 <.text>
+    2140:	90000000 	adrp	x0, 2000 <.text>
+    2144:	90000000 	adrp	x0, 2000 <.text>
+    2148:	90000000 	adrp	x0, 2000 <.text>
+    214c:	90000000 	adrp	x0, 2000 <.text>
+    2150:	90000000 	adrp	x0, 2000 <.text>
     2154:	f0ffffe0 	adrp	x0, 1000 <__ImageBase>
     2158:	10fff5c0 	adr	x0, 2010 <foo>
     215c:	30fff5a0 	adr	x0, 2011 <foo\+0x1>
-    2160:	70fff560 	adr	x0, 200f <__rt_psrelocs_end\+0xf>
+    2160:	70fff560 	adr	x0, 200f <.text\+0xf>
     2164:	100005e0 	adr	x0, 2220 <bar>
     2168:	300005c0 	adr	x0, 2221 <bar\+0x1>
     216c:	70000580 	adr	x0, 221f <.text\+0x3>
@@ -146,13 +146,4 @@ Disassembly of section .text:
 0000000000002220 <bar>:
     2220:	9abcdef0 	.inst	0x9abcdef0 ; undefined
     2224:	12345678 	and	w24, w19, #0xfffff003
-
-0000000000002228 <__CTOR_LIST__>:
-    2228:	ffffffff 	.inst	0xffffffff ; undefined
-    222c:	ffffffff 	.inst	0xffffffff ; undefined
-	...
-
-0000000000002238 <__DTOR_LIST__>:
-    2238:	ffffffff 	.inst	0xffffffff ; undefined
-    223c:	ffffffff 	.inst	0xffffffff ; undefined
-	...
+#pass
diff --git a/ld/testsuite/ld-pe/longsecn-1.d b/ld/testsuite/ld-pe/longsecn-1.d
index 81a44a7f227..16e736ea7a3 100644
--- a/ld/testsuite/ld-pe/longsecn-1.d
+++ b/ld/testsuite/ld-pe/longsecn-1.d
@@ -2,6 +2,7 @@
 #ld: --disable-long-section-names
 #objdump: -h
 #source: longsecn.s
+#xfail: mcore-*-*
 
 .*:     file format .*
 
@@ -17,6 +18,8 @@ Idx Name          Size      VMA +LMA +File off  Algn
                   CONTENTS, ALLOC, LOAD, DATA
   4 \.rodata\.      [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
                   CONTENTS, ALLOC, LOAD, DATA
-  5 \.idata        [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
-                  CONTENTS, ALLOC, LOAD, DATA
+  5 \.rdata        [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
+                  CONTENTS, ALLOC, LOAD, READONLY, DATA
+  6 \.idata        [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
+                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 #...
diff --git a/ld/testsuite/ld-pe/longsecn-2.d b/ld/testsuite/ld-pe/longsecn-2.d
index 64d16277a4f..494e53240af 100644
--- a/ld/testsuite/ld-pe/longsecn-2.d
+++ b/ld/testsuite/ld-pe/longsecn-2.d
@@ -2,6 +2,7 @@
 #ld: --enable-long-section-names
 #objdump: -h
 #source: longsecn.s
+#xfail: mcore-*-*
 
 .*:     file format .*
 
@@ -17,6 +18,8 @@ Idx Name          Size      VMA +LMA +File off  Algn
                   CONTENTS, ALLOC, LOAD, DATA
   4 \.rodata\.very.long\.section [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
                   CONTENTS, ALLOC, LOAD, DATA
-  5 \.idata        [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
-                  CONTENTS, ALLOC, LOAD, DATA
+  5 \.rdata        [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
+                  CONTENTS, ALLOC, LOAD, READONLY, DATA
+  6 \.idata        [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
+                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 #...
diff --git a/ld/testsuite/ld-pe/longsecn.d b/ld/testsuite/ld-pe/longsecn.d
index e77f6eeaf19..1d18c80eb9a 100644
--- a/ld/testsuite/ld-pe/longsecn.d
+++ b/ld/testsuite/ld-pe/longsecn.d
@@ -2,6 +2,7 @@
 #ld:
 #objdump: -h
 #source: longsecn.s
+#xfail: mcore-*-*
 
 .*:     file format .*
 
@@ -17,6 +18,8 @@ Idx Name          Size      VMA +LMA +File off  Algn
                   CONTENTS, ALLOC, LOAD, DATA
   4 \.rodata\.      [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
                   CONTENTS, ALLOC, LOAD, DATA
-  5 \.idata        [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
-                  CONTENTS, ALLOC, LOAD, DATA
+  5 \.rdata        [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
+                  CONTENTS, ALLOC, LOAD, READONLY, DATA
+  6 \.idata        [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  [0-9a-fA-F]+  2\*\*[0-9]
+                  CONTENTS, ALLOC, LOAD, READONLY, DATA
 #...
diff --git a/ld/testsuite/ld-pe/orphan.d b/ld/testsuite/ld-pe/orphan.d
index 4047a6ae0f9..6a2d9f0d287 100644
--- a/ld/testsuite/ld-pe/orphan.d
+++ b/ld/testsuite/ld-pe/orphan.d
@@ -4,10 +4,11 @@
 #source: orphane.s
 #ld: --file-align 1 --section-align 1
 #objdump: -h --wide
+#xfail: mcore-*-*
 
 #...
- +0 +\.text .*
- +1 +\.foo +0+20 .*
- +2 +\.foo +0+20 .*
- +3 +\.idata .*
+ +. +\.foo .*
+ +. +\.rdata .*
+ +. +\.foo +0+20 .*
+ +. +\.idata .*
 #pass
diff --git a/ld/testsuite/ld-pe/orphan_nu.d b/ld/testsuite/ld-pe/orphan_nu.d
index 5e88da71e05..07b8b51415a 100644
--- a/ld/testsuite/ld-pe/orphan_nu.d
+++ b/ld/testsuite/ld-pe/orphan_nu.d
@@ -4,10 +4,11 @@
 #source: orphane.s
 #ld: --file-align 1 --section-align 1  --no-leading-underscore
 #objdump: -h --wide
+#xfail: mcore-*-*
 
 #...
- +0 +\.text .*
- +1 +\.foo +0+20 .*
- +2 +\.foo +0+20 .*
- +3 +\.idata .*
+ +. +\.foo +0+20 .*
+ +. +\.rdata .*
+ +. +\.foo +0+20 .*
+ +. +\.idata .*
 #pass
diff --git a/ld/testsuite/ld-pe/pdb2-section-contrib.d b/ld/testsuite/ld-pe/pdb2-section-contrib.d
index 214eb11d3fb..73592a30113 100644
--- a/ld/testsuite/ld-pe/pdb2-section-contrib.d
+++ b/ld/testsuite/ld-pe/pdb2-section-contrib.d
@@ -5,6 +5,6 @@ Contents of section .data:
  0000 2dba2ef1 01000000 00000000 10000000  -...............
  0010 20000060 00000000 00000000 00000000   ..`............
  0020 01000000 10000000 10000000 20000060  ............ ..`
- 0030 01000000 00000000 00000000 02000000  ................
+ 0030 01000000 00000000 00000000 03000000  ................
  0040 00000000 3d000000 40000040 00000000  ....=...@..@....
  0050 00000000 00000000                    ........        
diff --git a/ld/testsuite/ld-pe/pe-aarch64.d b/ld/testsuite/ld-pe/pe-aarch64.d
index ab6370fb514..18b1c9beaca 100644
--- a/ld/testsuite/ld-pe/pe-aarch64.d
+++ b/ld/testsuite/ld-pe/pe-aarch64.d
@@ -6,20 +6,11 @@
 
 Disassembly of section .text:
 
-0000000140001000 <___crt_xc_end__>:
+0000000140001000 <___tls_end__>:
    140001000:	d2800281 	mov	x1, #0x14                  	// #20
    140001004:	14000001 	b	140001008 <foo>
 
 0000000140001008 <foo>:
    140001008:	d65f03c0 	ret
    14000100c:	00000000 	udf	#0
-
-0000000140001010 <__CTOR_LIST__>:
-   140001010:	ffffffff 	.inst	0xffffffff ; undefined
-   140001014:	ffffffff 	.inst	0xffffffff ; undefined
-	...
-
-0000000140001020 <__DTOR_LIST__>:
-   140001020:	ffffffff 	.inst	0xffffffff ; undefined
-   140001024:	ffffffff 	.inst	0xffffffff ; undefined
-	...
+#pass
diff --git a/ld/testsuite/ld-pe/secidx.d b/ld/testsuite/ld-pe/secidx.d
index 20ace36d1ed..184cc9f05ba 100644
--- a/ld/testsuite/ld-pe/secidx.d
+++ b/ld/testsuite/ld-pe/secidx.d
@@ -4,8 +4,7 @@ tmpdir/secidx\.x: +file format pei-.*
 Contents of section .text:
  .*1000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  >>>><<<<>>>>><<<
  .*1010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  >>>>>><<>>>>>>><
- .*1020 3c3c3c3c 3e3e3e3e 3e909090 ffffffff  <<<<>>>>>.......
- .*1030 00000000 ffffffff 00000000           ............    
+ .*1020 3c3c3c3c 3e3e3e3e 3e909090           <<<<>>>>>...    
 Contents of section .data:
  .*2000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  >>>><<<<>>>>><<<
  .*2010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  >>>>>><<>>>>>>><
@@ -20,7 +19,8 @@ Contents of section .rdata:
  .*3000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  >>>><<<<>>>>><<<
  .*3010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  >>>>>><<>>>>>>><
  .*3020 3e3e3e3e 00000000 00000000 00000000  >>>>............
- .*3030 3c3c3c3e 3e3e3e3e 3e000000           <<<>>>>>>...    
+ .*3030 3c3c3c3e 3e3e3e3e 3e000000 ffffffff  <<<>>>>>>.......
+ .*3040 00000000 ffffffff 00000000           ............    
 Contents of section .idata:
  .*4000 00000000 00000000 00000000 00000000  ................
  .*4010 00000000                             ....            
diff --git a/ld/testsuite/ld-pe/secidx_64.d b/ld/testsuite/ld-pe/secidx_64.d
index 63b4a589c70..0d5b971d198 100644
--- a/ld/testsuite/ld-pe/secidx_64.d
+++ b/ld/testsuite/ld-pe/secidx_64.d
@@ -5,8 +5,6 @@ Contents of section \.text:
  .*1000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  .*
  .*1010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  .*
  .*1020 3c3c3c3c 3e3e3e3e 3e909090 90909090  .*
- .*1030 ffffffff ffffffff 00000000 00000000  .*
- .*1040 ffffffff ffffffff 00000000 00000000  .*
 Contents of section \.data:
  .*2000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  .*
  .*2010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  .*
@@ -22,6 +20,8 @@ Contents of section \.rdata:
  .*3010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  .*
  .*3020 3e3e3e3e 00000000 00000000 00000000  .*
  .*3030 3c3c3c3e 3e3e3e3e 3e000000 00000000  .*
+ .*3040 ffffffff ffffffff 00000000 00000000  .*
+ .*3050 ffffffff ffffffff 00000000 00000000  .*
 Contents of section \.idata:
  .*4000 00000000 00000000 00000000 00000000  .*
  .*4010 00000000 00000000                    .*
diff --git a/ld/testsuite/ld-pe/secidx_aarch64.d b/ld/testsuite/ld-pe/secidx_aarch64.d
index e119d1cff6f..82089103d7d 100644
--- a/ld/testsuite/ld-pe/secidx_aarch64.d
+++ b/ld/testsuite/ld-pe/secidx_aarch64.d
@@ -5,8 +5,6 @@ Contents of section \.text:
  .*1000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  .*
  .*1010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  .*
  .*1020 3c3c3c3c 3e3e3e3e 3e000000 00000000  .*
- .*1030 ffffffff ffffffff 00000000 00000000  .*
- .*1040 ffffffff ffffffff 00000000 00000000  .*
 Contents of section \.data:
  .*2000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  .*
  .*2010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  .*
@@ -22,6 +20,8 @@ Contents of section \.rdata:
  .*3010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  .*
  .*3020 3e3e3e3e 00000000 00000000 00000000  .*
  .*3030 3c3c3c3e 3e3e3e3e 3e000000 .*
+ .*3040 ffffffff ffffffff 00000000 00000000  .*
+ .*3050 ffffffff ffffffff 00000000 00000000  .*
 Contents of section \.idata:
  .*4000 00000000 00000000 00000000 00000000  .*
  .*4010 00000000 00000000                    .*
diff --git a/ld/testsuite/ld-pe/secrel.d b/ld/testsuite/ld-pe/secrel.d
index 3f1bb4a510a..6e31cd55712 100644
--- a/ld/testsuite/ld-pe/secrel.d
+++ b/ld/testsuite/ld-pe/secrel.d
@@ -6,7 +6,6 @@ Contents of section \.text:
  .*1010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  >>>>>><<>>>>>>><
  .*1020 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  >>>><<<<>>>>><<<
  .*1030 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  >>>>>><<>>>>>>><
- .*1040 ........ ........ ........ ........  ................
 Contents of section \.data:
  .*2000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  >>>><<<<>>>>><<<
  .*2010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  >>>>>><<>>>>>>><
@@ -22,6 +21,7 @@ Contents of section \.rdata:
  .*3000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  >>>><<<<>>>>><<<
  .*3010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  >>>>>><<>>>>>>><
  .*3020 3e3e3e3e 00000000 00000000 00000000  >>>>............
+ .*3030 ........ ........ ........ ........  ................
 Contents of section \.idata:
  .*4000 00000000 00000000 00000000 00000000  ................
  .*4010 00000000                             ....            
diff --git a/ld/testsuite/ld-pe/secrel_64.d b/ld/testsuite/ld-pe/secrel_64.d
index 82284f9cf62..cd3bdda98f8 100644
--- a/ld/testsuite/ld-pe/secrel_64.d
+++ b/ld/testsuite/ld-pe/secrel_64.d
@@ -6,8 +6,6 @@ Contents of section \.text:
  .*1010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  .*
  .*1020 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  .*
  .*1030 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  .*
- .*1040 ffffffff ffffffff 00000000 00000000  .*
- .*1050 ffffffff ffffffff 00000000 00000000  .*
 Contents of section \.data:
  .*2000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  .*
  .*2010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  .*
@@ -23,6 +21,8 @@ Contents of section \.rdata:
  .*3000 3e3e3e3e 3c3c3c3c 3e3e3e3e 3e3c3c3c  .*
  .*3010 3e3e3e3e 3e3e3c3c 3e3e3e3e 3e3e3e3c  .*
  .*3020 3e3e3e3e 00000000 00000000 00000000  .*
+ .*3030 ffffffff ffffffff 00000000 00000000  .*
+ .*3040 ffffffff ffffffff 00000000 00000000  .*
 Contents of section \.idata:
  .*4000 00000000 00000000 00000000 00000000  .*
  .*4010 00000000 00000000                    .*
diff --git a/ld/testsuite/ld-pe/tlssec64.d b/ld/testsuite/ld-pe/tlssec64.d
index 692d9e4848a..a63a9e72b3b 100644
--- a/ld/testsuite/ld-pe/tlssec64.d
+++ b/ld/testsuite/ld-pe/tlssec64.d
@@ -1,3 +1,3 @@
 #...
-Entry 9 0000000000003000 00000028 Thread Storage Directory \[\.tls\]
+Entry 9 0000000000004000 00000028 Thread Storage Directory \[\.tls\]
 #...


More information about the Binutils-cvs mailing list