mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-09 04:21:49 +08:00
ld: Issue an error for GC on __patchable_function_entries section
__patchable_function_entries section is generated by a compiler with -fpatchable-function-entry=XX. The assembly code looks like this: --- .text .globl _start .type _start, %function _start: .section __patchable_function_entries,"aw",%progbits .dc.a .LPFE1 .text .LPFE1: .byte 0 --- But --gc-sections will silently remove __patchable_function_entries section and generate corrupt result. This patch disallows garbage collection on __patchable_function_entries section without linked-to section. bfd/ PR ld/25490 * elflink.c (_bfd_elf_gc_mark_extra_sections): Issue an error for garbage collection on __patchable_function_entries section without linked-to section. ld/ PR ld/25490 * testsuite/ld-elf/pr25490-1.d: New file. * testsuite/ld-elf/pr25490-1.s: Likewise.
This commit is contained in:
parent
b7d0721677
commit
5242a0a000
@ -1,3 +1,10 @@
|
||||
2020-02-06 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR ld/25490
|
||||
* elflink.c (_bfd_elf_gc_mark_extra_sections): Issue an error
|
||||
for garbage collection on __patchable_function_entries section
|
||||
without linked-to section.
|
||||
|
||||
2020-02-06 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR gas/25381
|
||||
|
@ -13365,6 +13365,13 @@ _bfd_elf_gc_mark_extra_sections (struct bfd_link_info *info,
|
||||
&& (isec->flags & SEC_DEBUGGING)
|
||||
&& CONST_STRNEQ (isec->name, ".debug_line."))
|
||||
debug_frag_seen = TRUE;
|
||||
else if (strcmp (bfd_section_name (isec),
|
||||
"__patchable_function_entries") == 0
|
||||
&& elf_linked_to_section (isec) == NULL)
|
||||
info->callbacks->einfo (_("%F%P: %pB(%pA): error: "
|
||||
"need linked-to section "
|
||||
"for --gc-sections\n"),
|
||||
isec->owner, isec);
|
||||
}
|
||||
|
||||
/* If no non-note alloc section in this file will be kept, then
|
||||
|
@ -1,3 +1,9 @@
|
||||
2020-02-06 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR ld/25490
|
||||
* testsuite/ld-elf/pr25490-1.d: New file.
|
||||
* testsuite/ld-elf/pr25490-1.s: Likewise.
|
||||
|
||||
2020-02-06 H.J. Lu <hongjiu.lu@intel.com>
|
||||
|
||||
PR ld/24526
|
||||
|
3
ld/testsuite/ld-elf/pr25490-1.d
Normal file
3
ld/testsuite/ld-elf/pr25490-1.d
Normal file
@ -0,0 +1,3 @@
|
||||
#ld: --gc-sections -e _start
|
||||
#target: [check_gc_sections_available]
|
||||
#error: .*\(__patchable_function_entries\): error: need linked-to section for --gc-sections
|
9
ld/testsuite/ld-elf/pr25490-1.s
Normal file
9
ld/testsuite/ld-elf/pr25490-1.s
Normal file
@ -0,0 +1,9 @@
|
||||
.text
|
||||
.globl _start
|
||||
.type _start, %function
|
||||
_start:
|
||||
.section __patchable_function_entries,"aw",%progbits
|
||||
.dc.a .LPFE1
|
||||
.text
|
||||
.LPFE1:
|
||||
.byte 0
|
Loading…
Reference in New Issue
Block a user