[PATCH 0/4] ld: Add --text-section-ordering-file FILE
H.J. Lu
hjl.tools@gmail.com
Fri Jan 19 19:45:48 GMT 2024
Add --text-section-ordering-file FILE to specify the text section
ordering file. Inside the text section ordering file, when seeing an
input file name without section list and the file name starts with '.',
treat the filename as a section name and create a wild card as the file
name.
A text section ordering file which contains text section wildcards:
---
text_section_foo*
text_section_b?r
text_section_name
---
can be used to group input text sections together to:
1. Reduce gaps between text sections.
2. Put hot text sections close to each other.
Text sections in the text section ordering file are placed at the
beginning of the output text section and code text sections are moved
toward the end so that the first section in the text section ordering
file is aligned to the output section alignment.
--text-section-ordering-file must be placed before -T/--script option
so that the text section ordering file can always be included in linker
scripts. Nested INCLUDE in the text section order file is disallowed.
--text-section-ordering-file FILE is supported only in ELF and PE COFF
linkers which support input .text.* sections.
NB: Gold has the command-line option, --section-ordering-file FILE, to
layout sections in the order specified. --text-section-ordering-file
supports the same section ordering file format, but it applies only to
text sections.
H.J. Lu (4):
ld: Add --text-section-ordering-file FILE
ld: Include the text section order file in all ELF linker scripts
ld: Include the text section order file in PE COFF linker scripts
ld: Document --text-section-ordering-file FILE
ld/NEWS | 3 +
ld/ld.h | 3 +
ld/ld.texi | 11 ++++
ld/ldfile.c | 74 +++++++++++++++++++++++--
ld/ldlang.c | 39 +++++++++++--
ld/ldlex.h | 3 +
ld/ldlex.l | 7 +++
ld/lexsup.c | 11 ++++
ld/scripttempl/arclinux.sc | 5 +-
ld/scripttempl/avr.sc | 1 +
ld/scripttempl/dlx.sc | 1 +
ld/scripttempl/elf.sc | 5 +-
ld/scripttempl/elf32cr16.sc | 1 +
ld/scripttempl/elf32crx.sc | 1 +
ld/scripttempl/elf32msp430.sc | 1 +
ld/scripttempl/elf64bpf.sc | 5 +-
ld/scripttempl/elf64hppa.sc | 1 +
ld/scripttempl/elfarc.sc | 1 +
ld/scripttempl/elfarcv2.sc | 1 +
ld/scripttempl/elfd10v.sc | 1 +
ld/scripttempl/elfd30v.sc | 1 +
ld/scripttempl/elfm68hc11.sc | 1 +
ld/scripttempl/elfm68hc12.sc | 1 +
ld/scripttempl/elfm9s12z.sc | 1 +
ld/scripttempl/elfmicroblaze.sc | 1 +
ld/scripttempl/elfxgate.sc | 1 +
ld/scripttempl/elfxtensa.sc | 1 +
ld/scripttempl/ft32.sc | 1 +
ld/scripttempl/i386beos.sc | 1 +
ld/scripttempl/i386go32.sc | 1 +
ld/scripttempl/iq2000.sc | 1 +
ld/scripttempl/mcorepe.sc | 1 +
ld/scripttempl/mep.sc | 1 +
ld/scripttempl/mmo.sc | 1 +
ld/scripttempl/nds32elf.sc | 5 +-
ld/scripttempl/pe.sc | 1 +
ld/scripttempl/pep.sc | 1 +
ld/scripttempl/pru.sc | 1 +
ld/scripttempl/v850.sc | 1 +
ld/scripttempl/v850_rh850.sc | 1 +
ld/scripttempl/visium.sc | 1 +
ld/scripttempl/xstormy16.sc | 1 +
ld/testsuite/ld-scripts/start.s | 14 +++++
ld/testsuite/ld-scripts/text-order-1a.d | 17 ++++++
ld/testsuite/ld-scripts/text-order-1a.s | 8 +++
ld/testsuite/ld-scripts/text-order-1a.t | 5 ++
ld/testsuite/ld-scripts/text-order-1b.d | 17 ++++++
ld/testsuite/ld-scripts/text-order-1b.s | 8 +++
ld/testsuite/ld-scripts/text-order-1b.t | 4 ++
ld/testsuite/ld-scripts/text-order-1c.d | 6 ++
ld/testsuite/ld-scripts/text-order-1c.t | 5 ++
ld/testsuite/ld-scripts/text-order.exp | 43 ++++++++++++++
52 files changed, 311 insertions(+), 17 deletions(-)
create mode 100644 ld/testsuite/ld-scripts/start.s
create mode 100644 ld/testsuite/ld-scripts/text-order-1a.d
create mode 100644 ld/testsuite/ld-scripts/text-order-1a.s
create mode 100644 ld/testsuite/ld-scripts/text-order-1a.t
create mode 100644 ld/testsuite/ld-scripts/text-order-1b.d
create mode 100644 ld/testsuite/ld-scripts/text-order-1b.s
create mode 100644 ld/testsuite/ld-scripts/text-order-1b.t
create mode 100644 ld/testsuite/ld-scripts/text-order-1c.d
create mode 100644 ld/testsuite/ld-scripts/text-order-1c.t
create mode 100644 ld/testsuite/ld-scripts/text-order.exp
--
2.43.0
More information about the Binutils
mailing list