From 00a25cf38d56bacae6b82c79cf226c22d12295a5 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 17 Nov 2020 15:08:05 +0100 Subject: [PATCH] backends: Handle SHT_X86_64_UNWIND as valid relocation target type. The x86_64 abi defines a special section type for .eh_frame[_hdr], SHT_X86_64_UNWIND, which is a valid relocation target type. https://sourceware.org/bugzilla/show_bug.cgi?id=26878 Signed-off-by: Mark Wielaard --- backends/ChangeLog | 5 +++++ backends/x86_64_init.c | 1 + backends/x86_64_symbol.c | 8 ++++++++ 3 files changed, 14 insertions(+) diff --git a/backends/ChangeLog b/backends/ChangeLog index 81d4127c..e88dedf9 100644 --- a/backends/ChangeLog +++ b/backends/ChangeLog @@ -1,3 +1,8 @@ +2020-11-17 Mark Wielard + + * x86_64_symbol.c (x86_64_check_reloc_target_type): New function. + * x86_64_init.c (x86_64_init): Hook check_reloc_target_type. + 2020-10-19 Mark Wielard * Makefile.am (modules): Remove tilegx. diff --git a/backends/x86_64_init.c b/backends/x86_64_init.c index 8db9b643..be965fa6 100644 --- a/backends/x86_64_init.c +++ b/backends/x86_64_init.c @@ -63,6 +63,7 @@ x86_64_init (Elf *elf __attribute__ ((unused)), eh->frame_nregs = 17; HOOK (eh, set_initial_registers_tid); HOOK (eh, unwind); + HOOK (eh, check_reloc_target_type); return eh; } diff --git a/backends/x86_64_symbol.c b/backends/x86_64_symbol.c index 98457bcb..d5f62e8f 100644 --- a/backends/x86_64_symbol.c +++ b/backends/x86_64_symbol.c @@ -71,3 +71,11 @@ x86_64_section_type_name (int type, return NULL; } + +/* The SHT_X86_64_UNWIND section type is a valid target for relocation. */ +bool +x86_64_check_reloc_target_type (Ebl *ebl __attribute__ ((unused)), + Elf64_Word sh_type) +{ + return sh_type == SHT_X86_64_UNWIND; +} -- 2.18.4