binutils-gdb/include
Nick Alcock 203bfa2f6b include, libctf, ld: extend variable section to contain functions too
The CTF variable section is an optional (usually-not-present) section in
the CTF dict which contains name -> type mappings corresponding to data
symbols that are present in the linker input but not in the output
symbol table: the idea is that programs that use their own symbol-
resolution mechanisms can use this section to look up the types of
symbols they have found using their own mechanism.

Because these removed symbols (mostly static variables, functions, etc)
all have names that are unlikely to appear in the ELF symtab and because
very few programs have their own symbol-resolution mechanisms, a special
linker flag (--ctf-variables) is needed to emit this section.

Historically, we emitted only removed data symbols into the variable
section.  This seemed to make sense at the time, but in hindsight it
really doesn't: functions are symbols too, and a C program can look them
up just like any other type.  So extend the variable section so that it
contains all static function symbols too (if it is emitted at all), with
types of kind CTF_K_FUNCTION.

This is a little fiddly.  We relied on compiler assistance for data
symbols: the compiler simply emits all data symbols twice, once into the
symtypetab as an indexed symbol and once into the variable section.

Rather than wait for a suitably adjusted compiler that does the same for
function symbols, we can pluck unreported function symbols out of the
symtab and add them to the variable section ourselves.  While we're at
it, we do the same with data symbols: this is redundant right now
because the compiler does it, but it costs very little time and lets the
compiler drop this kludge and save a little space in .o files.

include/
	* ctf.h: Mention the new things we can see in the variable
	section.

ld/
	* testsuite/ld-ctf/data-func-conflicted-vars.d: New test.

libctf/
	* ctf-link.c (ctf_link_deduplicating_variables): Duplicate
	symbols into the variable section too.
	* ctf-serialize.c (symtypetab_delete_nonstatic_vars): Rename
	to...
	(symtypetab_delete_nonstatics): ... this.  Check the funchash
	when pruning redundant variables.
	(ctf_symtypetab_sect_sizes): Adjust accordingly.
	* NEWS: Describe this change.
2022-03-23 13:48:32 +00:00
..
aout Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
cgen Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
coff gas: add visibility support for XCOFF 2022-01-12 09:08:11 +01:00
elf LoongArch: Update ABI eflag in elf header. 2022-03-20 09:37:12 +08:00
gdb Automatic Copyright Year update after running gdb/copyright.py 2022-01-01 19:13:23 +04:00
mach-o Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
opcode gas:LoongArch: Fix segment error in compilation due to too long symbol name. 2022-03-20 09:37:12 +08:00
sim Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
som Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
vms Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
alloca-conf.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
ansidecl.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
bfdlink.h PR28751 mbind2a / mbind2b regressions on powerpc*-linux 2022-01-14 22:02:23 +10:30
binary-io.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
bout.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
ChangeLog binutils/readelf: handle AMDGPU relocation types 2022-03-16 09:01:54 -04:00
ChangeLog-0415
ChangeLog-2016
ChangeLog-2017
ChangeLog-2018
ChangeLog-2019
ChangeLog-2020 ChangeLog rotation 2021-01-01 10:31:02 +10:30
ChangeLog-9103
collectorAPI.h gprofng: a new GNU profiler 2022-03-11 08:58:31 +00:00
COPYING
COPYING3
ctf-api.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
ctf.h include, libctf, ld: extend variable section to contain functions too 2022-03-23 13:48:32 +00:00
demangle.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
diagnostics.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
dis-asm.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
dwarf2.def gdb/fortran: support ptype and print commands for namelist variables 2022-02-11 15:26:25 +00:00
dwarf2.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
dyn-string.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
environ.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
fibheap.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
filenames.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
floatformat.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
fnmatch.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
fopen-bin.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
fopen-same.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
fopen-vms.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
gcc-c-fe.def Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
gcc-c-interface.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
gcc-cp-fe.def Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
gcc-cp-interface.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
gcc-interface.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
getopt.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
hashtab.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
hp-symtab.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
leb128.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
libcollector.h gprofng: a new GNU profiler 2022-03-11 08:58:31 +00:00
libfcollector.h gprofng: a new GNU profiler 2022-03-11 08:58:31 +00:00
libiberty.h Synchronize binutils libiberty sources with gcc version. 2022-01-13 12:25:34 +00:00
longlong.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
lto-symtab.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
MAINTAINERS Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
md5.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
oasys.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
objalloc.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
obstack.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
os9k.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
partition.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
plugin-api.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
progress.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
safe-ctype.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
sha1.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
simple-object.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
sort.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
splay-tree.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
symcat.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
timeval-utils.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
vtv-change-permission.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
xregex2.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
xregex.h
xtensa-config.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
xtensa-isa-internal.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30
xtensa-isa.h Update year range in copyright notice of binutils files 2022-01-02 12:04:28 +10:30