]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
elf symbol size
authorAlan Modra <amodra@gmail.com>
Thu, 29 May 2025 10:40:28 +0000 (20:10 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 30 May 2025 00:46:19 +0000 (10:16 +0930)
commitbcbba25dfc37568c2f40241ea3c02fa8c054d497
tree27946d9ad7935b7b21f8e43e9bcca9fb10ff0f75
parentda79d62c379874467d6cf2e634b40e1eb2d825f9
elf symbol size

This changes elf_obj_sy.size from being malloc'd to being on the notes
obstack.  That means no code needs to free these expressions, which in
turn means that the size expression can be shared when cloning
symbols.  Nothing modifies the size expressions except when resolving.
In all cases I could see, if the size changes the entire expression is
replaced.

The patch also extracts code from elf_copy_symbol_attributes into a
separate function for use by riscv and aarch64.

* config/obj-elf.c (elf_obj_symbol_clone_hook): Delete.
(elf_copy_symbol_size): New function, extracted and modified from..
(elf_copy_symbol_attributes): ..here.
(obj_elf_size): Don't free size and use notes_alloc.
(elf_frob_symbol): Don't free size.
(elf_format_ops): Zero symbol_clone_hook.
* config/obj-elf.h (elf_obj_symbol_clone_hook): Delete.
(obj_symbol_clone_hook): Don't define.
(elf_copy_symbol_size): Declare.
* config/tc-aarch64.c (aarch64_elf_copy_symbol_attributes): Delete.
* config/tc-aarch64.h (OBJ_COPY_SYMBOL_ATTRIBUTES): Define as
elf_copy_symbol_size.
* config/tc-alpha.c (s_alpha_end): notes_alloc symbol size exp.
* config/tc-ia64.c (dot_endp): Likewise.
* config/tc-kvx.c (kvx_endp): Likewise.
* config/tc-mips.c (s_mips_end): Likewise.
* config/tc-riscv.c (riscv_elf_copy_symbol_attributes): Delete.
* config/tc-riscv.h (OBJ_COPY_SYMBOL_ATTRIBUTES): Define as
elf_copy_symbol_size.
gas/config/obj-elf.c
gas/config/obj-elf.h
gas/config/tc-aarch64.c
gas/config/tc-aarch64.h
gas/config/tc-alpha.c
gas/config/tc-ia64.c
gas/config/tc-kvx.c
gas/config/tc-mips.c
gas/config/tc-riscv.c
gas/config/tc-riscv.h