mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-19 00:59:15 +08:00
x86: Properly handle __ehdr_start
After _bfd_i386_elf_convert_load and _bfd_x86_64_elf_convert_load are removed, elf_i386_convert_load_reloc and elf_x86_64_convert_load_reloc see __ehdr_start as an undefined symbol when they are called from check_relocs to convert GOT relocations against local symbols. But __ehdr_start will be defined as a hidden symbol by linker at the later stage if it is referenced. This patch marks __ehdr_start as a defined local symbol at the start of check_relocs if it is referenced and not defined. bfd/ PR ld/22115 * elf32-i386.c (elf_i386_convert_load_reloc): Check linker_def. Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO. * elf64-x86-64.c (elf_x86_64_convert_load_reloc): Check linker_def. Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO. * elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Set local_ref and linker_def on __ehdr_start if it is referenced and not defined. (_bfd_x86_elf_link_symbol_references_local): Also set local_ref and return TRUE when building executable, if a symbol has non-GOT/non-PLT relocations in text section or there is no dynamic linker. * elfxx-x86.h (elf_x86_link_hash_entry): Add linker_def. ld/ PR ld/22115 * ld-i386/i386.exp: Run PR ld/22115 tests, * ld/testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-i386/pr22115-1.s: New file. * testsuite/ld-i386/pr22115-1a.d: Likewise. * testsuite/ld-i386/pr22115-1b.d: Likewise. * testsuite/ld-i386/pr22115-1c.d: Likewise. * testsuite/ld-i386/pr22115-1d.d: Likewise. * testsuite/ld-x86-64/pr22115-1.s: Likewise. * testsuite/ld-x86-64/pr22115-1a-x32.d: Likewise. * testsuite/ld-x86-64/pr22115-1a.d: Likewise. * testsuite/ld-x86-64/pr22115-1b-x32.d: Likewise. * testsuite/ld-x86-64/pr22115-1b.d: Likewise. * testsuite/ld-x86-64/pr22115-1c-x32.d: Likewise. * testsuite/ld-x86-64/pr22115-1c.d: Likewise. * testsuite/ld-x86-64/pr22115-1d-x32.d: Likewise. * testsuite/ld-x86-64/pr22115-1d.d: Likewise.
This commit is contained in:
@ -1,3 +1,19 @@
|
|||||||
|
2017-09-09 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
PR ld/22115
|
||||||
|
* elf32-i386.c (elf_i386_convert_load_reloc): Check linker_def.
|
||||||
|
Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
|
||||||
|
* elf64-x86-64.c (elf_x86_64_convert_load_reloc): Check
|
||||||
|
linker_def. Don't use UNDEFINED_WEAK_RESOLVED_TO_ZERO.
|
||||||
|
* elfxx-x86.c (_bfd_x86_elf_link_check_relocs): Set local_ref
|
||||||
|
and linker_def on __ehdr_start if it is referenced and not
|
||||||
|
defined.
|
||||||
|
(_bfd_x86_elf_link_symbol_references_local): Also set local_ref
|
||||||
|
and return TRUE when building executable, if a symbol has
|
||||||
|
non-GOT/non-PLT relocations in text section or there is no
|
||||||
|
dynamic linker.
|
||||||
|
* elfxx-x86.h (elf_x86_link_hash_entry): Add linker_def.
|
||||||
|
|
||||||
2017-09-08 H.J. Lu <hongjiu.lu@intel.com>
|
2017-09-08 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* elfxx-x86.h: Update comments.
|
* elfxx-x86.h: Update comments.
|
||||||
|
@ -1229,6 +1229,8 @@ elf_i386_convert_load_reloc (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
|
|||||||
unsigned int r_type;
|
unsigned int r_type;
|
||||||
unsigned int r_symndx;
|
unsigned int r_symndx;
|
||||||
bfd_vma roff = irel->r_offset;
|
bfd_vma roff = irel->r_offset;
|
||||||
|
bfd_boolean local_ref;
|
||||||
|
struct elf_x86_link_hash_entry *eh;
|
||||||
|
|
||||||
if (roff < 2)
|
if (roff < 2)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1276,6 +1278,8 @@ elf_i386_convert_load_reloc (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
|
|||||||
register. */
|
register. */
|
||||||
to_reloc_32 = !is_pic || baseless;
|
to_reloc_32 = !is_pic || baseless;
|
||||||
|
|
||||||
|
eh = elf_x86_hash_entry (h);
|
||||||
|
|
||||||
/* Try to convert R_386_GOT32X. Get the symbol referred to by the
|
/* Try to convert R_386_GOT32X. Get the symbol referred to by the
|
||||||
reloc. */
|
reloc. */
|
||||||
if (h == NULL)
|
if (h == NULL)
|
||||||
@ -1290,10 +1294,14 @@ elf_i386_convert_load_reloc (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
|
|||||||
goto convert_load;
|
goto convert_load;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* NB: Also set linker_def via SYMBOL_REFERENCES_LOCAL_P. */
|
||||||
|
local_ref = SYMBOL_REFERENCES_LOCAL_P (link_info, h);
|
||||||
|
|
||||||
/* Undefined weak symbol is only bound locally in executable
|
/* Undefined weak symbol is only bound locally in executable
|
||||||
and its reference is resolved as 0. */
|
and its reference is resolved as 0. */
|
||||||
if (UNDEFINED_WEAK_RESOLVED_TO_ZERO (link_info, I386_ELF_DATA, TRUE,
|
if (h->root.type == bfd_link_hash_undefweak
|
||||||
elf_x86_hash_entry (h)))
|
&& !eh->linker_def
|
||||||
|
&& local_ref)
|
||||||
{
|
{
|
||||||
if (opcode == 0xff)
|
if (opcode == 0xff)
|
||||||
{
|
{
|
||||||
@ -1316,16 +1324,13 @@ elf_i386_convert_load_reloc (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
|
|||||||
/* We have "call/jmp *foo@GOT[(%reg)]". */
|
/* We have "call/jmp *foo@GOT[(%reg)]". */
|
||||||
if ((h->root.type == bfd_link_hash_defined
|
if ((h->root.type == bfd_link_hash_defined
|
||||||
|| h->root.type == bfd_link_hash_defweak)
|
|| h->root.type == bfd_link_hash_defweak)
|
||||||
&& SYMBOL_REFERENCES_LOCAL_P (link_info, h))
|
&& local_ref)
|
||||||
{
|
{
|
||||||
/* The function is locally defined. */
|
/* The function is locally defined. */
|
||||||
convert_branch:
|
convert_branch:
|
||||||
/* Convert R_386_GOT32X to R_386_PC32. */
|
/* Convert R_386_GOT32X to R_386_PC32. */
|
||||||
if (modrm == 0x15 || (modrm & 0xf8) == 0x90)
|
if (modrm == 0x15 || (modrm & 0xf8) == 0x90)
|
||||||
{
|
{
|
||||||
struct elf_x86_link_hash_entry *eh
|
|
||||||
= (struct elf_x86_link_hash_entry *) h;
|
|
||||||
|
|
||||||
/* Convert to "nop call foo". ADDR_PREFIX_OPCODE
|
/* Convert to "nop call foo". ADDR_PREFIX_OPCODE
|
||||||
is a nop prefix. */
|
is a nop prefix. */
|
||||||
modrm = 0xe8;
|
modrm = 0xe8;
|
||||||
@ -1381,10 +1386,11 @@ convert_branch:
|
|||||||
bfd_elf_record_link_assignment. start_stop is set on
|
bfd_elf_record_link_assignment. start_stop is set on
|
||||||
__start_SECNAME/__stop_SECNAME which mark section SECNAME. */
|
__start_SECNAME/__stop_SECNAME which mark section SECNAME. */
|
||||||
if (h->start_stop
|
if (h->start_stop
|
||||||
|
|| eh->linker_def
|
||||||
|| ((h->def_regular
|
|| ((h->def_regular
|
||||||
|| h->root.type == bfd_link_hash_defined
|
|| h->root.type == bfd_link_hash_defined
|
||||||
|| h->root.type == bfd_link_hash_defweak)
|
|| h->root.type == bfd_link_hash_defweak)
|
||||||
&& SYMBOL_REFERENCES_LOCAL_P (link_info, h)))
|
&& local_ref))
|
||||||
{
|
{
|
||||||
convert_load:
|
convert_load:
|
||||||
if (opcode == 0x8b)
|
if (opcode == 0x8b)
|
||||||
|
@ -1537,11 +1537,15 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
|
|||||||
GOTPCRELX relocations since we need to modify REX byte.
|
GOTPCRELX relocations since we need to modify REX byte.
|
||||||
It is OK convert mov with R_X86_64_GOTPCREL to
|
It is OK convert mov with R_X86_64_GOTPCREL to
|
||||||
R_X86_64_PC32. */
|
R_X86_64_PC32. */
|
||||||
|
bfd_boolean local_ref;
|
||||||
|
struct elf_x86_link_hash_entry *eh = elf_x86_hash_entry (h);
|
||||||
|
|
||||||
|
/* NB: Also set linker_def via SYMBOL_REFERENCES_LOCAL_P. */
|
||||||
|
local_ref = SYMBOL_REFERENCES_LOCAL_P (link_info, h);
|
||||||
if ((relocx || opcode == 0x8b)
|
if ((relocx || opcode == 0x8b)
|
||||||
&& UNDEFINED_WEAK_RESOLVED_TO_ZERO (link_info,
|
&& (h->root.type == bfd_link_hash_undefweak
|
||||||
X86_64_ELF_DATA,
|
&& !eh->linker_def
|
||||||
TRUE,
|
&& local_ref))
|
||||||
elf_x86_hash_entry (h)))
|
|
||||||
{
|
{
|
||||||
if (opcode == 0xff)
|
if (opcode == 0xff)
|
||||||
{
|
{
|
||||||
@ -1568,11 +1572,12 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
|
|||||||
/* Avoid optimizing GOTPCREL relocations againt _DYNAMIC since
|
/* Avoid optimizing GOTPCREL relocations againt _DYNAMIC since
|
||||||
ld.so may use its link-time address. */
|
ld.so may use its link-time address. */
|
||||||
else if (h->start_stop
|
else if (h->start_stop
|
||||||
|
|| eh->linker_def
|
||||||
|| ((h->def_regular
|
|| ((h->def_regular
|
||||||
|| h->root.type == bfd_link_hash_defined
|
|| h->root.type == bfd_link_hash_defined
|
||||||
|| h->root.type == bfd_link_hash_defweak)
|
|| h->root.type == bfd_link_hash_defweak)
|
||||||
&& h != htab->elf.hdynamic
|
&& h != htab->elf.hdynamic
|
||||||
&& SYMBOL_REFERENCES_LOCAL_P (link_info, h)))
|
&& local_ref))
|
||||||
{
|
{
|
||||||
/* bfd_link_hash_new or bfd_link_hash_undefined is
|
/* bfd_link_hash_new or bfd_link_hash_undefined is
|
||||||
set by an assignment in a linker script in
|
set by an assignment in a linker script in
|
||||||
@ -1580,6 +1585,7 @@ elf_x86_64_convert_load_reloc (bfd *abfd,
|
|||||||
on __start_SECNAME/__stop_SECNAME which mark section
|
on __start_SECNAME/__stop_SECNAME which mark section
|
||||||
SECNAME. */
|
SECNAME. */
|
||||||
if (h->start_stop
|
if (h->start_stop
|
||||||
|
|| eh->linker_def
|
||||||
|| (h->def_regular
|
|| (h->def_regular
|
||||||
&& (h->root.type == bfd_link_hash_new
|
&& (h->root.type == bfd_link_hash_new
|
||||||
|| h->root.type == bfd_link_hash_undefined
|
|| h->root.type == bfd_link_hash_undefined
|
||||||
|
@ -845,12 +845,28 @@ _bfd_x86_elf_link_check_relocs (bfd *abfd, struct bfd_link_info *info)
|
|||||||
htab = elf_x86_hash_table (info, bed->target_id);
|
htab = elf_x86_hash_table (info, bed->target_id);
|
||||||
if (htab)
|
if (htab)
|
||||||
{
|
{
|
||||||
struct elf_link_hash_entry *h
|
struct elf_link_hash_entry *h;
|
||||||
= elf_link_hash_lookup (elf_hash_table (info),
|
|
||||||
|
h = elf_link_hash_lookup (elf_hash_table (info),
|
||||||
htab->tls_get_addr,
|
htab->tls_get_addr,
|
||||||
FALSE, FALSE, FALSE);
|
FALSE, FALSE, FALSE);
|
||||||
if (h != NULL)
|
if (h != NULL)
|
||||||
((struct elf_x86_link_hash_entry *) h)->tls_get_addr = 1;
|
elf_x86_hash_entry (h)->tls_get_addr = 1;
|
||||||
|
|
||||||
|
/* "__ehdr_start" will be defined by linker as a hidden symbol
|
||||||
|
later if it is referenced and not defined. */
|
||||||
|
h = elf_link_hash_lookup (elf_hash_table (info),
|
||||||
|
"__ehdr_start",
|
||||||
|
FALSE, FALSE, FALSE);
|
||||||
|
if (h != NULL
|
||||||
|
&& (h->root.type == bfd_link_hash_new
|
||||||
|
|| h->root.type == bfd_link_hash_undefined
|
||||||
|
|| h->root.type == bfd_link_hash_undefweak
|
||||||
|
|| h->root.type == bfd_link_hash_common))
|
||||||
|
{
|
||||||
|
elf_x86_hash_entry (h)->local_ref = 2;
|
||||||
|
elf_x86_hash_entry (h)->linker_def = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1671,8 +1687,9 @@ bfd_boolean
|
|||||||
_bfd_x86_elf_link_symbol_references_local (struct bfd_link_info *info,
|
_bfd_x86_elf_link_symbol_references_local (struct bfd_link_info *info,
|
||||||
struct elf_link_hash_entry *h)
|
struct elf_link_hash_entry *h)
|
||||||
{
|
{
|
||||||
struct elf_x86_link_hash_entry *eh
|
struct elf_x86_link_hash_entry *eh = elf_x86_hash_entry (h);
|
||||||
= (struct elf_x86_link_hash_entry *) h;
|
struct elf_x86_link_hash_table *htab
|
||||||
|
= (struct elf_x86_link_hash_table *) info->hash;
|
||||||
|
|
||||||
if (eh->local_ref > 1)
|
if (eh->local_ref > 1)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -1681,13 +1698,19 @@ _bfd_x86_elf_link_symbol_references_local (struct bfd_link_info *info,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Unversioned symbols defined in regular objects can be forced local
|
/* Unversioned symbols defined in regular objects can be forced local
|
||||||
by linker version script. A weak undefined symbol can fored local
|
by linker version script. A weak undefined symbol is forced local
|
||||||
if it has non-default visibility or "-z nodynamic-undefined-weak"
|
if
|
||||||
is used. */
|
1. It has non-default visibility. Or
|
||||||
|
2. When building executable, it has non-GOT/non-PLT relocations
|
||||||
|
in text section or there is no dynamic linker. Or
|
||||||
|
3. or "-z nodynamic-undefined-weak" is used.
|
||||||
|
*/
|
||||||
if (SYMBOL_REFERENCES_LOCAL (info, h)
|
if (SYMBOL_REFERENCES_LOCAL (info, h)
|
||||||
|| ((ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
|| (h->root.type == bfd_link_hash_undefweak
|
||||||
|| info->dynamic_undefined_weak == 0)
|
&& (ELF_ST_VISIBILITY (h->other) != STV_DEFAULT
|
||||||
&& h->root.type == bfd_link_hash_undefweak)
|
|| (bfd_link_executable (info)
|
||||||
|
&& (htab->interp == NULL || eh->has_non_got_reloc))
|
||||||
|
|| info->dynamic_undefined_weak == 0))
|
||||||
|| ((h->def_regular || ELF_COMMON_DEF_P (h))
|
|| ((h->def_regular || ELF_COMMON_DEF_P (h))
|
||||||
&& h->versioned == unversioned
|
&& h->versioned == unversioned
|
||||||
&& info->version_info != NULL
|
&& info->version_info != NULL
|
||||||
|
@ -108,6 +108,9 @@ struct elf_x86_link_hash_entry
|
|||||||
*/
|
*/
|
||||||
unsigned int local_ref : 2;
|
unsigned int local_ref : 2;
|
||||||
|
|
||||||
|
/* TRUE if symbol is defined by linker. */
|
||||||
|
unsigned int linker_def : 1;
|
||||||
|
|
||||||
/* Terue if symbol is referenced by R_386_GOTOFF relocation. This is
|
/* Terue if symbol is referenced by R_386_GOTOFF relocation. This is
|
||||||
only used by i386. */
|
only used by i386. */
|
||||||
unsigned int gotoff_ref : 1;
|
unsigned int gotoff_ref : 1;
|
||||||
|
20
ld/ChangeLog
20
ld/ChangeLog
@ -1,3 +1,23 @@
|
|||||||
|
2017-09-09 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
|
PR ld/22115
|
||||||
|
* ld-i386/i386.exp: Run PR ld/22115 tests,
|
||||||
|
* ld/testsuite/ld-x86-64/x86-64.exp: Likewise.
|
||||||
|
* testsuite/ld-i386/pr22115-1.s: New file.
|
||||||
|
* testsuite/ld-i386/pr22115-1a.d: Likewise.
|
||||||
|
* testsuite/ld-i386/pr22115-1b.d: Likewise.
|
||||||
|
* testsuite/ld-i386/pr22115-1c.d: Likewise.
|
||||||
|
* testsuite/ld-i386/pr22115-1d.d: Likewise.
|
||||||
|
* testsuite/ld-x86-64/pr22115-1.s: Likewise.
|
||||||
|
* testsuite/ld-x86-64/pr22115-1a-x32.d: Likewise.
|
||||||
|
* testsuite/ld-x86-64/pr22115-1a.d: Likewise.
|
||||||
|
* testsuite/ld-x86-64/pr22115-1b-x32.d: Likewise.
|
||||||
|
* testsuite/ld-x86-64/pr22115-1b.d: Likewise.
|
||||||
|
* testsuite/ld-x86-64/pr22115-1c-x32.d: Likewise.
|
||||||
|
* testsuite/ld-x86-64/pr22115-1c.d: Likewise.
|
||||||
|
* testsuite/ld-x86-64/pr22115-1d-x32.d: Likewise.
|
||||||
|
* testsuite/ld-x86-64/pr22115-1d.d: Likewise.
|
||||||
|
|
||||||
2017-09-06 H.J. Lu <hongjiu.lu@intel.com>
|
2017-09-06 H.J. Lu <hongjiu.lu@intel.com>
|
||||||
|
|
||||||
* testsuite/ld-x86-64/pr19609-2a.d: Updated.
|
* testsuite/ld-x86-64/pr19609-2a.d: Updated.
|
||||||
|
@ -440,6 +440,10 @@ run_dump_test "pie1"
|
|||||||
run_dump_test "pie1-nacl"
|
run_dump_test "pie1-nacl"
|
||||||
run_dump_test "pr21884"
|
run_dump_test "pr21884"
|
||||||
run_dump_test "pr21884-nacl"
|
run_dump_test "pr21884-nacl"
|
||||||
|
run_dump_test "pr22115-1a"
|
||||||
|
run_dump_test "pr22115-1b"
|
||||||
|
run_dump_test "pr22115-1c"
|
||||||
|
run_dump_test "pr22115-1d"
|
||||||
|
|
||||||
if { !([istarget "i?86-*-linux*"]
|
if { !([istarget "i?86-*-linux*"]
|
||||||
|| [istarget "i?86-*-gnu*"]
|
|| [istarget "i?86-*-gnu*"]
|
||||||
|
7
ld/testsuite/ld-i386/pr22115-1.s
Normal file
7
ld/testsuite/ld-i386/pr22115-1.s
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
.text
|
||||||
|
.globl _start
|
||||||
|
.type _start, @function
|
||||||
|
_start:
|
||||||
|
movl __ehdr_start@GOT(%eax), %eax
|
||||||
|
.size _start, .-_start
|
||||||
|
.weak __ehdr_start
|
13
ld/testsuite/ld-i386/pr22115-1a.d
Normal file
13
ld/testsuite/ld-i386/pr22115-1a.d
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --32 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf_i386
|
||||||
|
#objdump: -dw
|
||||||
|
|
||||||
|
.*: +file format .*
|
||||||
|
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
[a-f0-9]+ <_start>:
|
||||||
|
+[a-f0-9]+: 8d 80 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%eax\),%eax
|
||||||
|
#pass
|
6
ld/testsuite/ld-i386/pr22115-1b.d
Normal file
6
ld/testsuite/ld-i386/pr22115-1b.d
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --32 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf_i386
|
||||||
|
#readelf: -r
|
||||||
|
|
||||||
|
There are no relocations in this file.
|
13
ld/testsuite/ld-i386/pr22115-1c.d
Normal file
13
ld/testsuite/ld-i386/pr22115-1c.d
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --32 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf_i386 --no-dynamic-linker
|
||||||
|
#objdump: -dw
|
||||||
|
|
||||||
|
.*: +file format .*
|
||||||
|
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
[a-f0-9]+ <_start>:
|
||||||
|
+[a-f0-9]+: 8d 80 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%eax\),%eax
|
||||||
|
#pass
|
6
ld/testsuite/ld-i386/pr22115-1d.d
Normal file
6
ld/testsuite/ld-i386/pr22115-1d.d
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --32 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf_i386 --no-dynamic-linker
|
||||||
|
#readelf: -r
|
||||||
|
|
||||||
|
There are no relocations in this file.
|
7
ld/testsuite/ld-x86-64/pr22115-1.s
Normal file
7
ld/testsuite/ld-x86-64/pr22115-1.s
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
.text
|
||||||
|
.globl _start
|
||||||
|
.type _start, @function
|
||||||
|
_start:
|
||||||
|
movq __ehdr_start@GOTPCREL(%rip), %rax
|
||||||
|
.size _start, .-_start
|
||||||
|
.weak __ehdr_start
|
13
ld/testsuite/ld-x86-64/pr22115-1a-x32.d
Normal file
13
ld/testsuite/ld-x86-64/pr22115-1a-x32.d
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --x32 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf32_x86_64
|
||||||
|
#objdump: -dw
|
||||||
|
|
||||||
|
.*: +file format .*
|
||||||
|
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
[a-f0-9]+ <_start>:
|
||||||
|
+[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__ehdr_start>
|
||||||
|
#pass
|
13
ld/testsuite/ld-x86-64/pr22115-1a.d
Normal file
13
ld/testsuite/ld-x86-64/pr22115-1a.d
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --64 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf_x86_64
|
||||||
|
#objdump: -dw
|
||||||
|
|
||||||
|
.*: +file format .*
|
||||||
|
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
[a-f0-9]+ <_start>:
|
||||||
|
+[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__ehdr_start>
|
||||||
|
#pass
|
6
ld/testsuite/ld-x86-64/pr22115-1b-x32.d
Normal file
6
ld/testsuite/ld-x86-64/pr22115-1b-x32.d
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --x32 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf32_x86_64
|
||||||
|
#readelf: -r
|
||||||
|
|
||||||
|
There are no relocations in this file.
|
6
ld/testsuite/ld-x86-64/pr22115-1b.d
Normal file
6
ld/testsuite/ld-x86-64/pr22115-1b.d
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --64 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf_x86_64
|
||||||
|
#readelf: -r
|
||||||
|
|
||||||
|
There are no relocations in this file.
|
13
ld/testsuite/ld-x86-64/pr22115-1c-x32.d
Normal file
13
ld/testsuite/ld-x86-64/pr22115-1c-x32.d
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --x32 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf32_x86_64 --no-dynamic-linker
|
||||||
|
#objdump: -dw
|
||||||
|
|
||||||
|
.*: +file format .*
|
||||||
|
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
[a-f0-9]+ <_start>:
|
||||||
|
+[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__ehdr_start>
|
||||||
|
#pass
|
13
ld/testsuite/ld-x86-64/pr22115-1c.d
Normal file
13
ld/testsuite/ld-x86-64/pr22115-1c.d
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --64 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf_x86_64 --no-dynamic-linker
|
||||||
|
#objdump: -dw
|
||||||
|
|
||||||
|
.*: +file format .*
|
||||||
|
|
||||||
|
|
||||||
|
Disassembly of section .text:
|
||||||
|
|
||||||
|
[a-f0-9]+ <_start>:
|
||||||
|
+[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -?0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__ehdr_start>
|
||||||
|
#pass
|
6
ld/testsuite/ld-x86-64/pr22115-1d-x32.d
Normal file
6
ld/testsuite/ld-x86-64/pr22115-1d-x32.d
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --x32 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf32_x86_64 --no-dynamic-linker
|
||||||
|
#readelf: -r
|
||||||
|
|
||||||
|
There are no relocations in this file.
|
6
ld/testsuite/ld-x86-64/pr22115-1d.d
Normal file
6
ld/testsuite/ld-x86-64/pr22115-1d.d
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#source: pr22115-1.s
|
||||||
|
#as: --64 -mrelax-relocations=yes
|
||||||
|
#ld: -pie -z text -m elf_x86_64 --no-dynamic-linker
|
||||||
|
#readelf: -r
|
||||||
|
|
||||||
|
There are no relocations in this file.
|
@ -369,6 +369,14 @@ run_dump_test "property-x86-shstk5-x32"
|
|||||||
run_dump_test "pr21884"
|
run_dump_test "pr21884"
|
||||||
run_dump_test "pr21884-nacl"
|
run_dump_test "pr21884-nacl"
|
||||||
run_dump_test "pr22071"
|
run_dump_test "pr22071"
|
||||||
|
run_dump_test "pr22115-1a"
|
||||||
|
run_dump_test "pr22115-1a-x32"
|
||||||
|
run_dump_test "pr22115-1b"
|
||||||
|
run_dump_test "pr22115-1b-x32"
|
||||||
|
run_dump_test "pr22115-1c"
|
||||||
|
run_dump_test "pr22115-1c-x32"
|
||||||
|
run_dump_test "pr22115-1d"
|
||||||
|
run_dump_test "pr22115-1d-x32"
|
||||||
|
|
||||||
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
|
if { ![istarget "x86_64-*-linux*"] && ![istarget "x86_64-*-nacl*"]} {
|
||||||
return
|
return
|
||||||
|
Reference in New Issue
Block a user