binutils-gdb/include
Oleg Tolmatcev d9d09c878e PE/COFF: raise normal PE section limit safely
PE/COFF stores symbol section numbers in a 16-bit field.  Binutils used
signed 16-bit handling there, which limited normal PE objects to 32767
sections even though MSVC and Clang already accept a larger unsigned
range.

Raise the normal PE section limit to 65279, while keeping the PE/COFF
special section-number values for undefined, absolute and debug symbols
working correctly.  Do this by decoding and encoding normal PE symbol
section numbers as unsigned values in the ordinary range, but preserving
the reserved PE constants explicitly.

Also add a gas test that exercises a normal PE object above the old
32767-section limit and checks that objdump reports the high section
number correctly.

bfd/ChangeLog:

	* coffcode.h (COFF_DEFAULT_MAX_NSCNS): Define.
	(bfd_coff_std_swap_table): Use it for the default maximum section
	count.
	(ticoff0_swap_table): Likewise.
	(ticoff1_swap_table): Likewise.
	* peXXigen.c (pe_decode_sym_section_number): New function.
	(pe_encode_sym_section_number): New function.
	(_bfd_XXi_swap_sym_in): Use pe_decode_sym_section_number.
	(_bfd_XXi_swap_sym_out): Use pe_encode_sym_section_number.

include/ChangeLog:

	* coff/pe.h (IMAGE_SYM_UNDEFINED): Define.
	(IMAGE_SYM_ABSOLUTE): Define.
	(IMAGE_SYM_DEBUG): Define.
	(IMAGE_SYM_SECTION_MAX): Define.

gas/ChangeLog:

	* testsuite/gas/pe/pe.exp: Run large-obj-normal.
	* testsuite/gas/pe/large-obj-normal.s: New test.
	* testsuite/gas/pe/large-obj-normal.d: New test.

Signed-off-by: Oleg Tolmatcev <oleg.tolmatcev@gmail.com>
2026-07-17 15:39:11 +02:00
..
aout Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
cgen Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
coff PE/COFF: raise normal PE section limit safely 2026-07-17 15:39:11 +02:00
elf bfd/readelf: Add core file support for FEAT_S1POE 2026-07-02 13:57:25 +00:00
gdb Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
mach-o Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
opcode aarch64: Add support for FEAT_SME_FA64 2026-07-10 16:09:06 +01:00
sim include/sim: remove arm simulator header 2026-02-13 18:57:08 +00:00
som Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
vms Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
alloca-conf.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
ansidecl.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
bfdlink.h Remove check_relocs_after_open_input 2026-05-01 22:18:44 +09:30
binary-io.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
ChangeLog Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
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
collectorAPI.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
COPYING
COPYING3
ctf-api.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
ctf.h libctf: remove CTF_F_ARRNELEMS flag 2026-02-27 15:06:41 +00:00
demangle.h Sync libiberty sources with gcc master version 2026-01-07 11:33:07 +00:00
diagnostics.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
dis-asm.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
doubly-linked-list.h libiberty: sync with gcc 2026-02-05 17:24:38 +00:00
dwarf2.def Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
dwarf2.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
dyn-string.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
environ.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
fibheap.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
filenames.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
floatformat.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
fnmatch.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
fopen-bin.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
fopen-same.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
fopen-vms.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
gcc-c-fe.def Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
gcc-c-interface.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
gcc-cp-fe.def Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
gcc-cp-interface.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
gcc-interface.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
getopt.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
hashtab.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
hp-symtab.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
leb128.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
libcollector.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
libfcollector.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
libiberty.h Port expandargstr from gcc/libiberty 2026-06-15 16:58:38 +01:00
longlong.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
lto-symtab.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
MAINTAINERS Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
md5.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
oasys.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
objalloc.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
obstack.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
os9k.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
partition.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
plugin-api.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
safe-ctype.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
same-inode.h same-inode.h: don't depend on _GL_WINDOWS_STAT_INODES 2026-02-26 10:35:51 +10:30
sframe-api.h libsframe: rename offset in user-facing sframe_frame_row_entry struct 2026-01-23 14:21:15 -08:00
sframe-internal.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
sframe.h include: libsframe: rename SFrame V3 Flexible FDE macros to CTRLWORD 2026-01-29 20:02:57 -08:00
sha1.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
simple-object.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
sort.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
splay-tree.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
symcat.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
timeval-utils.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
vtv-change-permission.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +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 2026-01-01 23:22:14 +10:30
xtensa-config.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
xtensa-dynconfig.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
xtensa-isa-internal.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30
xtensa-isa.h Update year range in copyright notice of binutils files 2026-01-01 23:22:14 +10:30