]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Treat `start_stop` symbols as having section size
authorMatthew Malcomson <matthew.malcomson@arm.com>
Mon, 7 Mar 2022 18:10:54 +0000 (18:10 +0000)
committerMatthew Malcomson <matthew.malcomson@arm.com>
Mon, 7 Mar 2022 18:10:54 +0000 (18:10 +0000)
commit47b9119833ab8bcda04c8397293cccd71d5a4efe
tree180b117b68a36ecfe3061d1fbadbf440f737688e
parent9db78a71d606f4f03ec86f35a13efaadd279ac1d
Treat `start_stop` symbols as having section size

There is special handling to ensure that symbols which look like they
are supposed to point at the start of a section are given a size to span
that entire section.

GNU ld has special `start_stop` symbols which are automatically provided
by the linker for sections where the output section and input section
share a name and that name is representable as a C identifier.
(see commit cbd0eecf2)

These special symbols represent the start and end address of the output
section.  These special symbols are used in much the same way in source
code as section-start symbols provided by the linker script.  Glibc uses
these for the __libc_atexit section containing pointers for functions to
run at exit.

This change accounts for these `start_stop` symbols by giving them the
size of the "remaining" range of the output section in the same way as
linker script defined symbols.  This means that the `start` symbols get
section-spanning bounds and the `stop` symbols get bounds of zero.

N.b. We will have to also account for these symbols in the
`resize_sections` function, but that's not done yet.
bfd/elfnn-aarch64.c
ld/testsuite/ld-aarch64/aarch64-elf.exp
ld/testsuite/ld-aarch64/morello-sec-start_stop-round.d [new file with mode: 0644]
ld/testsuite/ld-aarch64/morello-sec-start_stop-round.s [new file with mode: 0644]