[3/4] ld: Include the text section order file in PE COFF linker scripts
Checks
Commit Message
Include the text section order file in PE COFF linker scripts and enable
--text-section-ordering-file tests for PE COFF targets.
* scripttempl/i386beos.sc: Include the text section order file.
* scripttempl/i386go32.sc: Likewise.
* scripttempl/mcorepe.sc: Likewise.
* scripttempl/pe.sc: Likewise.
* scripttempl/pep.sc: Likewise.
* testsuite/ld-scripts/text-order-1a.d: Remove target.
* testsuite/ld-scripts/text-order-1b.d: Likewise.
* testsuite/ld-scripts/text-order-1c.d: Likewise.
* testsuite/ld-scripts/text-order.exp: Only run for ELF and PE
COFF targets.
---
ld/scripttempl/i386beos.sc | 1 +
ld/scripttempl/i386go32.sc | 1 +
ld/scripttempl/mcorepe.sc | 1 +
ld/scripttempl/pe.sc | 1 +
ld/scripttempl/pep.sc | 1 +
ld/testsuite/ld-scripts/start.s | 2 ++
ld/testsuite/ld-scripts/text-order-1a.d | 1 -
ld/testsuite/ld-scripts/text-order-1b.d | 1 -
ld/testsuite/ld-scripts/text-order-1c.d | 1 -
ld/testsuite/ld-scripts/text-order.exp | 3 ++-
10 files changed, 9 insertions(+), 4 deletions(-)
@@ -60,6 +60,7 @@ SECTIONS
{
${RELOCATING+ __text_start__ = . ;}
${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
+ ${RELOCATING+INCLUDE config.text_section_ordering_file}
*(.text)
${R_TEXT}
*(.glue_7t)
@@ -34,6 +34,7 @@ ${RELOCATING+ENTRY (${ENTRY})}
SECTIONS
{
.text ${RELOCATING+ ${TARGET_PAGE_SIZE}+SIZEOF_HEADERS} : {
+ ${RELOCATING+INCLUDE config.text_section_ordering_file}
*(.text)
${RELOCATING+*(.text.*)}
${RELOCATING+*(.gnu.linkonce.t*)}
@@ -66,6 +66,7 @@ SECTIONS
.text ${RELOCATING+ __image_base__ + __section_alignment__ } :
{
${RELOCATING+ KEEP (*(SORT_NONE(.init)))}
+ ${RELOCATING+INCLUDE config.text_section_ordering_file}
*(.text)
${R_TEXT}
${RELOCATING+ *(.text.*)}
@@ -91,6 +91,7 @@ SECTIONS
.text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
{
${RELOCATING+KEEP (*(SORT_NONE(.init)))}
+ ${RELOCATING+INCLUDE config.text_section_ordering_file}
*(.text)
${R_TEXT}
${RELOCATING+ *(.text.*)}
@@ -92,6 +92,7 @@ SECTIONS
.text ${RELOCATING+ __image_base__ + ( __section_alignment__ < ${TARGET_PAGE_SIZE} ? . : __section_alignment__ )} :
{
${RELOCATING+KEEP (*(SORT_NONE(.init)))}
+ ${RELOCATING+INCLUDE config.text_section_ordering_file}
*(.text)
${R_TEXT}
${RELOCATING+ *(.text.*)}
@@ -5,6 +5,8 @@ start:
_start:
.global __start
__start:
+ .global _mainCRTStartup /* Used by PE targets. */
+_mainCRTStartup:
.global main /* Used by HPPA targets. */
main:
.globl _main /* Used by LynxOS targets. */
@@ -3,7 +3,6 @@
#source: start.s
#ld: --text-section-ordering-file text-order-1a.t
#nm: -n
-#target: [is_elf_format]
#...
[0-9a-f]+ T yyy
@@ -3,7 +3,6 @@
#source: start.s
#ld: --text-section-ordering-file text-order-1b.t
#nm: -n
-#target: [is_elf_format]
#...
[0-9a-f]+ T yyy
@@ -3,5 +3,4 @@
#source: start.s
#ld: --text-section-ordering-file text-order-1c.t
#nm: -n
-#target: [is_elf_format]
#error: .*: nested include 'text-order-1b.t' in the text section ordering file: 'text-order-1c.t'
@@ -18,7 +18,8 @@
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
# MA 02110-1301, USA.
-if { !([is_elf_format] && ![is_generic]) } {
+# ELF and PE COFF linker targets support input .text.* sections.
+if { !([is_elf_format] || [is_pecoff_format]) } {
return
}