aboutsummaryrefslogtreecommitdiff
path: root/ld/ldelf.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2020-11-13 15:44:35 -0800
committerH.J. Lu <hjl.tools@gmail.com>2020-11-13 15:44:47 -0800
commitcbd5b99cce073273f668b154d4514e8e7e7ccc51 (patch)
treeed448b47d23eaaa211ed2e56fde87c3f8be6a011 /ld/ldelf.c
parent25f4c26276594b0afdb7709df668a90858e399fa (diff)
downloadgdb-cbd5b99cce073273f668b154d4514e8e7e7ccc51.zip
gdb-cbd5b99cce073273f668b154d4514e8e7e7ccc51.tar.gz
gdb-cbd5b99cce073273f668b154d4514e8e7e7ccc51.tar.bz2
elf: Set rel_from_abs to 1 for __ehdr_start
bfdlink.h has /* Symbol will be converted from absolute to section-relative. Set for symbols defined by a script from "dot" (also SEGMENT_START or ORIGIN) outside of an output section statement. */ unsigned int rel_from_abs : 1; linker.c has .{* Return TRUE if the symbol described by a linker hash entry H . is going to be absolute. Linker-script defined symbols can be . converted from absolute to section-relative ones late in the . link. Use this macro to correctly determine whether the symbol . will actually end up absolute in output. *} .#define bfd_is_abs_symbol(H) \ . (((H)->type == bfd_link_hash_defined \ . || (H)->type == bfd_link_hash_defweak) \ . && bfd_is_abs_section ((H)->u.def.section) \ . && !(H)->rel_from_abs) . Set rel_from_abs to 1 for __ehdr_start which will be converted from absolute to section-relative in assign_file_positions_for_load_sections. PR ld/26869 * ldelf.c (ldelf_before_allocation): Set rel_from_abs to 1 for __ehdr_start. * testsuite/ld-i386/i386.exp: Run pr26869. * testsuite/ld-i386/pr26869.d: New file. * testsuite/ld-i386/pr26869.s: Likewise.
Diffstat (limited to 'ld/ldelf.c')
-rw-r--r--ld/ldelf.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/ld/ldelf.c b/ld/ldelf.c
index c37358f..5cfddef 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -1590,6 +1590,8 @@ ldelf_before_allocation (char *audit, char *depaudit,
(char *) &ehdr_start->u + sizeof ehdr_start->u.def.next,
sizeof ehdr_start_save_u);
ehdr_start->type = bfd_link_hash_defined;
+ /* It will be converted to section-relative later. */
+ ehdr_start->rel_from_abs = 1;
ehdr_start->u.def.section = bfd_abs_section_ptr;
ehdr_start->u.def.value = 0;
}