Browse Source
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.
binutils-2_36-branch
5 changed files with 29 additions and 0 deletions
@ -0,0 +1,14 @@ |
|||
#as: --32 |
|||
#ld: -shared -melf_i386 |
|||
#readelf: -r -s --wide |
|||
|
|||
Relocation section '.rel.dyn' at offset 0x[a-f0-9]+ contains 1 entry: |
|||
Offset Info Type Sym. Value Symbol's Name |
|||
0+[a-f0-9]+ 00000008 R_386_RELATIVE |
|||
|
|||
#... |
|||
Symbol table '.symtab' contains [0-9]+ entries: |
|||
Num: Value Size Type Bind Vis Ndx Name |
|||
#... |
|||
+[a-f0-9]+: 00000000 0 NOTYPE LOCAL DEFAULT 1 __ehdr_start |
|||
#pass |
|||
@ -0,0 +1,3 @@ |
|||
.text |
|||
foo: |
|||
pushl __ehdr_start@GOT(%ebx) |
|||
Loading…
Reference in new issue