binutils-gdb/include
H.J. Lu 6f365fda85 elf: Add GNU_PROPERTY_1_NEEDED check
If GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS is set on any input
relocatable files:

1. Don't generate copy relocations.
2. Turn off extern_protected_data since it implies
GNU_PROPERTY_NO_COPY_ON_PROTECTED.
3. Treate reference to protected symbols with indirect external access
as local.
4. Set GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS on output.
5. When generating executable, clear this bit when there are non-GOT or
non-PLT relocations in input relocatable files without the bit set.
6. Add -z [no]indirect-extern-access to control indirect external access.

bfd/

	* elf-bfd (elf_obj_tdata): Add has_indirect_extern_access.
	(elf_has_indirect_extern_access): New.
	* elf-properties.c (_bfd_elf_parse_gnu_properties): Set
	elf_has_indirect_extern_access and elf_has_no_copy_on_protected
	when seeing GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS.
	(elf_write_gnu_propertie): Add an argument to pass link_info.
	Set needed_1_p for GNU_PROPERTY_1_NEEDED in memory.
	(_bfd_elf_link_setup_gnu_properties): Handle
	GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS for
	-z indirect-extern-access.  Set nocopyreloc to true and
	extern_protected_data to false for indirect external access.
	(_bfd_elf_convert_gnu_properties): Updated.
	* elf32-i386.c (elf_i386_check_relocs): Set
	non_got_ref_without_indirect_extern_access on legacy non-GOT or
	non-PLT references.
	* elf64-x86-64.c (elf_x86_64_check_relocs): Likewise.
	* elflink.c (_bfd_elf_symbol_refs_local_p): Return true for
	STV_PROTECTED symbols with indirect external access.
	* elfxx-x86.c (_bfd_x86_elf_adjust_dynamic_symbol): Clear
	indirect_extern_access for legacy non-GOT/non-PLT references.
	* elfxx-x86.h (elf_x86_link_hash_entry): Add
	non_got_ref_without_indirect_extern_access.

include/

	* bfdlink.h (bfd_link_info): Add indirect_extern_access and
	needed_1_p.  Change nocopyreloc to int.

ld/

	* NEWS: Mention -z [no]indirect-extern-access
	* ld.texi: Document -z [no]indirect-extern-access
	* ldmain.c (main): Initialize link_info.indirect_extern_access
	to -1.
	* emulparams/extern_protected_data.sh: Support
	-z [no]indirect-extern-access.
	* testsuite/ld-elf/indirect-extern-access-1.rd: New file
	* testsuite/ld-elf/indirect-extern-access-1a.c: Likewise.
	* testsuite/ld-elf/indirect-extern-access-1b.c: Likewise.
	* testsuite/ld-elf/indirect-extern-access-2.rd: Likewise.
	* testsuite/ld-elf/indirect-extern-access-2a.c: Likewise.
	* testsuite/ld-elf/indirect-extern-access-2b.c: Likewise.
	* testsuite/ld-elf/indirect-extern-access-3.rd: Likewise.
	* testsuite/ld-elf/indirect-extern-access.S: Likewise.
	* testsuite/ld-elf/property-1_needed-1b.d: Likewise.
	* testsuite/ld-elf/property-1_needed-1c.d: Likewise.
	* testsuite/ld-x86-64/indirect-extern-access.rd: Likewise.
	* testsuite/ld-x86-64/protected-data-1.h: Likewise.
	* testsuite/ld-x86-64/protected-data-1a.c: Likewise.
	* testsuite/ld-x86-64/protected-data-1b.c: Likewise.
	* testsuite/ld-x86-64/protected-data-2a.S: Likewise.
	* testsuite/ld-x86-64/protected-data-2b.S: Likewise.
	* testsuite/ld-x86-64/protected-func-2a.S: Likewise.
	* testsuite/ld-x86-64/protected-func-2b.S: Likewise.
	* testsuite/ld-x86-64/protected-func-2c.c: Likewise.
	* testsuite/ld-elf/linux-x86.exp: Run test with
	GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS.
	* testsuite/ld-x86-64/x86-64.exp: Run tests for protected
	function and data with indirect external access.
2021-07-08 18:14:31 -07:00
..
aout Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
cgen Remove bfd_stdint.h 2021-03-31 10:49:23 +10:30
coff Fix .dwsect generation for XCOFF. Handle .function generated with DWARF on XCOFF. 2021-05-07 15:29:49 +01:00
elf elf: Add GNU_PROPERTY_1_NEEDED 2021-07-08 18:11:53 -07:00
gdb sim: create header namespace 2021-05-14 00:41:05 -04:00
mach-o Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
opcode opcodes: constify aarch64_opcode_tables 2021-07-01 17:51:00 -04:00
sim sim: callback: add printf attributes 2021-06-29 02:14:58 -04:00
som Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
vms Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
alloca-conf.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
ansidecl.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
bfdlink.h elf: Add GNU_PROPERTY_1_NEEDED check 2021-07-08 18:14:31 -07:00
binary-io.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
bout.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
ChangeLog Add markers for 2.37 branch 2021-07-03 14:50:57 +01:00
ChangeLog-0415 binutils ChangeLog rotation 2016-01-01 22:59:17 +10:30
ChangeLog-2016 ChangeLog rotation 2017-01-02 13:55:05 +10:30
ChangeLog-2017 ChangeLog rotation 2018-01-03 17:49:42 +10:30
ChangeLog-2018 ChangeLog rotation 2019-01-01 21:25:40 +10:30
ChangeLog-2019 ChangeLog rotation 2020-01-01 18:12:08 +10:30
ChangeLog-2020 ChangeLog rotation 2021-01-01 10:31:02 +10:30
ChangeLog-9103 Add copyright notices 2012-12-10 12:48:03 +00:00
COPYING
COPYING3
ctf-api.h libctf, include: support an alternative encoding for nonrepresentable types 2021-05-06 09:30:59 +01:00
ctf.h libctf, include: support an alternative encoding for nonrepresentable types 2021-05-06 09:30:59 +01:00
demangle.h Synchronize libiberty sources (and include/demangle.h) with GCC master version 2021-07-03 14:00:33 +01:00
diagnostics.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
dis-asm.h arc: Construct disassembler options dynamically 2021-06-02 15:32:58 +03:00
dwarf2.def Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
dwarf2.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
dyn-string.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
environ.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
fibheap.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
filenames.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
floatformat.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
fnmatch.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
fopen-bin.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
fopen-same.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
fopen-vms.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
gcc-c-fe.def Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
gcc-c-interface.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
gcc-cp-fe.def Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
gcc-cp-interface.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
gcc-interface.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
getopt.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
hashtab.h libiberty: add htab_eq_string 2021-05-07 11:17:11 +01:00
hp-symtab.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
leb128.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
libiberty.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
longlong.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
lto-symtab.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
MAINTAINERS Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
md5.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
oasys.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
objalloc.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
obstack.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
os9k.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
partition.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
plugin-api.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
progress.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
safe-ctype.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
sha1.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
simple-object.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
sort.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
splay-tree.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
symcat.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
timeval-utils.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
vtv-change-permission.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
xregex2.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
xregex.h merge from gcc 2011-07-25 17:11:48 +00:00
xtensa-config.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
xtensa-isa-internal.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30
xtensa-isa.h Update year range in copyright notice of binutils files 2021-01-01 10:31:05 +10:30