forked from Imagelibrary/binutils-gdb
Compare commits
8 Commits
users/palv
...
users/hjl/
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e75d7310f | ||
|
|
4e0b303e49 | ||
|
|
29f90d5300 | ||
|
|
27ba297e10 | ||
|
|
42a1024d26 | ||
|
|
973751eab4 | ||
|
|
fd5c6c0c91 | ||
|
|
7fcc88b992 |
@@ -2341,6 +2341,9 @@ extern bfd_boolean bfd_elf_gc_common_final_link
|
||||
extern asection *_bfd_elf_is_start_stop
|
||||
(const struct bfd_link_info *, struct elf_link_hash_entry *);
|
||||
|
||||
extern void _bfd_elf_record_start_stop
|
||||
(struct bfd_link_info *);
|
||||
|
||||
extern bfd_boolean bfd_elf_reloc_symbol_deleted_p
|
||||
(bfd_vma, void *);
|
||||
|
||||
|
||||
737
bfd/elf32-i386.c
737
bfd/elf32-i386.c
@@ -1208,7 +1208,7 @@ elf_i386_copy_indirect_symbol (struct bfd_link_info *info,
|
||||
from R_TYPE. */
|
||||
|
||||
static bfd_boolean
|
||||
elf_i386_check_tls_transition (bfd *abfd, asection *sec,
|
||||
elf_i386_check_tls_transition (asection *sec,
|
||||
bfd_byte *contents,
|
||||
Elf_Internal_Shdr *symtab_hdr,
|
||||
struct elf_link_hash_entry **sym_hashes,
|
||||
@@ -1221,22 +1221,6 @@ elf_i386_check_tls_transition (bfd *abfd, asection *sec,
|
||||
struct elf_link_hash_entry *h;
|
||||
bfd_vma offset;
|
||||
|
||||
/* Get the section contents. */
|
||||
if (contents == NULL)
|
||||
{
|
||||
if (elf_section_data (sec)->this_hdr.contents != NULL)
|
||||
contents = elf_section_data (sec)->this_hdr.contents;
|
||||
else
|
||||
{
|
||||
/* FIXME: How to better handle error condition? */
|
||||
if (!bfd_malloc_and_get_section (abfd, sec, &contents))
|
||||
return FALSE;
|
||||
|
||||
/* Cache the section contents for elf_link_input_bfd. */
|
||||
elf_section_data (sec)->this_hdr.contents = contents;
|
||||
}
|
||||
}
|
||||
|
||||
offset = rel->r_offset;
|
||||
switch (r_type)
|
||||
{
|
||||
@@ -1397,7 +1381,8 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
const Elf_Internal_Rela *rel,
|
||||
const Elf_Internal_Rela *relend,
|
||||
struct elf_link_hash_entry *h,
|
||||
unsigned long r_symndx)
|
||||
unsigned long r_symndx,
|
||||
bfd_boolean from_relocate_section)
|
||||
{
|
||||
unsigned int from_type = *r_type;
|
||||
unsigned int to_type = from_type;
|
||||
@@ -1426,10 +1411,9 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
to_type = R_386_TLS_IE_32;
|
||||
}
|
||||
|
||||
/* When we are called from elf_i386_relocate_section, CONTENTS
|
||||
isn't NULL and there may be additional transitions based on
|
||||
TLS_TYPE. */
|
||||
if (contents != NULL)
|
||||
/* When we are called from elf_i386_relocate_section, there may
|
||||
be additional transitions based on TLS_TYPE. */
|
||||
if (from_relocate_section)
|
||||
{
|
||||
unsigned int new_to_type = to_type;
|
||||
|
||||
@@ -1473,7 +1457,7 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
|
||||
/* Check if the transition can be performed. */
|
||||
if (check
|
||||
&& ! elf_i386_check_tls_transition (abfd, sec, contents,
|
||||
&& ! elf_i386_check_tls_transition (sec, contents,
|
||||
symtab_hdr, sym_hashes,
|
||||
from_type, rel, relend))
|
||||
{
|
||||
@@ -1515,10 +1499,258 @@ elf_i386_tls_transition (struct bfd_link_info *info, bfd *abfd,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* With the local symbol, foo, we convert
|
||||
mov foo@GOT[(%reg1)], %reg2
|
||||
to
|
||||
lea foo[@GOTOFF(%reg1)], %reg2
|
||||
and convert
|
||||
call/jmp *foo@GOT[(%reg)]
|
||||
to
|
||||
nop call foo/jmp foo nop
|
||||
When PIC is false, convert
|
||||
test %reg1, foo@GOT[(%reg2)]
|
||||
to
|
||||
test $foo, %reg1
|
||||
and convert
|
||||
binop foo@GOT[(%reg1)], %reg2
|
||||
to
|
||||
binop $foo, %reg2
|
||||
where binop is one of adc, add, and, cmp, or, sbb, sub, xor
|
||||
instructions. */
|
||||
|
||||
static
|
||||
bfd_boolean
|
||||
elf_i386_convert_load_reloc (bfd *abfd, Elf_Internal_Shdr *symtab_hdr,
|
||||
bfd_byte *contents,
|
||||
Elf_Internal_Rela *irel,
|
||||
struct elf_link_hash_entry *h,
|
||||
bfd_boolean *converted,
|
||||
struct bfd_link_info *link_info)
|
||||
{
|
||||
struct elf_i386_link_hash_table *htab;
|
||||
unsigned int opcode;
|
||||
unsigned int modrm;
|
||||
bfd_boolean baseless;
|
||||
unsigned int addend;
|
||||
unsigned int nop;
|
||||
bfd_vma nop_offset;
|
||||
bfd_boolean is_pic;
|
||||
bfd_boolean to_reloc_32;
|
||||
unsigned int r_type;
|
||||
unsigned int r_symndx;
|
||||
bfd_vma roff = irel->r_offset;
|
||||
|
||||
if (roff < 2)
|
||||
return TRUE;
|
||||
|
||||
/* Addend for R_386_GOT32 and R_386_GOT32X relocations must be 0. */
|
||||
addend = bfd_get_32 (abfd, contents + roff);
|
||||
if (addend != 0)
|
||||
return TRUE;
|
||||
|
||||
htab = elf_i386_hash_table (link_info);
|
||||
is_pic = bfd_link_pic (link_info);
|
||||
|
||||
r_type = ELF32_R_TYPE (irel->r_info);
|
||||
r_symndx = ELF32_R_SYM (irel->r_info);
|
||||
|
||||
modrm = bfd_get_8 (abfd, contents + roff - 1);
|
||||
baseless = (modrm & 0xc7) == 0x5;
|
||||
|
||||
if (r_type == R_386_GOT32X && baseless && is_pic)
|
||||
{
|
||||
const char *name;
|
||||
|
||||
if (h == NULL)
|
||||
{
|
||||
Elf_Internal_Sym *isym
|
||||
= bfd_sym_from_r_symndx (&htab->sym_cache, abfd, r_symndx);
|
||||
name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
|
||||
}
|
||||
else
|
||||
name = h->root.root.string;
|
||||
|
||||
/* For PIC, disallow R_386_GOT32X without a base register since
|
||||
we don't know what the GOT base is. Allow R_386_GOT32 for
|
||||
existing object files. */
|
||||
(*_bfd_error_handler)
|
||||
(_("%B: direct GOT relocation R_386_GOT32X against `%s' without base register can not be used when making a shared object"),
|
||||
abfd, name);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
opcode = bfd_get_8 (abfd, contents + roff - 2);
|
||||
|
||||
/* Convert mov to lea since it has been done for a while. */
|
||||
if (opcode != 0x8b)
|
||||
{
|
||||
/* Only convert R_386_GOT32X relocation for call, jmp or
|
||||
one of adc, add, and, cmp, or, sbb, sub, test, xor
|
||||
instructions. */
|
||||
if (r_type != R_386_GOT32X)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Convert to R_386_32 if PIC is false or there is no base
|
||||
register. */
|
||||
to_reloc_32 = !is_pic || baseless;
|
||||
|
||||
/* Try to convert R_386_GOT32 and R_386_GOT32X. Get the symbol
|
||||
referred to by the reloc. */
|
||||
if (h == NULL)
|
||||
{
|
||||
if (opcode == 0x0ff)
|
||||
/* Convert "call/jmp *foo@GOT[(%reg)]". */
|
||||
goto convert_branch;
|
||||
else
|
||||
/* Convert "mov foo@GOT[(%reg1)], %reg2",
|
||||
"test %reg1, foo@GOT(%reg2)" and
|
||||
"binop foo@GOT[(%reg1)], %reg2". */
|
||||
goto convert_load;
|
||||
}
|
||||
|
||||
/* Undefined weak symbol is only bound locally in executable
|
||||
and its reference is resolved as 0. */
|
||||
if (UNDEFINED_WEAK_RESOLVED_TO_ZERO (link_info, TRUE,
|
||||
elf_i386_hash_entry (h)))
|
||||
{
|
||||
if (opcode == 0xff)
|
||||
{
|
||||
/* No direct branch to 0 for PIC. */
|
||||
if (is_pic)
|
||||
return TRUE;
|
||||
else
|
||||
goto convert_branch;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We can convert load of address 0 to R_386_32. */
|
||||
to_reloc_32 = TRUE;
|
||||
goto convert_load;
|
||||
}
|
||||
}
|
||||
|
||||
if (opcode == 0xff)
|
||||
{
|
||||
/* We have "call/jmp *foo@GOT[(%reg)]". */
|
||||
if ((h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
&& SYMBOL_REFERENCES_LOCAL (link_info, h))
|
||||
{
|
||||
/* The function is locally defined. */
|
||||
convert_branch:
|
||||
/* Convert R_386_GOT32X to R_386_PC32. */
|
||||
if (modrm == 0x15 || (modrm & 0xf8) == 0x90)
|
||||
{
|
||||
/* Convert to "nop call foo". ADDR_PREFIX_OPCODE
|
||||
is a nop prefix. */
|
||||
modrm = 0xe8;
|
||||
nop = link_info->call_nop_byte;
|
||||
if (link_info->call_nop_as_suffix)
|
||||
{
|
||||
nop_offset = roff + 3;
|
||||
irel->r_offset -= 1;
|
||||
}
|
||||
else
|
||||
nop_offset = roff - 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Convert to "jmp foo nop". */
|
||||
modrm = 0xe9;
|
||||
nop = NOP_OPCODE;
|
||||
nop_offset = roff + 3;
|
||||
irel->r_offset -= 1;
|
||||
}
|
||||
|
||||
bfd_put_8 (abfd, nop, contents + nop_offset);
|
||||
bfd_put_8 (abfd, modrm, contents + irel->r_offset - 1);
|
||||
/* When converting to PC-relative relocation, we
|
||||
need to adjust addend by -4. */
|
||||
bfd_put_32 (abfd, -4, contents + irel->r_offset);
|
||||
irel->r_info = ELF32_R_INFO (r_symndx, R_386_PC32);
|
||||
|
||||
*converted = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We have "mov foo@GOT[(%re1g)], %reg2",
|
||||
"test %reg1, foo@GOT(%reg2)" and
|
||||
"binop foo@GOT[(%reg1)], %reg2".
|
||||
|
||||
Avoid optimizing _DYNAMIC since ld.so may use its
|
||||
link-time address. */
|
||||
if (h == htab->elf.hdynamic)
|
||||
return TRUE;
|
||||
|
||||
/* def_regular is set by an assignment in a linker script in
|
||||
bfd_elf_record_link_assignment. */
|
||||
if ((h->def_regular
|
||||
|| h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
&& SYMBOL_REFERENCES_LOCAL (link_info, h))
|
||||
{
|
||||
convert_load:
|
||||
if (opcode == 0x8b)
|
||||
{
|
||||
if (to_reloc_32)
|
||||
{
|
||||
/* Convert "mov foo@GOT[(%reg1)], %reg2" to
|
||||
"mov $foo, %reg2" with R_386_32. */
|
||||
r_type = R_386_32;
|
||||
modrm = 0xc0 | (modrm & 0x38) >> 3;
|
||||
bfd_put_8 (abfd, modrm, contents + roff - 1);
|
||||
opcode = 0xc7;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Convert "mov foo@GOT(%reg1), %reg2" to
|
||||
"lea foo@GOTOFF(%reg1), %reg2". */
|
||||
r_type = R_386_GOTOFF;
|
||||
opcode = 0x8d;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Only R_386_32 is supported. */
|
||||
if (!to_reloc_32)
|
||||
return TRUE;
|
||||
|
||||
if (opcode == 0x85)
|
||||
{
|
||||
/* Convert "test %reg1, foo@GOT(%reg2)" to
|
||||
"test $foo, %reg1". */
|
||||
modrm = 0xc0 | (modrm & 0x38) >> 3;
|
||||
opcode = 0xf7;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Convert "binop foo@GOT(%reg1), %reg2" to
|
||||
"binop $foo, %reg2". */
|
||||
modrm = (0xc0
|
||||
| (modrm & 0x38) >> 3
|
||||
| (opcode & 0x3c));
|
||||
opcode = 0x81;
|
||||
}
|
||||
bfd_put_8 (abfd, modrm, contents + roff - 1);
|
||||
r_type = R_386_32;
|
||||
}
|
||||
|
||||
bfd_put_8 (abfd, opcode, contents + roff - 2);
|
||||
irel->r_info = ELF32_R_INFO (r_symndx, r_type);
|
||||
|
||||
*converted = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Rename some of the generic section flags to better document how they
|
||||
are used here. */
|
||||
#define need_convert_load sec_flg0
|
||||
#define check_relocs_failed sec_flg1
|
||||
#define check_relocs_failed sec_flg0
|
||||
|
||||
/* Look through the relocs for a section during the first phase, and
|
||||
calculate needed space in the global offset table, procedure linkage
|
||||
@@ -1536,7 +1768,9 @@ elf_i386_check_relocs (bfd *abfd,
|
||||
const Elf_Internal_Rela *rel;
|
||||
const Elf_Internal_Rela *rel_end;
|
||||
asection *sreloc;
|
||||
bfd_byte *contents;
|
||||
bfd_boolean use_plt_got;
|
||||
bfd_boolean changed;
|
||||
|
||||
if (bfd_link_relocatable (info))
|
||||
return TRUE;
|
||||
@@ -1550,6 +1784,15 @@ elf_i386_check_relocs (bfd *abfd,
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Get the section contents. */
|
||||
if (elf_section_data (sec)->this_hdr.contents != NULL)
|
||||
contents = elf_section_data (sec)->this_hdr.contents;
|
||||
else if (!bfd_malloc_and_get_section (abfd, sec, &contents))
|
||||
{
|
||||
sec->check_relocs_failed = 1;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
use_plt_got = (!get_elf_i386_backend_data (abfd)->is_vxworks
|
||||
&& (get_elf_i386_backend_data (abfd)
|
||||
== &elf_i386_arch_bed));
|
||||
@@ -1557,6 +1800,7 @@ elf_i386_check_relocs (bfd *abfd,
|
||||
symtab_hdr = &elf_symtab_hdr (abfd);
|
||||
sym_hashes = elf_sym_hashes (abfd);
|
||||
|
||||
changed = FALSE;
|
||||
sreloc = NULL;
|
||||
|
||||
rel_end = relocs + sec->reloc_count;
|
||||
@@ -1649,10 +1893,10 @@ elf_i386_check_relocs (bfd *abfd,
|
||||
|= elf_gnu_symbol_ifunc;
|
||||
}
|
||||
|
||||
if (! elf_i386_tls_transition (info, abfd, sec, NULL,
|
||||
if (! elf_i386_tls_transition (info, abfd, sec, contents,
|
||||
symtab_hdr, sym_hashes,
|
||||
&r_type, GOT_UNKNOWN,
|
||||
rel, rel_end, h, r_symndx))
|
||||
rel, rel_end, h, r_symndx, FALSE))
|
||||
goto error_return;
|
||||
|
||||
switch (r_type)
|
||||
@@ -1683,6 +1927,40 @@ elf_i386_check_relocs (bfd *abfd,
|
||||
size_reloc = TRUE;
|
||||
goto do_size;
|
||||
|
||||
case R_386_GOT32:
|
||||
case R_386_GOT32X:
|
||||
if (h == NULL || h->type != STT_GNU_IFUNC)
|
||||
{
|
||||
bfd_boolean converted = FALSE;
|
||||
|
||||
if (!elf_i386_convert_load_reloc (abfd, symtab_hdr,
|
||||
contents,
|
||||
(Elf_Internal_Rela *) rel,
|
||||
h, &converted, info))
|
||||
goto error_return;
|
||||
|
||||
if (converted)
|
||||
{
|
||||
changed = TRUE;
|
||||
r_type = ELF32_R_TYPE (rel->r_info);
|
||||
switch (r_type)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
break;
|
||||
case R_386_32:
|
||||
case R_386_PC32:
|
||||
break;
|
||||
case R_386_GOTOFF:
|
||||
if (eh != NULL)
|
||||
eh->gotoff_ref = 1;
|
||||
goto create_got;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
goto do_reloc_got32;
|
||||
|
||||
case R_386_TLS_IE_32:
|
||||
case R_386_TLS_IE:
|
||||
case R_386_TLS_GOTIE:
|
||||
@@ -1690,11 +1968,10 @@ elf_i386_check_relocs (bfd *abfd,
|
||||
info->flags |= DF_STATIC_TLS;
|
||||
/* Fall through */
|
||||
|
||||
case R_386_GOT32:
|
||||
case R_386_GOT32X:
|
||||
case R_386_TLS_GD:
|
||||
case R_386_TLS_GOTDESC:
|
||||
case R_386_TLS_DESC_CALL:
|
||||
do_reloc_got32:
|
||||
/* This symbol requires a global offset table entry. */
|
||||
{
|
||||
int tls_type, old_tls_type;
|
||||
@@ -2023,15 +2300,32 @@ do_size:
|
||||
plt_got_align))
|
||||
goto error_return;
|
||||
}
|
||||
}
|
||||
|
||||
if ((r_type == R_386_GOT32 || r_type == R_386_GOT32X)
|
||||
&& (h == NULL || h->type != STT_GNU_IFUNC))
|
||||
sec->need_convert_load = 1;
|
||||
if (elf_section_data (sec)->this_hdr.contents != contents)
|
||||
{
|
||||
if (!changed && !info->keep_memory)
|
||||
free (contents);
|
||||
else
|
||||
{
|
||||
/* Cache the section contents for elf_link_input_bfd. */
|
||||
elf_section_data (sec)->this_hdr.contents = contents;
|
||||
}
|
||||
}
|
||||
|
||||
if (elf_section_data (sec)->relocs != relocs && changed)
|
||||
{
|
||||
/* Must cache relocations if they are changed. */
|
||||
if (elf_section_data (sec)->relocs != NULL)
|
||||
abort ();
|
||||
elf_section_data (sec)->relocs = (Elf_Internal_Rela *) relocs;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
error_return:
|
||||
if (elf_section_data (sec)->this_hdr.contents != contents)
|
||||
free (contents);
|
||||
sec->check_relocs_failed = 1;
|
||||
return FALSE;
|
||||
}
|
||||
@@ -2711,377 +3005,6 @@ elf_i386_readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* With the local symbol, foo, we convert
|
||||
mov foo@GOT[(%reg1)], %reg2
|
||||
to
|
||||
lea foo[@GOTOFF(%reg1)], %reg2
|
||||
and convert
|
||||
call/jmp *foo@GOT[(%reg)]
|
||||
to
|
||||
nop call foo/jmp foo nop
|
||||
When PIC is false, convert
|
||||
test %reg1, foo@GOT[(%reg2)]
|
||||
to
|
||||
test $foo, %reg1
|
||||
and convert
|
||||
binop foo@GOT[(%reg1)], %reg2
|
||||
to
|
||||
binop $foo, %reg2
|
||||
where binop is one of adc, add, and, cmp, or, sbb, sub, xor
|
||||
instructions. */
|
||||
|
||||
static bfd_boolean
|
||||
elf_i386_convert_load (bfd *abfd, asection *sec,
|
||||
struct bfd_link_info *link_info)
|
||||
{
|
||||
Elf_Internal_Shdr *symtab_hdr;
|
||||
Elf_Internal_Rela *internal_relocs;
|
||||
Elf_Internal_Rela *irel, *irelend;
|
||||
bfd_byte *contents;
|
||||
struct elf_i386_link_hash_table *htab;
|
||||
bfd_boolean changed_contents;
|
||||
bfd_boolean changed_relocs;
|
||||
bfd_boolean is_pic;
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
|
||||
/* Don't even try to convert non-ELF outputs. */
|
||||
if (!is_elf_hash_table (link_info->hash))
|
||||
return FALSE;
|
||||
|
||||
/* Nothing to do if there is no need or no output. */
|
||||
if ((sec->flags & (SEC_CODE | SEC_RELOC)) != (SEC_CODE | SEC_RELOC)
|
||||
|| sec->need_convert_load == 0
|
||||
|| bfd_is_abs_section (sec->output_section))
|
||||
return TRUE;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
|
||||
/* Load the relocations for this section. */
|
||||
internal_relocs = (_bfd_elf_link_read_relocs
|
||||
(abfd, sec, NULL, (Elf_Internal_Rela *) NULL,
|
||||
link_info->keep_memory));
|
||||
if (internal_relocs == NULL)
|
||||
return FALSE;
|
||||
|
||||
htab = elf_i386_hash_table (link_info);
|
||||
changed_contents = FALSE;
|
||||
changed_relocs = FALSE;
|
||||
local_got_refcounts = elf_local_got_refcounts (abfd);
|
||||
|
||||
is_pic = bfd_link_pic (link_info);
|
||||
|
||||
/* Get the section contents. */
|
||||
if (elf_section_data (sec)->this_hdr.contents != NULL)
|
||||
contents = elf_section_data (sec)->this_hdr.contents;
|
||||
else
|
||||
{
|
||||
if (!bfd_malloc_and_get_section (abfd, sec, &contents))
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
irelend = internal_relocs + sec->reloc_count;
|
||||
for (irel = internal_relocs; irel < irelend; irel++)
|
||||
{
|
||||
unsigned int r_type = ELF32_R_TYPE (irel->r_info);
|
||||
unsigned int r_symndx = ELF32_R_SYM (irel->r_info);
|
||||
unsigned int indx;
|
||||
struct elf_link_hash_entry *h;
|
||||
unsigned int opcode;
|
||||
unsigned int modrm;
|
||||
bfd_vma roff;
|
||||
bfd_boolean baseless;
|
||||
Elf_Internal_Sym *isym;
|
||||
unsigned int addend;
|
||||
unsigned int nop;
|
||||
bfd_vma nop_offset;
|
||||
bfd_boolean to_reloc_32;
|
||||
|
||||
if (r_type != R_386_GOT32 && r_type != R_386_GOT32X)
|
||||
continue;
|
||||
|
||||
roff = irel->r_offset;
|
||||
if (roff < 2)
|
||||
continue;
|
||||
|
||||
/* Addend for R_386_GOT32 and R_386_GOT32X relocations must be 0. */
|
||||
addend = bfd_get_32 (abfd, contents + roff);
|
||||
if (addend != 0)
|
||||
continue;
|
||||
|
||||
modrm = bfd_get_8 (abfd, contents + roff - 1);
|
||||
baseless = (modrm & 0xc7) == 0x5;
|
||||
|
||||
if (r_type == R_386_GOT32X && baseless && is_pic)
|
||||
{
|
||||
/* For PIC, disallow R_386_GOT32X without a base register
|
||||
since we don't know what the GOT base is. Allow
|
||||
R_386_GOT32 for existing object files. */
|
||||
const char *name;
|
||||
|
||||
if (r_symndx < symtab_hdr->sh_info)
|
||||
{
|
||||
isym = bfd_sym_from_r_symndx (&htab->sym_cache, abfd,
|
||||
r_symndx);
|
||||
name = bfd_elf_sym_name (abfd, symtab_hdr, isym, NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
indx = r_symndx - symtab_hdr->sh_info;
|
||||
h = elf_sym_hashes (abfd)[indx];
|
||||
BFD_ASSERT (h != NULL);
|
||||
name = h->root.root.string;
|
||||
}
|
||||
|
||||
(*_bfd_error_handler)
|
||||
(_("%B: direct GOT relocation R_386_GOT32X against `%s' without base register can not be used when making a shared object"),
|
||||
abfd, name);
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
opcode = bfd_get_8 (abfd, contents + roff - 2);
|
||||
|
||||
/* Convert mov to lea since it has been done for a while. */
|
||||
if (opcode != 0x8b)
|
||||
{
|
||||
/* Only convert R_386_GOT32X relocation for call, jmp or
|
||||
one of adc, add, and, cmp, or, sbb, sub, test, xor
|
||||
instructions. */
|
||||
if (r_type != R_386_GOT32X)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Convert to R_386_32 if PIC is false or there is no base
|
||||
register. */
|
||||
to_reloc_32 = !is_pic || baseless;
|
||||
|
||||
/* Try to convert R_386_GOT32 and R_386_GOT32X. Get the symbol
|
||||
referred to by the reloc. */
|
||||
if (r_symndx < symtab_hdr->sh_info)
|
||||
{
|
||||
isym = bfd_sym_from_r_symndx (&htab->sym_cache,
|
||||
abfd, r_symndx);
|
||||
|
||||
/* STT_GNU_IFUNC must keep GOT32 relocations. */
|
||||
if (ELF_ST_TYPE (isym->st_info) == STT_GNU_IFUNC)
|
||||
continue;
|
||||
|
||||
h = NULL;
|
||||
if (opcode == 0x0ff)
|
||||
/* Convert "call/jmp *foo@GOT[(%reg)]". */
|
||||
goto convert_branch;
|
||||
else
|
||||
/* Convert "mov foo@GOT[(%reg1)], %reg2",
|
||||
"test %reg1, foo@GOT(%reg2)" and
|
||||
"binop foo@GOT[(%reg1)], %reg2". */
|
||||
goto convert_load;
|
||||
}
|
||||
|
||||
indx = r_symndx - symtab_hdr->sh_info;
|
||||
h = elf_sym_hashes (abfd)[indx];
|
||||
BFD_ASSERT (h != NULL);
|
||||
|
||||
while (h->root.type == bfd_link_hash_indirect
|
||||
|| h->root.type == bfd_link_hash_warning)
|
||||
h = (struct elf_link_hash_entry *) h->root.u.i.link;
|
||||
|
||||
/* STT_GNU_IFUNC must keep GOT32 relocations. */
|
||||
if (h->type == STT_GNU_IFUNC)
|
||||
continue;
|
||||
|
||||
/* Undefined weak symbol is only bound locally in executable
|
||||
and its reference is resolved as 0. */
|
||||
if (UNDEFINED_WEAK_RESOLVED_TO_ZERO (link_info, TRUE,
|
||||
elf_i386_hash_entry (h)))
|
||||
{
|
||||
if (opcode == 0xff)
|
||||
{
|
||||
/* No direct branch to 0 for PIC. */
|
||||
if (is_pic)
|
||||
continue;
|
||||
else
|
||||
goto convert_branch;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We can convert load of address 0 to R_386_32. */
|
||||
to_reloc_32 = TRUE;
|
||||
goto convert_load;
|
||||
}
|
||||
}
|
||||
|
||||
if (opcode == 0xff)
|
||||
{
|
||||
/* We have "call/jmp *foo@GOT[(%reg)]". */
|
||||
if ((h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
&& SYMBOL_REFERENCES_LOCAL (link_info, h))
|
||||
{
|
||||
/* The function is locally defined. */
|
||||
convert_branch:
|
||||
/* Convert R_386_GOT32X to R_386_PC32. */
|
||||
if (modrm == 0x15 || (modrm & 0xf8) == 0x90)
|
||||
{
|
||||
/* Convert to "nop call foo". ADDR_PREFIX_OPCODE
|
||||
is a nop prefix. */
|
||||
modrm = 0xe8;
|
||||
nop = link_info->call_nop_byte;
|
||||
if (link_info->call_nop_as_suffix)
|
||||
{
|
||||
nop_offset = roff + 3;
|
||||
irel->r_offset -= 1;
|
||||
}
|
||||
else
|
||||
nop_offset = roff - 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Convert to "jmp foo nop". */
|
||||
modrm = 0xe9;
|
||||
nop = NOP_OPCODE;
|
||||
nop_offset = roff + 3;
|
||||
irel->r_offset -= 1;
|
||||
}
|
||||
|
||||
bfd_put_8 (abfd, nop, contents + nop_offset);
|
||||
bfd_put_8 (abfd, modrm, contents + irel->r_offset - 1);
|
||||
/* When converting to PC-relative relocation, we
|
||||
need to adjust addend by -4. */
|
||||
bfd_put_32 (abfd, -4, contents + irel->r_offset);
|
||||
irel->r_info = ELF32_R_INFO (r_symndx, R_386_PC32);
|
||||
|
||||
if (h)
|
||||
{
|
||||
if (h->got.refcount > 0)
|
||||
h->got.refcount -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (local_got_refcounts != NULL
|
||||
&& local_got_refcounts[r_symndx] > 0)
|
||||
local_got_refcounts[r_symndx] -= 1;
|
||||
}
|
||||
|
||||
changed_contents = TRUE;
|
||||
changed_relocs = TRUE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We have "mov foo@GOT[(%re1g)], %reg2",
|
||||
"test %reg1, foo@GOT(%reg2)" and
|
||||
"binop foo@GOT[(%reg1)], %reg2".
|
||||
|
||||
Avoid optimizing _DYNAMIC since ld.so may use its
|
||||
link-time address. */
|
||||
if (h == htab->elf.hdynamic)
|
||||
continue;
|
||||
|
||||
/* def_regular is set by an assignment in a linker script in
|
||||
bfd_elf_record_link_assignment. */
|
||||
if ((h->def_regular
|
||||
|| h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
&& SYMBOL_REFERENCES_LOCAL (link_info, h))
|
||||
{
|
||||
convert_load:
|
||||
if (opcode == 0x8b)
|
||||
{
|
||||
if (to_reloc_32)
|
||||
{
|
||||
/* Convert "mov foo@GOT[(%reg1)], %reg2" to
|
||||
"mov $foo, %reg2" with R_386_32. */
|
||||
r_type = R_386_32;
|
||||
modrm = 0xc0 | (modrm & 0x38) >> 3;
|
||||
bfd_put_8 (abfd, modrm, contents + roff - 1);
|
||||
opcode = 0xc7;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Convert "mov foo@GOT(%reg1), %reg2" to
|
||||
"lea foo@GOTOFF(%reg1), %reg2". */
|
||||
r_type = R_386_GOTOFF;
|
||||
opcode = 0x8d;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Only R_386_32 is supported. */
|
||||
if (!to_reloc_32)
|
||||
continue;
|
||||
|
||||
if (opcode == 0x85)
|
||||
{
|
||||
/* Convert "test %reg1, foo@GOT(%reg2)" to
|
||||
"test $foo, %reg1". */
|
||||
modrm = 0xc0 | (modrm & 0x38) >> 3;
|
||||
opcode = 0xf7;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Convert "binop foo@GOT(%reg1), %reg2" to
|
||||
"binop $foo, %reg2". */
|
||||
modrm = (0xc0
|
||||
| (modrm & 0x38) >> 3
|
||||
| (opcode & 0x3c));
|
||||
opcode = 0x81;
|
||||
}
|
||||
bfd_put_8 (abfd, modrm, contents + roff - 1);
|
||||
r_type = R_386_32;
|
||||
}
|
||||
|
||||
bfd_put_8 (abfd, opcode, contents + roff - 2);
|
||||
irel->r_info = ELF32_R_INFO (r_symndx, r_type);
|
||||
|
||||
if (h)
|
||||
{
|
||||
if (h->got.refcount > 0)
|
||||
h->got.refcount -= 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (local_got_refcounts != NULL
|
||||
&& local_got_refcounts[r_symndx] > 0)
|
||||
local_got_refcounts[r_symndx] -= 1;
|
||||
}
|
||||
|
||||
changed_contents = TRUE;
|
||||
changed_relocs = TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (contents != NULL
|
||||
&& elf_section_data (sec)->this_hdr.contents != contents)
|
||||
{
|
||||
if (!changed_contents && !link_info->keep_memory)
|
||||
free (contents);
|
||||
else
|
||||
{
|
||||
/* Cache the section contents for elf_link_input_bfd. */
|
||||
elf_section_data (sec)->this_hdr.contents = contents;
|
||||
}
|
||||
}
|
||||
|
||||
if (elf_section_data (sec)->relocs != internal_relocs)
|
||||
{
|
||||
if (!changed_relocs)
|
||||
free (internal_relocs);
|
||||
else
|
||||
elf_section_data (sec)->relocs = internal_relocs;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
|
||||
error_return:
|
||||
if (contents != NULL
|
||||
&& elf_section_data (sec)->this_hdr.contents != contents)
|
||||
free (contents);
|
||||
if (internal_relocs != NULL
|
||||
&& elf_section_data (sec)->relocs != internal_relocs)
|
||||
free (internal_relocs);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Set the sizes of the dynamic sections. */
|
||||
|
||||
static bfd_boolean
|
||||
@@ -3119,9 +3042,6 @@ elf_i386_size_dynamic_sections (bfd *output_bfd, struct bfd_link_info *info)
|
||||
{
|
||||
struct elf_dyn_relocs *p;
|
||||
|
||||
if (!elf_i386_convert_load (ibfd, s, info))
|
||||
return FALSE;
|
||||
|
||||
for (p = ((struct elf_dyn_relocs *)
|
||||
elf_section_data (s)->local_dynrel);
|
||||
p != NULL;
|
||||
@@ -4356,7 +4276,7 @@ r_386_got32:
|
||||
input_section, contents,
|
||||
symtab_hdr, sym_hashes,
|
||||
&r_type, tls_type, rel,
|
||||
relend, h, r_symndx))
|
||||
relend, h, r_symndx, TRUE))
|
||||
return FALSE;
|
||||
|
||||
if (r_type == R_386_TLS_LE_32)
|
||||
@@ -4817,7 +4737,7 @@ r_386_got32:
|
||||
input_section, contents,
|
||||
symtab_hdr, sym_hashes,
|
||||
&r_type, GOT_UNKNOWN, rel,
|
||||
relend, h, r_symndx))
|
||||
relend, h, r_symndx, TRUE))
|
||||
return FALSE;
|
||||
|
||||
if (r_type != R_386_TLS_LDM)
|
||||
@@ -5818,6 +5738,7 @@ elf_i386_add_symbol_hook (bfd * abfd,
|
||||
#define elf_backend_got_header_size 12
|
||||
#define elf_backend_plt_alignment 4
|
||||
#define elf_backend_extern_protected_data 1
|
||||
#define elf_backend_caches_rawsize 1
|
||||
|
||||
/* Support RELA for objdump of prelink objects. */
|
||||
#define elf_info_to_howto elf_i386_info_to_howto_rel
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
127
bfd/elflink.c
127
bfd/elflink.c
@@ -13791,3 +13791,130 @@ elf_append_rel (bfd *abfd, asection *s, Elf_Internal_Rela *rel)
|
||||
BFD_ASSERT (loc + bed->s->sizeof_rel <= s->contents + s->size);
|
||||
bed->s->swap_reloc_out (abfd, rel, loc);
|
||||
}
|
||||
|
||||
/* A linked list of __start_<name> and __stop_<name> symbols */
|
||||
|
||||
struct start_stop_symbol
|
||||
{
|
||||
struct elf_link_hash_entry *h;
|
||||
const char *sec_name;
|
||||
struct start_stop_symbol *next;
|
||||
};
|
||||
|
||||
struct start_stop_symbol_info
|
||||
{
|
||||
struct start_stop_symbol *symbol_list;
|
||||
bfd_boolean failed;
|
||||
};
|
||||
|
||||
/* Collect __start_<name> and __stop_<name> symbols referenced by
|
||||
regular objects. This is called via elf_link_hash_traverse. */
|
||||
|
||||
static bfd_boolean
|
||||
elf_link_collect_start_stop (struct elf_link_hash_entry *h, void *data)
|
||||
{
|
||||
if (!h->def_regular && h->ref_regular)
|
||||
{
|
||||
struct start_stop_symbol_info *info;
|
||||
struct start_stop_symbol *p, **head;
|
||||
const char *sec_name = h->root.root.string;
|
||||
|
||||
if (sec_name[0] == '_'
|
||||
&& sec_name[1] == '_'
|
||||
&& sec_name[2] == 's'
|
||||
&& sec_name[3] == 't')
|
||||
sec_name += 4;
|
||||
else
|
||||
return TRUE;
|
||||
|
||||
if (sec_name[0] == 'a'
|
||||
&& sec_name[1] == 'r'
|
||||
&& sec_name[2] == 't')
|
||||
sec_name += 3;
|
||||
else if (sec_name[0] == 'o'
|
||||
&& sec_name[1] == 'p')
|
||||
sec_name += 2;
|
||||
else
|
||||
return TRUE;
|
||||
|
||||
if (sec_name[0] == '_' && sec_name[1] != '\0')
|
||||
sec_name += 1;
|
||||
else
|
||||
return TRUE;
|
||||
|
||||
info = (struct start_stop_symbol_info *) data;
|
||||
|
||||
p = (struct start_stop_symbol *) bfd_malloc (sizeof (*p));
|
||||
if (p == NULL)
|
||||
{
|
||||
info->failed = TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
head = &info->symbol_list;
|
||||
p->next = info->symbol_list;
|
||||
p->h = h;
|
||||
p->sec_name = sec_name;
|
||||
*head = p;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Record all __start_<name> and __stop_<name> symbols referenced by
|
||||
regular objects. */
|
||||
|
||||
void
|
||||
_bfd_elf_record_start_stop (struct bfd_link_info *info)
|
||||
{
|
||||
struct start_stop_symbol_info symbols;
|
||||
|
||||
/* Collect start/stop symbols. Assuming there are fewer start/stop
|
||||
symbols than input files, avoid scan over all input files for each
|
||||
start/stop symbol. */
|
||||
symbols.symbol_list = NULL;
|
||||
symbols.failed = FALSE;
|
||||
elf_link_hash_traverse (elf_hash_table (info),
|
||||
elf_link_collect_start_stop, &symbols);
|
||||
|
||||
if (symbols.failed)
|
||||
info->callbacks->einfo (_("%P%X: collect start/stop symbols: %E\n"));
|
||||
else if (symbols.symbol_list)
|
||||
{
|
||||
bfd *i;
|
||||
|
||||
for (i = info->input_bfds; i != NULL; i = i->link.next)
|
||||
if ((i->flags
|
||||
& (DYNAMIC | BFD_LINKER_CREATED | BFD_PLUGIN)) == 0)
|
||||
{
|
||||
/* Only check regular input files. */
|
||||
struct start_stop_symbol *p, **pp;
|
||||
|
||||
for (pp = &symbols.symbol_list; (p = *pp) != NULL; )
|
||||
if (bfd_get_section_by_name (i, p->sec_name) != NULL)
|
||||
{
|
||||
p->h->def_regular = 1;
|
||||
p->h->type = STT_OBJECT;
|
||||
/* If it is currently defined by a dynamic object, but
|
||||
not by a regular object, then mark it as undefined
|
||||
so that the generic linker will force the correct
|
||||
value. */
|
||||
if (p->h->def_dynamic)
|
||||
{
|
||||
p->h->root.type = bfd_link_hash_undefined;
|
||||
p->h->root.u.undef.abfd
|
||||
= p->h->root.u.def.section->owner;
|
||||
}
|
||||
|
||||
/* Remove this from the list. */
|
||||
*pp = p->next;
|
||||
free (p);
|
||||
}
|
||||
else
|
||||
pp = &p->next;
|
||||
|
||||
/* Stop when the list is empty. */
|
||||
if (symbols.symbol_list == NULL)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1554,6 +1554,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation = {
|
||||
NULL, /* recognized_file */
|
||||
NULL, /* find potential_libraries */
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -280,6 +280,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* recognized file */
|
||||
NULL, /* find_potential_libraries */
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -778,6 +778,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* recognized file */
|
||||
NULL, /* find_potential_libraries */
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -1330,6 +1330,7 @@ fragment <<EOF
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test x"$LDEMUL_DO_ASSIGNMENTS" != xgld"$EMULATION_NAME"_do_assignments; then
|
||||
fragment <<EOF
|
||||
|
||||
/* Look through an expression for an assignment statement. */
|
||||
@@ -1398,7 +1399,83 @@ gld${EMULATION_NAME}_find_statement_assignment (lang_statement_union_type *s)
|
||||
gld${EMULATION_NAME}_find_exp_assignment (s->assignment_statement.exp);
|
||||
}
|
||||
|
||||
static struct elf_link_hash_entry *ehdr_start;
|
||||
static struct bfd_link_hash_entry ehdr_start_save;
|
||||
|
||||
static void
|
||||
gld${EMULATION_NAME}_do_assignments (void)
|
||||
{
|
||||
if (is_elf_hash_table (link_info.hash))
|
||||
{
|
||||
/* If we are going to make any variable assignments, we need to
|
||||
let the ELF backend know about them in case the variables are
|
||||
referred to by dynamic objects. */
|
||||
lang_for_each_statement (gld${EMULATION_NAME}_find_statement_assignment);
|
||||
|
||||
/* Also let the ELF backend know about __start_<name> and
|
||||
__stop_<name> symbols. */
|
||||
_bfd_elf_record_start_stop (&link_info);
|
||||
|
||||
/* Make __ehdr_start hidden if it has been referenced, to
|
||||
prevent the symbol from being dynamic. */
|
||||
if (!bfd_link_relocatable (&link_info))
|
||||
{
|
||||
struct elf_link_hash_entry *h
|
||||
= elf_link_hash_lookup (elf_hash_table (&link_info),
|
||||
"__ehdr_start", FALSE, FALSE, TRUE);
|
||||
|
||||
/* Only adjust the export class if the symbol was referenced
|
||||
and not defined, otherwise leave it alone. def_regular is
|
||||
set by the ELF backend if __ehdr_start is defined in linker
|
||||
script. */
|
||||
if (h != NULL
|
||||
&& !h->def_regular
|
||||
&& (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))
|
||||
{
|
||||
_bfd_elf_link_hash_hide_symbol (&link_info, h, TRUE);
|
||||
if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
|
||||
h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
|
||||
/* Don't leave the symbol undefined. Undefined hidden
|
||||
symbols typically won't have dynamic relocations, but
|
||||
we most likely will need dynamic relocations for
|
||||
__ehdr_start if we are building a PIE or shared
|
||||
library. */
|
||||
ehdr_start = h;
|
||||
ehdr_start_save = h->root;
|
||||
h->root.type = bfd_link_hash_defined;
|
||||
h->root.u.def.section = bfd_abs_section_ptr;
|
||||
h->root.u.def.value = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gld${EMULATION_NAME}_restore_ehdr_start (void)
|
||||
{
|
||||
if (ehdr_start != NULL)
|
||||
{
|
||||
/* If we twiddled __ehdr_start to defined earlier, put it back
|
||||
as it was. */
|
||||
ehdr_start->root.type = ehdr_start_save.type;
|
||||
ehdr_start->root.u = ehdr_start_save.u;
|
||||
}
|
||||
}
|
||||
|
||||
EOF
|
||||
else
|
||||
fragment <<EOF
|
||||
|
||||
static
|
||||
gld${EMULATION_NAME}_restore_ehdr_start (void)
|
||||
{
|
||||
}
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
if test x"$LDEMUL_BEFORE_ALLOCATION" != xgld"$EMULATION_NAME"_before_allocation; then
|
||||
if test x"${ELF_INTERPRETER_NAME+set}" = xset; then
|
||||
@@ -1455,11 +1532,6 @@ gld${EMULATION_NAME}_append_to_separated_string (char **to, char *op_arg)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && GCC_VERSION < 4006
|
||||
/* Work around a GCC uninitialized warning bug fixed in GCC 4.6. */
|
||||
static struct bfd_link_hash_entry ehdr_start_empty;
|
||||
#endif
|
||||
|
||||
/* This is called after the sections have been attached to output
|
||||
sections, but before any sizes or addresses have been set. */
|
||||
|
||||
@@ -1469,55 +1541,9 @@ gld${EMULATION_NAME}_before_allocation (void)
|
||||
const char *rpath;
|
||||
asection *sinterp;
|
||||
bfd *abfd;
|
||||
struct elf_link_hash_entry *ehdr_start = NULL;
|
||||
#if defined(__GNUC__) && GCC_VERSION < 4006
|
||||
/* Work around a GCC uninitialized warning bug fixed in GCC 4.6. */
|
||||
struct bfd_link_hash_entry ehdr_start_save = ehdr_start_empty;
|
||||
#else
|
||||
struct bfd_link_hash_entry ehdr_start_save;
|
||||
#endif
|
||||
|
||||
if (is_elf_hash_table (link_info.hash))
|
||||
{
|
||||
_bfd_elf_tls_setup (link_info.output_bfd, &link_info);
|
||||
|
||||
/* Make __ehdr_start hidden if it has been referenced, to
|
||||
prevent the symbol from being dynamic. */
|
||||
if (!bfd_link_relocatable (&link_info))
|
||||
{
|
||||
struct elf_link_hash_entry *h
|
||||
= elf_link_hash_lookup (elf_hash_table (&link_info), "__ehdr_start",
|
||||
FALSE, FALSE, TRUE);
|
||||
|
||||
/* Only adjust the export class if the symbol was referenced
|
||||
and not defined, otherwise leave it alone. */
|
||||
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))
|
||||
{
|
||||
_bfd_elf_link_hash_hide_symbol (&link_info, h, TRUE);
|
||||
if (ELF_ST_VISIBILITY (h->other) != STV_INTERNAL)
|
||||
h->other = (h->other & ~ELF_ST_VISIBILITY (-1)) | STV_HIDDEN;
|
||||
/* Don't leave the symbol undefined. Undefined hidden
|
||||
symbols typically won't have dynamic relocations, but
|
||||
we most likely will need dynamic relocations for
|
||||
__ehdr_start if we are building a PIE or shared
|
||||
library. */
|
||||
ehdr_start = h;
|
||||
ehdr_start_save = h->root;
|
||||
h->root.type = bfd_link_hash_defined;
|
||||
h->root.u.def.section = bfd_abs_section_ptr;
|
||||
h->root.u.def.value = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we are going to make any variable assignments, we need to
|
||||
let the ELF backend know about them in case the variables are
|
||||
referred to by dynamic objects. */
|
||||
lang_for_each_statement (gld${EMULATION_NAME}_find_statement_assignment);
|
||||
}
|
||||
_bfd_elf_tls_setup (link_info.output_bfd, &link_info);
|
||||
|
||||
/* Let the ELF backend work out the sizes of any sections required
|
||||
by dynamic linking. */
|
||||
@@ -1627,13 +1653,7 @@ ${ELF_INTERPRETER_SET_DEFAULT}
|
||||
if (!bfd_elf_size_dynsym_hash_dynstr (link_info.output_bfd, &link_info))
|
||||
einfo ("%P%F: failed to set dynamic section sizes: %E\n");
|
||||
|
||||
if (ehdr_start != NULL)
|
||||
{
|
||||
/* If we twiddled __ehdr_start to defined earlier, put it back
|
||||
as it was. */
|
||||
ehdr_start->root.type = ehdr_start_save.type;
|
||||
ehdr_start->root.u = ehdr_start_save.u;
|
||||
}
|
||||
gld${EMULATION_NAME}_restore_ehdr_start ();
|
||||
}
|
||||
|
||||
EOF
|
||||
@@ -2527,6 +2547,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
${LDEMUL_RECOGNIZED_FILE-gld${EMULATION_NAME}_load_symbols},
|
||||
${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
|
||||
${LDEMUL_NEW_VERS_PATTERN-NULL},
|
||||
${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL}
|
||||
${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
|
||||
${LDEMUL_DO_ASSIGNMENTS-gld${EMULATION_NAME}_do_assignments},
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -156,6 +156,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
${LDEMUL_RECOGNIZED_FILE-NULL},
|
||||
${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
|
||||
${LDEMUL_NEW_VERS_PATTERN-NULL},
|
||||
${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL}
|
||||
${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
|
||||
${LDEMUL_DO_ASSIGNMENTS-NULL}
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -149,6 +149,7 @@ struct ld_emulation_xfer_struct ld_gld960_emulation =
|
||||
NULL, /* recognized file */
|
||||
NULL, /* find_potential_libraries */
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -162,6 +162,7 @@ struct ld_emulation_xfer_struct ld_gld960coff_emulation =
|
||||
NULL, /* recognized file */
|
||||
NULL, /* find_potential_libraries */
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -206,6 +206,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* recognized file */
|
||||
NULL, /* find_potential_libraries */
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -343,6 +343,7 @@ struct ld_emulation_xfer_struct ld_lnk960_emulation =
|
||||
NULL, /* recognized file */
|
||||
NULL, /* find_potential_libraries */
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -240,6 +240,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* recognized file */
|
||||
NULL, /* find_potential_libraries */
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -295,7 +295,8 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
${LDEMUL_RECOGNIZED_FILE-NULL},
|
||||
${LDEMUL_FIND_POTENTIAL_LIBRARIES-NULL},
|
||||
${LDEMUL_NEW_VERS_PATTERN-NULL},
|
||||
${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL}
|
||||
${LDEMUL_EXTRA_MAP_FILE_TEXT-NULL},
|
||||
${LDEMUL_DO_ASSIGNMENTS-NULL}
|
||||
};
|
||||
EOF
|
||||
#
|
||||
|
||||
@@ -2483,6 +2483,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
gld_${EMULATION_NAME}_recognized_file,
|
||||
gld_${EMULATION_NAME}_find_potential_libraries,
|
||||
NULL, /* new_vers_pattern. */
|
||||
NULL /* extra_map_file_text. */
|
||||
NULL, /* extra_map_file_text. */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -2257,6 +2257,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
gld_${EMULATION_NAME}_recognized_file,
|
||||
gld_${EMULATION_NAME}_find_potential_libraries,
|
||||
NULL, /* new_vers_pattern. */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -1036,6 +1036,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* recognized file */
|
||||
NULL, /* find_potential_libraries */
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -181,6 +181,7 @@ struct ld_emulation_xfer_struct ld_${EMULATION_NAME}_emulation =
|
||||
NULL, /* recognized file */
|
||||
NULL, /* find_potential_libraries */
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -82,6 +82,7 @@ struct ld_emulation_xfer_struct ld_vanilla_emulation =
|
||||
NULL, /* recognized file */
|
||||
NULL, /* find_potential_libraries */
|
||||
NULL, /* new_vers_pattern */
|
||||
NULL /* extra_map_file_text */
|
||||
NULL, /* extra_map_file_text */
|
||||
NULL /* do_assignments */
|
||||
};
|
||||
EOF
|
||||
|
||||
@@ -355,3 +355,10 @@ ldemul_extra_map_file_text (bfd *abfd, struct bfd_link_info *info, FILE *mapf)
|
||||
if (ld_emulation->extra_map_file_text)
|
||||
ld_emulation->extra_map_file_text (abfd, info, mapf);
|
||||
}
|
||||
|
||||
void
|
||||
ldemul_do_assignments (void)
|
||||
{
|
||||
if (ld_emulation->do_assignments)
|
||||
ld_emulation->do_assignments ();
|
||||
}
|
||||
|
||||
@@ -96,6 +96,8 @@ extern struct bfd_elf_version_expr *ldemul_new_vers_pattern
|
||||
(struct bfd_elf_version_expr *);
|
||||
extern void ldemul_extra_map_file_text
|
||||
(bfd *, struct bfd_link_info *, FILE *);
|
||||
extern void ldemul_do_assignments
|
||||
(void);
|
||||
|
||||
typedef struct ld_emulation_xfer_struct {
|
||||
/* Run before parsing the command line and script file.
|
||||
@@ -201,6 +203,10 @@ typedef struct ld_emulation_xfer_struct {
|
||||
void (*extra_map_file_text)
|
||||
(bfd *, struct bfd_link_info *, FILE *);
|
||||
|
||||
/* Called to do assignments. */
|
||||
void (*do_assignments)
|
||||
(void);
|
||||
|
||||
} ld_emulation_xfer_type;
|
||||
|
||||
typedef enum {
|
||||
|
||||
@@ -5760,6 +5760,8 @@ lang_do_assignments (lang_phase_type phase)
|
||||
prefer_next_section = FALSE;
|
||||
expld.phase = phase;
|
||||
lang_statement_iteration++;
|
||||
if (phase == lang_mark_phase_enum)
|
||||
ldemul_do_assignments ();
|
||||
lang_do_assignments_1 (statement_list.head,
|
||||
abs_output_section, NULL, 0, &found_end);
|
||||
}
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
#as: --32
|
||||
#ld: -melf_i386 -T discarded1.t
|
||||
#error: .*discarded output section: `.got.plt'
|
||||
#objdump: --sym -dw
|
||||
|
||||
.*: +file format .*
|
||||
|
||||
SYMBOL TABLE:
|
||||
#...
|
||||
0+8 g O .data 0+4 x
|
||||
#...
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0+ <_start>:
|
||||
[ ]*[a-f0-9]+: c7 c0 08 00 00 00 mov \$0x8,%eax
|
||||
#pass
|
||||
|
||||
@@ -8,52 +8,52 @@
|
||||
|
||||
SYMBOL TABLE:
|
||||
#...
|
||||
10030080 l O .data 0+1 bar
|
||||
10030074 l O .data 0+1 bar
|
||||
#...
|
||||
10030081 g O .data 0+1 foo
|
||||
10030075 g O .data 0+1 foo
|
||||
#...
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0+20000 <_start>:
|
||||
[ ]*[a-f0-9]+: c7 c0 80 00 03 10 mov \$0x10030080,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 80 00 03 10 adc \$0x10030080,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 80 00 03 10 add \$0x10030080,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 80 00 03 10 and \$0x10030080,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 80 00 03 10 cmp \$0x10030080,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 80 00 03 10 or \$0x10030080,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 80 00 03 10 sbb \$0x10030080,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 80 00 03 10 sub \$0x10030080,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 80 00 03 10 xor \$0x10030080,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 80 00 03 10 test \$0x10030080,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 80 00 03 10 mov \$0x10030080,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 80 00 03 10 adc \$0x10030080,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 80 00 03 10 add \$0x10030080,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 80 00 03 10 and \$0x10030080,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 80 00 03 10 cmp \$0x10030080,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 80 00 03 10 or \$0x10030080,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 80 00 03 10 sbb \$0x10030080,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 80 00 03 10 sub \$0x10030080,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 80 00 03 10 xor \$0x10030080,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 80 00 03 10 test \$0x10030080,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 81 00 03 10 mov \$0x10030081,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 81 00 03 10 adc \$0x10030081,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 81 00 03 10 add \$0x10030081,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 81 00 03 10 and \$0x10030081,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 81 00 03 10 cmp \$0x10030081,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 81 00 03 10 or \$0x10030081,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 81 00 03 10 sbb \$0x10030081,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 81 00 03 10 sub \$0x10030081,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 81 00 03 10 xor \$0x10030081,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 81 00 03 10 test \$0x10030081,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 81 00 03 10 mov \$0x10030081,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 81 00 03 10 adc \$0x10030081,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 81 00 03 10 add \$0x10030081,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 81 00 03 10 and \$0x10030081,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 81 00 03 10 cmp \$0x10030081,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 81 00 03 10 or \$0x10030081,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 81 00 03 10 sbb \$0x10030081,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 81 00 03 10 sub \$0x10030081,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 81 00 03 10 xor \$0x10030081,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 81 00 03 10 test \$0x10030081,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 74 00 03 10 mov \$0x10030074,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 74 00 03 10 adc \$0x10030074,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 74 00 03 10 add \$0x10030074,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 74 00 03 10 and \$0x10030074,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 74 00 03 10 cmp \$0x10030074,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 74 00 03 10 or \$0x10030074,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 74 00 03 10 sbb \$0x10030074,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 74 00 03 10 sub \$0x10030074,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 74 00 03 10 xor \$0x10030074,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 74 00 03 10 test \$0x10030074,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 74 00 03 10 mov \$0x10030074,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 74 00 03 10 adc \$0x10030074,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 74 00 03 10 add \$0x10030074,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 74 00 03 10 and \$0x10030074,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 74 00 03 10 cmp \$0x10030074,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 74 00 03 10 or \$0x10030074,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 74 00 03 10 sbb \$0x10030074,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 74 00 03 10 sub \$0x10030074,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 74 00 03 10 xor \$0x10030074,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 74 00 03 10 test \$0x10030074,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 75 00 03 10 mov \$0x10030075,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 75 00 03 10 adc \$0x10030075,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 75 00 03 10 add \$0x10030075,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 75 00 03 10 and \$0x10030075,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 75 00 03 10 cmp \$0x10030075,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 75 00 03 10 or \$0x10030075,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 75 00 03 10 sbb \$0x10030075,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 75 00 03 10 sub \$0x10030075,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 75 00 03 10 xor \$0x10030075,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 75 00 03 10 test \$0x10030075,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 75 00 03 10 mov \$0x10030075,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 75 00 03 10 adc \$0x10030075,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 75 00 03 10 add \$0x10030075,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 75 00 03 10 and \$0x10030075,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 75 00 03 10 cmp \$0x10030075,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 75 00 03 10 or \$0x10030075,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 75 00 03 10 sbb \$0x10030075,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 75 00 03 10 sub \$0x10030075,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 75 00 03 10 xor \$0x10030075,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 75 00 03 10 test \$0x10030075,%ecx
|
||||
#pass
|
||||
|
||||
@@ -7,52 +7,52 @@
|
||||
|
||||
SYMBOL TABLE:
|
||||
#...
|
||||
0+8049170 l O .data 0+1 bar
|
||||
0+8049164 l O .data 0+1 bar
|
||||
#...
|
||||
0+8049171 g O .data 0+1 foo
|
||||
0+8049165 g O .data 0+1 foo
|
||||
#...
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0+8048074 <_start>:
|
||||
[ ]*[a-f0-9]+: c7 c0 70 91 04 08 mov \$0x8049170,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 70 91 04 08 adc \$0x8049170,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 70 91 04 08 add \$0x8049170,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 70 91 04 08 and \$0x8049170,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 70 91 04 08 cmp \$0x8049170,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 70 91 04 08 or \$0x8049170,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 70 91 04 08 sbb \$0x8049170,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 70 91 04 08 sub \$0x8049170,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 70 91 04 08 xor \$0x8049170,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 70 91 04 08 test \$0x8049170,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 70 91 04 08 mov \$0x8049170,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 70 91 04 08 adc \$0x8049170,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 70 91 04 08 add \$0x8049170,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 70 91 04 08 and \$0x8049170,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 70 91 04 08 cmp \$0x8049170,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 70 91 04 08 or \$0x8049170,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 70 91 04 08 sbb \$0x8049170,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 70 91 04 08 sub \$0x8049170,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 70 91 04 08 xor \$0x8049170,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 70 91 04 08 test \$0x8049170,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 71 91 04 08 mov \$0x8049171,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 71 91 04 08 adc \$0x8049171,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 71 91 04 08 add \$0x8049171,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 71 91 04 08 and \$0x8049171,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 71 91 04 08 cmp \$0x8049171,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 71 91 04 08 or \$0x8049171,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 71 91 04 08 sbb \$0x8049171,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 71 91 04 08 sub \$0x8049171,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 71 91 04 08 xor \$0x8049171,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 71 91 04 08 test \$0x8049171,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 71 91 04 08 mov \$0x8049171,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 71 91 04 08 adc \$0x8049171,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 71 91 04 08 add \$0x8049171,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 71 91 04 08 and \$0x8049171,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 71 91 04 08 cmp \$0x8049171,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 71 91 04 08 or \$0x8049171,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 71 91 04 08 sbb \$0x8049171,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 71 91 04 08 sub \$0x8049171,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 71 91 04 08 xor \$0x8049171,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 71 91 04 08 test \$0x8049171,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 64 91 04 08 mov \$0x8049164,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 64 91 04 08 adc \$0x8049164,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 64 91 04 08 add \$0x8049164,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 64 91 04 08 and \$0x8049164,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 64 91 04 08 cmp \$0x8049164,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 64 91 04 08 or \$0x8049164,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 64 91 04 08 sbb \$0x8049164,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 64 91 04 08 sub \$0x8049164,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 64 91 04 08 xor \$0x8049164,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 64 91 04 08 test \$0x8049164,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 64 91 04 08 mov \$0x8049164,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 64 91 04 08 adc \$0x8049164,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 64 91 04 08 add \$0x8049164,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 64 91 04 08 and \$0x8049164,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 64 91 04 08 cmp \$0x8049164,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 64 91 04 08 or \$0x8049164,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 64 91 04 08 sbb \$0x8049164,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 64 91 04 08 sub \$0x8049164,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 64 91 04 08 xor \$0x8049164,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 64 91 04 08 test \$0x8049164,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 65 91 04 08 mov \$0x8049165,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 65 91 04 08 adc \$0x8049165,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 65 91 04 08 add \$0x8049165,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 65 91 04 08 and \$0x8049165,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 65 91 04 08 cmp \$0x8049165,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 65 91 04 08 or \$0x8049165,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 65 91 04 08 sbb \$0x8049165,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 65 91 04 08 sub \$0x8049165,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 65 91 04 08 xor \$0x8049165,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 65 91 04 08 test \$0x8049165,%ecx
|
||||
[ ]*[a-f0-9]+: c7 c0 65 91 04 08 mov \$0x8049165,%eax
|
||||
[ ]*[a-f0-9]+: 81 d0 65 91 04 08 adc \$0x8049165,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 65 91 04 08 add \$0x8049165,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 65 91 04 08 and \$0x8049165,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 65 91 04 08 cmp \$0x8049165,%edx
|
||||
[ ]*[a-f0-9]+: 81 cf 65 91 04 08 or \$0x8049165,%edi
|
||||
[ ]*[a-f0-9]+: 81 de 65 91 04 08 sbb \$0x8049165,%esi
|
||||
[ ]*[a-f0-9]+: 81 ed 65 91 04 08 sub \$0x8049165,%ebp
|
||||
[ ]*[a-f0-9]+: 81 f4 65 91 04 08 xor \$0x8049165,%esp
|
||||
[ ]*[a-f0-9]+: f7 c1 65 91 04 08 test \$0x8049165,%ecx
|
||||
#pass
|
||||
|
||||
@@ -1,3 +1,16 @@
|
||||
#as: --64
|
||||
#ld: -melf_x86_64 -T discarded1.t
|
||||
#error: .*discarded output section: `.got.plt'
|
||||
#objdump: --sym -dw
|
||||
|
||||
.*: +file format .*
|
||||
|
||||
SYMBOL TABLE:
|
||||
#...
|
||||
0+8 g O .data 0+4 x
|
||||
#...
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0+ <_start>:
|
||||
[ ]*[a-f0-9]+: 48 c7 c0 08 00 00 00 mov \$0x8,%rax
|
||||
#pass
|
||||
|
||||
@@ -8,48 +8,48 @@
|
||||
|
||||
SYMBOL TABLE:
|
||||
#...
|
||||
0+100300c8 l O .data 0+1 bar
|
||||
0+100300b0 l O .data 0+1 bar
|
||||
#...
|
||||
0+100300c9 g O .data 0+1 foo
|
||||
0+100300b1 g O .data 0+1 foo
|
||||
#...
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0+20000 <_start>:
|
||||
[ ]*[a-f0-9]+: 81 d0 c8 00 03 10 adc \$0x100300c8,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 c8 00 03 10 add \$0x100300c8,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 c8 00 03 10 and \$0x100300c8,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa c8 00 03 10 cmp \$0x100300c8,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce c8 00 03 10 or \$0x100300c8,%esi
|
||||
[ ]*[a-f0-9]+: 81 df c8 00 03 10 sbb \$0x100300c8,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed c8 00 03 10 sub \$0x100300c8,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 c8 00 03 10 xor \$0x100300c8,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 c8 00 03 10 test \$0x100300c8,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 c8 00 03 10 adc \$0x100300c8,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 c8 00 03 10 add \$0x100300c8,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 c8 00 03 10 and \$0x100300c8,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa c8 00 03 10 cmp \$0x100300c8,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf c8 00 03 10 or \$0x100300c8,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de c8 00 03 10 sbb \$0x100300c8,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed c8 00 03 10 sub \$0x100300c8,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 c8 00 03 10 xor \$0x100300c8,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 c8 00 03 10 test \$0x100300c8,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 c9 00 03 10 adc \$0x100300c9,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 c9 00 03 10 add \$0x100300c9,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 c9 00 03 10 and \$0x100300c9,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa c9 00 03 10 cmp \$0x100300c9,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce c9 00 03 10 or \$0x100300c9,%esi
|
||||
[ ]*[a-f0-9]+: 81 df c9 00 03 10 sbb \$0x100300c9,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed c9 00 03 10 sub \$0x100300c9,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 c9 00 03 10 xor \$0x100300c9,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 c9 00 03 10 test \$0x100300c9,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 c9 00 03 10 adc \$0x100300c9,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 c9 00 03 10 add \$0x100300c9,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 c9 00 03 10 and \$0x100300c9,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa c9 00 03 10 cmp \$0x100300c9,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf c9 00 03 10 or \$0x100300c9,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de c9 00 03 10 sbb \$0x100300c9,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed c9 00 03 10 sub \$0x100300c9,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 c9 00 03 10 xor \$0x100300c9,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 c9 00 03 10 test \$0x100300c9,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 b0 00 03 10 adc \$0x100300b0,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 b0 00 03 10 add \$0x100300b0,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 b0 00 03 10 and \$0x100300b0,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa b0 00 03 10 cmp \$0x100300b0,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce b0 00 03 10 or \$0x100300b0,%esi
|
||||
[ ]*[a-f0-9]+: 81 df b0 00 03 10 sbb \$0x100300b0,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed b0 00 03 10 sub \$0x100300b0,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 b0 00 03 10 xor \$0x100300b0,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 b0 00 03 10 test \$0x100300b0,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 b0 00 03 10 adc \$0x100300b0,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 b0 00 03 10 add \$0x100300b0,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 b0 00 03 10 and \$0x100300b0,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa b0 00 03 10 cmp \$0x100300b0,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf b0 00 03 10 or \$0x100300b0,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de b0 00 03 10 sbb \$0x100300b0,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed b0 00 03 10 sub \$0x100300b0,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 b0 00 03 10 xor \$0x100300b0,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 b0 00 03 10 test \$0x100300b0,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 b1 00 03 10 adc \$0x100300b1,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 b1 00 03 10 add \$0x100300b1,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 b1 00 03 10 and \$0x100300b1,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa b1 00 03 10 cmp \$0x100300b1,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce b1 00 03 10 or \$0x100300b1,%esi
|
||||
[ ]*[a-f0-9]+: 81 df b1 00 03 10 sbb \$0x100300b1,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed b1 00 03 10 sub \$0x100300b1,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 b1 00 03 10 xor \$0x100300b1,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 b1 00 03 10 test \$0x100300b1,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 b1 00 03 10 adc \$0x100300b1,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 b1 00 03 10 add \$0x100300b1,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 b1 00 03 10 and \$0x100300b1,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa b1 00 03 10 cmp \$0x100300b1,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf b1 00 03 10 or \$0x100300b1,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de b1 00 03 10 sbb \$0x100300b1,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed b1 00 03 10 sub \$0x100300b1,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 b1 00 03 10 xor \$0x100300b1,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 b1 00 03 10 test \$0x100300b1,%r15
|
||||
#pass
|
||||
|
||||
@@ -8,48 +8,48 @@
|
||||
|
||||
SYMBOL TABLE:
|
||||
#...
|
||||
0+6001b8 l O .data 0+1 bar
|
||||
0+60019e l O .data 0+1 bar
|
||||
#...
|
||||
0+6001b9 g O .data 0+1 foo
|
||||
0+60019f g O .data 0+1 foo
|
||||
#...
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0+4000b0 <_start>:
|
||||
[ ]*[a-f0-9]+: 81 d0 b8 01 60 00 adc \$0x6001b8,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 b8 01 60 00 add \$0x6001b8,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 b8 01 60 00 and \$0x6001b8,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa b8 01 60 00 cmp \$0x6001b8,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce b8 01 60 00 or \$0x6001b8,%esi
|
||||
[ ]*[a-f0-9]+: 81 df b8 01 60 00 sbb \$0x6001b8,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed b8 01 60 00 sub \$0x6001b8,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 b8 01 60 00 xor \$0x6001b8,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 b8 01 60 00 test \$0x6001b8,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 b8 01 60 00 adc \$0x6001b8,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 b8 01 60 00 add \$0x6001b8,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 b8 01 60 00 and \$0x6001b8,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa b8 01 60 00 cmp \$0x6001b8,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf b8 01 60 00 or \$0x6001b8,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de b8 01 60 00 sbb \$0x6001b8,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed b8 01 60 00 sub \$0x6001b8,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 b8 01 60 00 xor \$0x6001b8,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 b8 01 60 00 test \$0x6001b8,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 b9 01 60 00 adc \$0x6001b9,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 b9 01 60 00 add \$0x6001b9,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 b9 01 60 00 and \$0x6001b9,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa b9 01 60 00 cmp \$0x6001b9,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce b9 01 60 00 or \$0x6001b9,%esi
|
||||
[ ]*[a-f0-9]+: 81 df b9 01 60 00 sbb \$0x6001b9,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed b9 01 60 00 sub \$0x6001b9,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 b9 01 60 00 xor \$0x6001b9,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 b9 01 60 00 test \$0x6001b9,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 b9 01 60 00 adc \$0x6001b9,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 b9 01 60 00 add \$0x6001b9,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 b9 01 60 00 and \$0x6001b9,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa b9 01 60 00 cmp \$0x6001b9,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf b9 01 60 00 or \$0x6001b9,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de b9 01 60 00 sbb \$0x6001b9,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed b9 01 60 00 sub \$0x6001b9,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 b9 01 60 00 xor \$0x6001b9,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 b9 01 60 00 test \$0x6001b9,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 9e 01 60 00 adc \$0x60019e,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 9e 01 60 00 add \$0x60019e,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 9e 01 60 00 and \$0x60019e,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 9e 01 60 00 cmp \$0x60019e,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce 9e 01 60 00 or \$0x60019e,%esi
|
||||
[ ]*[a-f0-9]+: 81 df 9e 01 60 00 sbb \$0x60019e,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed 9e 01 60 00 sub \$0x60019e,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 9e 01 60 00 xor \$0x60019e,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 9e 01 60 00 test \$0x60019e,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 9e 01 60 00 adc \$0x60019e,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 9e 01 60 00 add \$0x60019e,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 9e 01 60 00 and \$0x60019e,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa 9e 01 60 00 cmp \$0x60019e,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf 9e 01 60 00 or \$0x60019e,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de 9e 01 60 00 sbb \$0x60019e,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed 9e 01 60 00 sub \$0x60019e,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 9e 01 60 00 xor \$0x60019e,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 9e 01 60 00 test \$0x60019e,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 9f 01 60 00 adc \$0x60019f,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 9f 01 60 00 add \$0x60019f,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 9f 01 60 00 and \$0x60019f,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 9f 01 60 00 cmp \$0x60019f,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce 9f 01 60 00 or \$0x60019f,%esi
|
||||
[ ]*[a-f0-9]+: 81 df 9f 01 60 00 sbb \$0x60019f,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed 9f 01 60 00 sub \$0x60019f,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 9f 01 60 00 xor \$0x60019f,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 9f 01 60 00 test \$0x60019f,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 9f 01 60 00 adc \$0x60019f,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 9f 01 60 00 add \$0x60019f,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 9f 01 60 00 and \$0x60019f,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa 9f 01 60 00 cmp \$0x60019f,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf 9f 01 60 00 or \$0x60019f,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de 9f 01 60 00 sbb \$0x60019f,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed 9f 01 60 00 sub \$0x60019f,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 9f 01 60 00 xor \$0x60019f,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 9f 01 60 00 test \$0x60019f,%r15
|
||||
#pass
|
||||
|
||||
@@ -8,48 +8,48 @@
|
||||
|
||||
SYMBOL TABLE:
|
||||
#...
|
||||
1003008c l O .data 0+1 bar
|
||||
10030074 l O .data 0+1 bar
|
||||
#...
|
||||
1003008d g O .data 0+1 foo
|
||||
10030075 g O .data 0+1 foo
|
||||
#...
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0+20000 <_start>:
|
||||
[ ]*[a-f0-9]+: 81 d0 8c 00 03 10 adc \$0x1003008c,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 8c 00 03 10 add \$0x1003008c,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 8c 00 03 10 and \$0x1003008c,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 8c 00 03 10 cmp \$0x1003008c,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce 8c 00 03 10 or \$0x1003008c,%esi
|
||||
[ ]*[a-f0-9]+: 81 df 8c 00 03 10 sbb \$0x1003008c,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed 8c 00 03 10 sub \$0x1003008c,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 8c 00 03 10 xor \$0x1003008c,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 8c 00 03 10 test \$0x1003008c,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 8c 00 03 10 adc \$0x1003008c,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 8c 00 03 10 add \$0x1003008c,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 8c 00 03 10 and \$0x1003008c,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa 8c 00 03 10 cmp \$0x1003008c,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf 8c 00 03 10 or \$0x1003008c,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de 8c 00 03 10 sbb \$0x1003008c,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed 8c 00 03 10 sub \$0x1003008c,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 8c 00 03 10 xor \$0x1003008c,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 8c 00 03 10 test \$0x1003008c,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 8d 00 03 10 adc \$0x1003008d,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 8d 00 03 10 add \$0x1003008d,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 8d 00 03 10 and \$0x1003008d,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 8d 00 03 10 cmp \$0x1003008d,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce 8d 00 03 10 or \$0x1003008d,%esi
|
||||
[ ]*[a-f0-9]+: 81 df 8d 00 03 10 sbb \$0x1003008d,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed 8d 00 03 10 sub \$0x1003008d,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 8d 00 03 10 xor \$0x1003008d,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 8d 00 03 10 test \$0x1003008d,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 8d 00 03 10 adc \$0x1003008d,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 8d 00 03 10 add \$0x1003008d,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 8d 00 03 10 and \$0x1003008d,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa 8d 00 03 10 cmp \$0x1003008d,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf 8d 00 03 10 or \$0x1003008d,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de 8d 00 03 10 sbb \$0x1003008d,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed 8d 00 03 10 sub \$0x1003008d,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 8d 00 03 10 xor \$0x1003008d,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 8d 00 03 10 test \$0x1003008d,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 74 00 03 10 adc \$0x10030074,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 74 00 03 10 add \$0x10030074,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 74 00 03 10 and \$0x10030074,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 74 00 03 10 cmp \$0x10030074,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce 74 00 03 10 or \$0x10030074,%esi
|
||||
[ ]*[a-f0-9]+: 81 df 74 00 03 10 sbb \$0x10030074,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed 74 00 03 10 sub \$0x10030074,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 74 00 03 10 xor \$0x10030074,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 74 00 03 10 test \$0x10030074,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 74 00 03 10 adc \$0x10030074,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 74 00 03 10 add \$0x10030074,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 74 00 03 10 and \$0x10030074,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa 74 00 03 10 cmp \$0x10030074,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf 74 00 03 10 or \$0x10030074,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de 74 00 03 10 sbb \$0x10030074,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed 74 00 03 10 sub \$0x10030074,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 74 00 03 10 xor \$0x10030074,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 74 00 03 10 test \$0x10030074,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 75 00 03 10 adc \$0x10030075,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 75 00 03 10 add \$0x10030075,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 75 00 03 10 and \$0x10030075,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 75 00 03 10 cmp \$0x10030075,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce 75 00 03 10 or \$0x10030075,%esi
|
||||
[ ]*[a-f0-9]+: 81 df 75 00 03 10 sbb \$0x10030075,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed 75 00 03 10 sub \$0x10030075,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 75 00 03 10 xor \$0x10030075,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 75 00 03 10 test \$0x10030075,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 75 00 03 10 adc \$0x10030075,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 75 00 03 10 add \$0x10030075,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 75 00 03 10 and \$0x10030075,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa 75 00 03 10 cmp \$0x10030075,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf 75 00 03 10 or \$0x10030075,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de 75 00 03 10 sbb \$0x10030075,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed 75 00 03 10 sub \$0x10030075,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 75 00 03 10 xor \$0x10030075,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 75 00 03 10 test \$0x10030075,%r15
|
||||
#pass
|
||||
|
||||
@@ -8,49 +8,49 @@
|
||||
|
||||
SYMBOL TABLE:
|
||||
#...
|
||||
0+60017c l O .data 0+1 bar
|
||||
0+600162 l O .data 0+1 bar
|
||||
#...
|
||||
0+60017d g O .data 0+1 foo
|
||||
0+600163 g O .data 0+1 foo
|
||||
#...
|
||||
|
||||
|
||||
Disassembly of section .text:
|
||||
|
||||
0+400074 <_start>:
|
||||
[ ]*[a-f0-9]+: 81 d0 7c 01 60 00 adc \$0x60017c,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 7c 01 60 00 add \$0x60017c,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 7c 01 60 00 and \$0x60017c,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 7c 01 60 00 cmp \$0x60017c,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce 7c 01 60 00 or \$0x60017c,%esi
|
||||
[ ]*[a-f0-9]+: 81 df 7c 01 60 00 sbb \$0x60017c,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed 7c 01 60 00 sub \$0x60017c,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 7c 01 60 00 xor \$0x60017c,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 7c 01 60 00 test \$0x60017c,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 7c 01 60 00 adc \$0x60017c,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 7c 01 60 00 add \$0x60017c,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 7c 01 60 00 and \$0x60017c,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa 7c 01 60 00 cmp \$0x60017c,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf 7c 01 60 00 or \$0x60017c,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de 7c 01 60 00 sbb \$0x60017c,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed 7c 01 60 00 sub \$0x60017c,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 7c 01 60 00 xor \$0x60017c,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 7c 01 60 00 test \$0x60017c,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 7d 01 60 00 adc \$0x60017d,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 7d 01 60 00 add \$0x60017d,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 7d 01 60 00 and \$0x60017d,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 7d 01 60 00 cmp \$0x60017d,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce 7d 01 60 00 or \$0x60017d,%esi
|
||||
[ ]*[a-f0-9]+: 81 df 7d 01 60 00 sbb \$0x60017d,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed 7d 01 60 00 sub \$0x60017d,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 7d 01 60 00 xor \$0x60017d,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 7d 01 60 00 test \$0x60017d,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 7d 01 60 00 adc \$0x60017d,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 7d 01 60 00 add \$0x60017d,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 7d 01 60 00 and \$0x60017d,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa 7d 01 60 00 cmp \$0x60017d,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf 7d 01 60 00 or \$0x60017d,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de 7d 01 60 00 sbb \$0x60017d,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed 7d 01 60 00 sub \$0x60017d,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 7d 01 60 00 xor \$0x60017d,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 7d 01 60 00 test \$0x60017d,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 62 01 60 00 adc \$0x600162,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 62 01 60 00 add \$0x600162,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 62 01 60 00 and \$0x600162,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 62 01 60 00 cmp \$0x600162,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce 62 01 60 00 or \$0x600162,%esi
|
||||
[ ]*[a-f0-9]+: 81 df 62 01 60 00 sbb \$0x600162,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed 62 01 60 00 sub \$0x600162,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 62 01 60 00 xor \$0x600162,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 62 01 60 00 test \$0x600162,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 62 01 60 00 adc \$0x600162,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 62 01 60 00 add \$0x600162,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 62 01 60 00 and \$0x600162,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa 62 01 60 00 cmp \$0x600162,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf 62 01 60 00 or \$0x600162,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de 62 01 60 00 sbb \$0x600162,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed 62 01 60 00 sub \$0x600162,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 62 01 60 00 xor \$0x600162,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 62 01 60 00 test \$0x600162,%r15
|
||||
[ ]*[a-f0-9]+: 81 d0 63 01 60 00 adc \$0x600163,%eax
|
||||
[ ]*[a-f0-9]+: 81 c3 63 01 60 00 add \$0x600163,%ebx
|
||||
[ ]*[a-f0-9]+: 81 e1 63 01 60 00 and \$0x600163,%ecx
|
||||
[ ]*[a-f0-9]+: 81 fa 63 01 60 00 cmp \$0x600163,%edx
|
||||
[ ]*[a-f0-9]+: 81 ce 63 01 60 00 or \$0x600163,%esi
|
||||
[ ]*[a-f0-9]+: 81 df 63 01 60 00 sbb \$0x600163,%edi
|
||||
[ ]*[a-f0-9]+: 81 ed 63 01 60 00 sub \$0x600163,%ebp
|
||||
[ ]*[a-f0-9]+: 41 81 f0 63 01 60 00 xor \$0x600163,%r8d
|
||||
[ ]*[a-f0-9]+: 41 f7 c7 63 01 60 00 test \$0x600163,%r15d
|
||||
[ ]*[a-f0-9]+: 48 81 d0 63 01 60 00 adc \$0x600163,%rax
|
||||
[ ]*[a-f0-9]+: 48 81 c3 63 01 60 00 add \$0x600163,%rbx
|
||||
[ ]*[a-f0-9]+: 48 81 e1 63 01 60 00 and \$0x600163,%rcx
|
||||
[ ]*[a-f0-9]+: 48 81 fa 63 01 60 00 cmp \$0x600163,%rdx
|
||||
[ ]*[a-f0-9]+: 48 81 cf 63 01 60 00 or \$0x600163,%rdi
|
||||
[ ]*[a-f0-9]+: 48 81 de 63 01 60 00 sbb \$0x600163,%rsi
|
||||
[ ]*[a-f0-9]+: 48 81 ed 63 01 60 00 sub \$0x600163,%rbp
|
||||
[ ]*[a-f0-9]+: 49 81 f0 63 01 60 00 xor \$0x600163,%r8
|
||||
[ ]*[a-f0-9]+: 49 f7 c7 63 01 60 00 test \$0x600163,%r15
|
||||
#pass
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#as: --64
|
||||
#ld: -melf_x86_64 -shared -z max-page-size=0x200000
|
||||
#ld: -melf_x86_64 -shared -z max-page-size=0x200000 --no-relax
|
||||
#objdump: -dw
|
||||
|
||||
.*: +file format .*
|
||||
|
||||
Reference in New Issue
Block a user