public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [RFC] ANY linker script syntax for non-contiguous regions
@ 2024-02-06 23:58 Daniel Thornburgh
  2024-02-07  0:33 ` Roland McGrath
  0 siblings, 1 reply; 7+ messages in thread
From: Daniel Thornburgh @ 2024-02-06 23:58 UTC (permalink / raw)
  To: binutils

[-- Attachment #1: Type: text/plain, Size: 1754 bytes --]

I've been working to add a feature for section packing akin to LD's
`--enable-non-contiguous-regions` to LLD. Discussing this[1] revealed a
desire to have an explicit syntax in the linker script, rather than having
a flag globally modify the behavior of wildcard matching and address
layout. I wanted to pop my head in here before implementing anything too
extensively with the hope of arriving at something that could work across
linkers.

I'm currently thinking of something like the existing `SORT_BY_xxx`
modifiers: `ANY(<tag> <wildcard_patterns>)`. This would match input
sections identically as normal, but it would record the set of matched
sections as associated with the given tag. Then, any further instances of
`ANY(<tag>)` without any wildcard patterns would provide locations that the
tagged sections could spill to, as if by a subsequent
`enable-non-contiguous-regions` match. `ANY` refers to the possibility that
any of the tagged sections that fit may appear at that location. (The name
feels weak to me; it comes from a vague reference to an armlink feature
with wildly different semantics. Open for suggestions.)

Using tags avoids introducing a new semantics for wildcard matching; a
section would still always match exactly one wildcard. Accordingly, it
would preserve the ability to use broad wildcards to refer to anything not
yet matched by earlier more specific ones. This in turn should make porting
easier, since linker scripts may be written assuming this. By contrast,
`--enable-non-contigous-regions` makes broad wildcards potential spill
locations for earlier matches, which may not have been intended.

[1] https://discourse.llvm.org/t/rfc-lld-enable-non-contiguous-regions/76513
-- 

Daniel Thornburgh | dthorn@google.com

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

end of thread, other threads:[~2024-05-01  5:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-06 23:58 [RFC] ANY linker script syntax for non-contiguous regions Daniel Thornburgh
2024-02-07  0:33 ` Roland McGrath
2024-02-07 22:36   ` Daniel Thornburgh
2024-02-07 23:23     ` Daniel Thornburgh
2024-02-10  6:33       ` Fangrui Song
     [not found]       ` <DS7PR12MB5765A6AA68F691E3A9641AABCB4A2@DS7PR12MB5765.namprd12.prod.outlook.com>
2024-02-12 10:04         ` Christophe Lyon
2024-05-01  5:07       ` Fangrui Song

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