public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* PE ld -r script fixes
@ 2017-02-20 10:36 Alan Modra
  2017-02-20 13:08 ` Nick Clifton
  0 siblings, 1 reply; 2+ messages in thread
From: Alan Modra @ 2017-02-20 10:36 UTC (permalink / raw)
  To: Nick Clifton; +Cc: binutils

Hi Nick,
I think this patch is good, but I don't play regularly with COFF/PE so
I'd like your OK before applying.

diff --git a/ld/ChangeLog b/ld/ChangeLog
index d02d009..aa1c84c 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,5 +1,11 @@
 2017-02-17  Alan Modra  <amodra@gmail.com>
 
+	PR 15041
+	* scripttempl/pe.sc: Don't combine sections for ld -r.
+	* scripttempl/pep.sc: Likewise.
+
+2017-02-17  Alan Modra  <amodra@gmail.com>
+
 	PR 20199
 	* emulparams/elf32m32c.sh: Define STACK_ADDR and STACK_SENTINEL
 	rather than using OTHER_SECTIONS.
diff --git a/ld/scripttempl/pe.sc b/ld/scripttempl/pe.sc
index ef9e76c..9981848 100644
--- a/ld/scripttempl/pe.sc
+++ b/ld/scripttempl/pe.sc
@@ -60,7 +60,12 @@ else
   R_IDATA234=
   R_IDATA5=
   R_IDATA67=
-  R_CRT=
+  R_CRT_XC=
+  R_CRT_XI=
+  R_CRT_XL=
+  R_CRT_XP=
+  R_CRT_XT=
+  R_TLS='*(.tls)'
   R_RSRC='*(.rsrc)'
 fi
 
@@ -90,8 +95,8 @@ SECTIONS
     ${R_TEXT}
     ${RELOCATING+ *(.text.*)}
     ${RELOCATING+ *(.gnu.linkonce.t.*)}
-    *(.glue_7t)
-    *(.glue_7)
+    ${RELOCATING+*(.glue_7t)}
+    ${RELOCATING+*(.glue_7)}
     ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
 			LONG (-1);*(.ctors); *(.ctor); *(SORT(.ctors.*));  LONG (0); }
     ${CONSTRUCTING+ ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
@@ -114,7 +119,7 @@ SECTIONS
   {
     ${RELOCATING+__data_start__ = . ;}
     *(.data)
-    *(.data2)
+    ${RELOCATING+*(.data2)}
     ${R_DATA}
     KEEP(*(.jcr))
     ${RELOCATING+__data_end__ = . ;}
@@ -125,7 +130,7 @@ SECTIONS
   {
     ${R_RDATA}
     ${RELOCATING+__rt_psrelocs_start = .;}
-    KEEP(*(.rdata_runtime_pseudo_reloc))
+    ${RELOCATING+KEEP(*(.rdata_runtime_pseudo_reloc))}
     ${RELOCATING+__rt_psrelocs_end = .;}
   }
   ${RELOCATING+__rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;}
@@ -136,12 +141,12 @@ SECTIONS
 
   .eh_frame ${RELOCATING+BLOCK(__section_alignment__)} :
   {
-    KEEP(*(.eh_frame*))
+    KEEP(*(.eh_frame${RELOCATING+*}))
   }
 
   .pdata ${RELOCATING+BLOCK(__section_alignment__)} :
   {
-    KEEP(*(.pdata*))
+    KEEP(*(.pdata${RELOCATING+*}))
   }
 
   .bss ${RELOCATING+BLOCK(__section_alignment__)} :
diff --git a/ld/scripttempl/pep.sc b/ld/scripttempl/pep.sc
index a972942..16dc57f 100644
--- a/ld/scripttempl/pep.sc
+++ b/ld/scripttempl/pep.sc
@@ -60,7 +60,12 @@ else
   R_IDATA234=
   R_IDATA5=
   R_IDATA67=
-  R_CRT=
+  R_CRT_XC=
+  R_CRT_XI=
+  R_CRT_XL=
+  R_CRT_XP=
+  R_CRT_XT=
+  R_TLS='*(.tls)'
   R_RSRC='*(.rsrc)'
 fi
 
@@ -90,8 +95,8 @@ SECTIONS
     ${R_TEXT}
     ${RELOCATING+ *(.text.*)}
     ${RELOCATING+ *(.gnu.linkonce.t.*)}
-    *(.glue_7t)
-    *(.glue_7)
+    ${RELOCATING+*(.glue_7t)}
+    ${RELOCATING+*(.glue_7)}
     ${CONSTRUCTING+. = ALIGN(8);}
     ${CONSTRUCTING+ ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
 			LONG (-1); LONG (-1);
@@ -122,7 +127,7 @@ SECTIONS
   {
     ${RELOCATING+__data_start__ = . ;}
     *(.data)
-    *(.data2)
+    ${RELOCATING+*(.data2)}
     ${R_DATA}
     KEEP(*(.jcr))
     ${RELOCATING+__data_end__ = . ;}
@@ -133,7 +138,7 @@ SECTIONS
   {
     ${R_RDATA}
     ${RELOCATING+__rt_psrelocs_start = .;}
-    KEEP(*(.rdata_runtime_pseudo_reloc))
+    ${RELOCATING+KEEP(*(.rdata_runtime_pseudo_reloc))}
     ${RELOCATING+__rt_psrelocs_end = .;}
   }
   ${RELOCATING+__rt_psrelocs_size = __rt_psrelocs_end - __rt_psrelocs_start;}
@@ -144,17 +149,17 @@ SECTIONS
 
   .eh_frame ${RELOCATING+BLOCK(__section_alignment__)} :
   {
-    KEEP (*(.eh_frame*))
+    KEEP (*(.eh_frame${RELOCATING+*}))
   }
 
   .pdata ${RELOCATING+BLOCK(__section_alignment__)} :
   {
-    KEEP(*(.pdata*))
+    KEEP(*(.pdata${RELOCATING+*}))
   }
 
   .xdata ${RELOCATING+BLOCK(__section_alignment__)} :
   {
-    KEEP(*(.xdata*))
+    KEEP(*(.xdata${RELOCATING+*}))
   }
 
   .bss ${RELOCATING+BLOCK(__section_alignment__)} :

-- 
Alan Modra
Australia Development Lab, IBM

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: PE ld -r script fixes
  2017-02-20 10:36 PE ld -r script fixes Alan Modra
@ 2017-02-20 13:08 ` Nick Clifton
  0 siblings, 0 replies; 2+ messages in thread
From: Nick Clifton @ 2017-02-20 13:08 UTC (permalink / raw)
  To: Alan Modra; +Cc: binutils

Hi Alan,

> I think this patch is good, but I don't play regularly with COFF/PE so
> I'd like your OK before applying.

Thanks for taking a look.

The patch looks good to me too, so please go ahead and apply it.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-02-20 13:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-20 10:36 PE ld -r script fixes Alan Modra
2017-02-20 13:08 ` Nick Clifton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).