binutils-gdb/include
H.J. Lu 0a59decbb8 elf: Add PT_GNU_PROPERTY segment type
Linkers group input note sections with the same name into one output
note section with the same name.  One output note section is placed in
one PT_NOTE segment.  New linkers merge all input .note.gnu.property
sections into one output .note.gnu.property section with a single
NT_GNU_PROPERTY_TYPE_0 note in a single PT_NOTE segment.  Since older
linkers treat input .note.gnu.property section as a generic note section
and just concatenate all input .note.gnu.property sections into one
output .note.gnu.property section without merging them, we may
see one or more NT_GNU_PROPERTY_TYPE_0 notes in PT_NOTE segment, which
are invalid.

GNU_PROPERTY_X86_UINT32_VALID was defined to address this issue such
that linker sets the bit for non-relocatable outputs.  But it isn't
sufficient:

1. It doesn't cover generic properties.
2. When -mx86-used-note=yes is passed to x86 assembler, the
GNU_PROPERTY_X86_UINT32_VALID bit is set in GNU_PROPERTY_X86_ISA_1_USED
property in object file and older linkers generate invalid
NT_GNU_PROPERTY_TYPE_0 notes with the GNU_PROPERTY_X86_UINT32_VALID bit
set.

I am proposing the following changes:

1. Add PT_GNU_PROPERTY segment type:

 # define PT_GNU_PROPERTY (PT_LOOS + 0x474e553)

which covers .note.gnu.property section.
2. Remove GNU_PROPERTY_X86_UINT32_VALID.

bfd/

	PR ld/23900
	* elf.c (get_program_header_size): Add a PT_GNU_PROPERTY
	segment for NOTE_GNU_PROPERTY_SECTION_NAME.
	(_bfd_elf_map_sections_to_segments): Create a PT_GNU_PROPERTY
	segment for NOTE_GNU_PROPERTY_SECTION_NAME.
	* elfxx-x86.c (_bfd_elf_link_setup_gnu_properties): Don't set
	GNU_PROPERTY_X86_UINT32_VALID.

binutils/

	PR ld/23900
	* readelf.c (get_segment_type): Support PT_GNU_PROPERTY.
	(decode_x86_isa): Don't check GNU_PROPERTY_X86_UINT32_VALID.
	(decode_x86_feature_1): Likewise.
	(decode_x86_feature_2): Likewise.
	(print_gnu_property_note): Remove GNU_PROPERTY_X86_UINT32_VALID
	check.
	* testsuite/binutils-all/i386/empty.d: Updated.
	* testsuite/binutils-all/x86-64/empty-x32.d: Likewise.
	* testsuite/binutils-all/x86-64/empty.d: Likewise.
	* testsuite/binutils-all/i386/pr21231b.s: Change
	GNU_PROPERTY_X86_ISA_1_USED bits to 0x7fffffff.
	* testsuite/binutils-all/x86-64/pr21231b.s: Likewise.

gas/

	PR ld/23900
	* config/tc-i386.c (x86_cleanup): Don't set
	GNU_PROPERTY_X86_UINT32_VALID.
	* testsuite/gas/i386/property-1.s: Change
	GNU_PROPERTY_X86_ISA_1_USED bits to 0.

include/

	PR ld/23900
	* elf/common.h (PT_GNU_PROPERTY): New.
	(GNU_PROPERTY_X86_UINT32_VALID): Removed.

ld/

	PR ld/23900
	* testsuite/ld-elf/elf.exp: Run PR ld/23900 test.
	* testsuite/ld-elf/pr23900-1-32.rd: New file.
	* testsuite/ld-elf/pr23900-1-64.rd: Likewise.
	* testsuite/ld-elf/pr23900-1.d: Likewise.
	* testsuite/ld-elf/pr23900-1.s: Likewise.
	* testsuite/ld-elf/pr23900-2.s: Likewise.
	* testsuite/ld-elf/pr23900-2a.d: Likewise.
	* testsuite/ld-elf/pr23900-2b.d: Likewise.
	* testsuite/ld-i386/ibt-plt-1.d: Adjusted.
	* testsuite/ld-i386/ibt-plt-2c.d: Likewise.
	* testsuite/ld-i386/ibt-plt-2d.d: Likewise.
	* testsuite/ld-i386/ibt-plt-3d.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-1.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-2c.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3c.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise.
	* testsuite/ld-x86-64/ibt-plt-3d.d: Likewise.
	* testsuite/ld-i386/pr23372c.d: Expect <None>
	for GNU_PROPERTY_X86_ISA_1_USED.
	* testsuite/ld-x86-64/pr23372c-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23372c.d: Likewise.
	* testsuite/ld-x86-64/pr23372d-x32.d: Likewise.
	* testsuite/ld-x86-64/pr23372d.d: Likewise.
	* testsuite/ld-x86-64/property-x86-5a.s: Change
	GNU_PROPERTY_X86_ISA_1_USED bits to 0.
	* testsuite/ld-x86-64/property-x86-5b.s: Likewise.
2018-12-14 04:55:34 -08:00
..
aout various i386-aout and i386-coff target removal 2018-04-18 09:34:19 +09:30
cgen Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
coff -Wstringop-truncation warnings 2018-05-04 18:58:23 +09:30
elf elf: Add PT_GNU_PROPERTY segment type 2018-12-14 04:55:34 -08:00
gdb Update copyright year range in all GDB files 2018-01-02 07:38:06 +04:00
mach-o Add support for new load commands added by Apple to the MACH-O file format. 2018-11-07 15:20:22 +00:00
opcode PowerPC @l, @h and @ha warnings, plus VLE e_li 2018-12-06 23:01:03 +10:30
som Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
vms Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
COPYING Update the address and phone number of the FSF organization 2005-05-10 10:21:13 +00:00
COPYING3 * COPYING3: New file. Contains version 3 of the GNU General Public License. 2007-07-17 13:50:23 +00:00
ChangeLog elf: Add PT_GNU_PROPERTY segment type 2018-12-14 04:55:34 -08: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-9103 Add copyright notices 2012-12-10 12:48:03 +00:00
MAINTAINERS Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
alloca-conf.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
ansidecl.h -Wstringop-truncation warnings 2018-05-04 18:58:23 +09:30
bfdlink.h elf: Report property change when merging properties 2018-12-07 08:30:43 -08:00
binary-io.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
bout.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
demangle.h Fix a failure in the libiberty testsuite by increasing the recursion limit to 2048. 2018-12-11 12:01:15 +00:00
diagnostics.h Disable -Wformat-nonliteral in parts of printcmd.c 2018-09-05 21:47:33 -06:00
dis-asm.h opcodes/riscv: Hide '.L0 ' fake symbols 2018-12-06 09:40:56 +00:00
dwarf2.def include: Sync with GCC 2018-06-19 14:15:17 -04:00
dwarf2.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
dyn-string.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
environ.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
fibheap.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
filenames.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
floatformat.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
fnmatch.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
fopen-bin.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
fopen-same.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
fopen-vms.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
gcc-c-fe.def Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
gcc-c-interface.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
gcc-cp-fe.def Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
gcc-cp-interface.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
gcc-interface.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
getopt.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
hashtab.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
hp-symtab.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
leb128.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
libiberty.h Copy from GCC: Add linker_output as prefix for LTO temps (PR lto/86548). 2018-08-01 14:23:10 +01:00
longlong.h include: Sync with GCC 2018-06-19 14:15:17 -04:00
lto-symtab.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
md5.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
oasys.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
objalloc.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
obstack.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
os9k.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
partition.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
plugin-api.h New plugin interface to get list of symbols wrapped with --wrap option. 2018-02-22 13:56:46 -08:00
progress.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
safe-ctype.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
sha1.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
simple-object.h libiberty: Sync with GCC 2018-06-18 09:34:12 -04:00
sort.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
splay-tree.h include: 2018-05-28 Bernd Edlinger <bernd.edlinger@hotmail.de> 2018-05-31 10:17:13 +01:00
symcat.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
timeval-utils.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
vtv-change-permission.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
xregex.h merge from gcc 2011-07-25 17:11:48 +00:00
xregex2.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
xtensa-config.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
xtensa-isa-internal.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30
xtensa-isa.h Update year range in copyright notice of binutils files 2018-01-03 17:49:56 +10:30