]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
x86: Disallow TLS relocation in non executable section
authorH.J. Lu <hjl.tools@gmail.com>
Tue, 30 Sep 2025 00:18:29 +0000 (08:18 +0800)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 2 Oct 2025 22:03:21 +0000 (06:03 +0800)
commit6b21c8b2ecfef5c95142cbc2c32f185cb1c26ab0
treeebc6baf9929de96dff888e7d591175553c047734
parentbf7c1b207d84707b8bb99fb57122e3e58d3065fe
x86: Disallow TLS relocation in non executable section

Since TLS relocations are applied to executable machine instructions,
disallow TLS relocation in non-SHT_PROGBITS, non-SHF_EXECINSTR section.

PR ld/33451
PR ld/33502
* elf32-i386.c (elf_i386_tls_transition): Disallow TLS relocation
in non-SHT_PROGBITS, non-SHF_EXECINSTR section.
(elf_i386_scan_relocs): Likewise.
* elf64-x86-64.c (elf_x86_64_tls_transition): Likewise.
(elf_x86_64_scan_relocs): Likewise.
* elfxx-x86.c (_bfd_x86_elf_link_report_tls_invalid_section_error):
New.
* elfxx-x86.h (_bfd_x86_elf_link_report_tls_invalid_section_error):
Likewise.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
bfd/elf32-i386.c
bfd/elf64-x86-64.c
bfd/elfxx-x86.c
bfd/elfxx-x86.h