public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/4] ld: Add --text-section-ordering-file FILE
@ 2024-01-19 19:45 H.J. Lu
  2024-01-19 19:45 ` [PATCH 1/4] " H.J. Lu
                   ` (3 more replies)
  0 siblings, 4 replies; 19+ messages in thread
From: H.J. Lu @ 2024-01-19 19:45 UTC (permalink / raw)
  To: binutils; +Cc: goldstein.w.n

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


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

end of thread, other threads:[~2024-01-24 14:42 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-19 19:45 [PATCH 0/4] ld: Add --text-section-ordering-file FILE H.J. Lu
2024-01-19 19:45 ` [PATCH 1/4] " H.J. Lu
2024-01-19 21:50   ` Fangrui Song
     [not found]   ` <DS7PR12MB5765A2B98C7E1217F8C374B9CB702@DS7PR12MB5765.namprd12.prod.outlook.com>
2024-01-19 22:13     ` H.J. Lu
2024-01-19 23:15       ` Fangrui Song
2024-01-22  7:37         ` Jan Beulich
2024-01-22 12:51           ` H.J. Lu
2024-01-22 18:22             ` Noah Goldstein
2024-01-22 18:45               ` H.J. Lu
2024-01-24 14:41                 ` H.J. Lu
     [not found]       ` <DS7PR12MB5765059CCA55EC755F8132ACCB702@DS7PR12MB5765.namprd12.prod.outlook.com>
2024-01-20 14:12         ` H.J. Lu
2024-01-19 19:45 ` [PATCH 2/4] ld: Include the text section order file in all ELF linker scripts H.J. Lu
2024-01-19 20:00   ` Noah Goldstein
2024-01-19 20:18     ` H.J. Lu
2024-01-19 20:38       ` Noah Goldstein
2024-01-19 20:40         ` H.J. Lu
2024-01-19 21:07           ` Noah Goldstein
2024-01-19 19:45 ` [PATCH 3/4] ld: Include the text section order file in PE COFF " H.J. Lu
2024-01-19 19:45 ` [PATCH 4/4] ld: Document --text-section-ordering-file FILE H.J. Lu

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).