diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-10-26 06:10:23 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-10-26 06:10:38 -0700 |
commit | e99717784e628eb85c8495952c1dec562586b0f1 (patch) | |
tree | 7788d394f792445417c99d64830895c12d2ed7a2 | |
parent | 48ffa2b8cd986527a41654c3b27755bbf6762048 (diff) | |
download | binutils-gdb-e99717784e628eb85c8495952c1dec562586b0f1.tar.gz |
Properly convert address load of __start_XXX/__stop_XXX
Since __start_XXX and __stop_XXX symbols aren't defined when address
load is being converted, we need to check if there is an XXX output
section to get their section and value. This patch adds a new function,
bfd_link_get_defined_symbol, to search for the XXX output section to
check if __start_XXX and __stop_XXX symbols are defined.
bfd/
PR ld/19171
* elf32-i386.c (elf_i386_convert_load): Call
bfd_link_get_defined_symbol to check if a symbol is defined.
* elf64-x86-64.c (elf_x86_64_convert_load): Call
bfd_link_get_defined_symbol to get defined symbol section and
value.
* linker.c (bfd_link_get_defined_symbol): New function.
* bfd-in2.h: Regenerated.
ld/testsuite/
PR ld/19171
* ld-i386/lea1.s: Add tests for address load of __start_XXX
and __stop_XXX.
* ld-i386/mov1.s: Likewise.
* ld-x86-64/lea1.s: Likewise.
* ld-x86-64/mov1.s: Likewise.
* ld-i386/lea1a.d: Updated.
* ld-i386/lea1b.d: Likewise.
* ld-i386/lea1c.d: Likewise.
* ld-i386/mov1a.d: Likewise.
* ld-i386/mov1b.d: Likewise.
* ld-x86-64/lea1a.d: Likewise.
* ld-x86-64/lea1b.d: Likewise.
* ld-x86-64/lea1c.d: Likewise.
* ld-x86-64/lea1d.d: Likewise.
* ld-x86-64/lea1e.d: Likewise.
* ld-x86-64/lea1f.d: Likewise.
* ld-x86-64/mov1a.d: Likewise.
* ld-x86-64/mov1b.d: Likewise.
* ld-x86-64/mov1c.d: Likewise.
* ld-x86-64/mov1d.d: Likewise.
-rw-r--r-- | bfd/ChangeLog | 11 | ||||
-rw-r--r-- | bfd/bfd-in2.h | 4 | ||||
-rw-r--r-- | bfd/elf32-i386.c | 8 | ||||
-rw-r--r-- | bfd/elf64-x86-64.c | 14 | ||||
-rw-r--r-- | bfd/linker.c | 57 | ||||
-rw-r--r-- | ld/testsuite/ChangeLog | 24 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea1.s | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea1a.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea1b.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/lea1c.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/mov1.s | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/mov1a.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-i386/mov1b.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/lea1.s | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/lea1a.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/lea1b.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/lea1c.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/lea1d.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/lea1e.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/lea1f.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/mov1.s | 4 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/mov1a.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/mov1b.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/mov1c.d | 2 | ||||
-rw-r--r-- | ld/testsuite/ld-x86-64/mov1d.d | 2 |
25 files changed, 154 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 19723d25af7..c838043d808 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,14 @@ +2015-10-26 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/19171 + * elf32-i386.c (elf_i386_convert_load): Call + bfd_link_get_defined_symbol to check if a symbol is defined. + * elf64-x86-64.c (elf_x86_64_convert_load): Call + bfd_link_get_defined_symbol to get defined symbol section and + value. + * linker.c (bfd_link_get_defined_symbol): New function. + * bfd-in2.h: Regenerated. + 2015-10-23 Alan Modra <amodra@gmail.com> PR ld/11133 diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h index 9345e8846c4..c39fadf681c 100644 --- a/bfd/bfd-in2.h +++ b/bfd/bfd-in2.h @@ -7515,6 +7515,10 @@ struct bfd_elf_version_tree * bfd_find_version_for_sym bfd_boolean bfd_hide_sym_by_version (struct bfd_elf_version_tree *verdefs, const char *sym_name); +bfd_boolean bfd_link_get_defined_symbol + (bfd *output_bfd, struct bfd_link_hash_entry *h, + asection **sec, bfd_vma *value); + /* Extracted from simple.c. */ bfd_byte *bfd_simple_get_relocated_section_contents (bfd *abfd, asection *sec, bfd_byte *outbuf, asymbol **symbol_table); diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index 60cd91a665d..5987767e0f6 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2753,7 +2753,7 @@ elf_i386_readonly_dynrelocs (struct elf_link_hash_entry *h, void *inf) static bfd_boolean elf_i386_convert_load (bfd *abfd, asection *sec, - struct bfd_link_info *link_info) + struct bfd_link_info *link_info) { Elf_Internal_Shdr *symtab_hdr; Elf_Internal_Rela *internal_relocs; @@ -2967,6 +2967,9 @@ convert_branch: } else { + asection *tsec; + bfd_vma toff; + /* We have "mov foo@GOT[(%re1g)], %reg2", "test %reg1, foo@GOT(%reg2)" and "binop foo@GOT[(%reg1)], %reg2". @@ -2976,8 +2979,7 @@ convert_branch: if (h == htab->elf.hdynamic) continue; - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) + if (bfd_link_get_defined_symbol (abfd, &h->root, &tsec, &toff) && SYMBOL_REFERENCES_LOCAL (link_info, h)) { convert_load: diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index f864834d250..269bce5cd78 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3116,6 +3116,8 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec, } else { + bfd_boolean defined; + indx = r_symndx - symtab_hdr->sh_info; h = elf_sym_hashes (abfd)[indx]; BFD_ASSERT (h != NULL); @@ -3124,19 +3126,17 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec, || h->root.type == bfd_link_hash_warning) h = (struct elf_link_hash_entry *) h->root.u.i.link; + defined = bfd_link_get_defined_symbol (abfd, &h->root, + &tsec, &toff); + /* STT_GNU_IFUNC must keep GOTPCREL relocations. We also avoid optimizing GOTPCREL relocations againt _DYNAMIC since ld.so may use its link-time address. */ - if ((h->root.type == bfd_link_hash_defined - || h->root.type == bfd_link_hash_defweak) + if (defined && h->type != STT_GNU_IFUNC && h != htab->elf.hdynamic && SYMBOL_REFERENCES_LOCAL (link_info, h)) - { - tsec = h->root.u.def.section; - toff = h->root.u.def.value; - symtype = h->type; - } + symtype = h->type; else continue; } diff --git a/bfd/linker.c b/bfd/linker.c index 86a7a1945ba..0eafb98f408 100644 --- a/bfd/linker.c +++ b/bfd/linker.c @@ -3303,3 +3303,60 @@ bfd_hide_sym_by_version (struct bfd_elf_version_tree *verdefs, bfd_find_version_for_sym (verdefs, sym_name, &hidden); return hidden; } + +/* +FUNCTION + bfd_link_get_defined_symbol + +SYNOPSIS + bfd_boolean bfd_link_get_defined_symbol + (bfd *output_bfd, struct bfd_link_hash_entry *h, + asection **sec, bfd_vma *value); + +DESCRIPTION + Return TRUE, store symbol section and value in @var{*sec} and + @var{*value} if symbol @var{h} is defined during a final link. +*/ + +bfd_boolean +bfd_link_get_defined_symbol (bfd *output_bfd, + struct bfd_link_hash_entry *h, + asection **sec, bfd_vma *value) +{ + if (h->type == bfd_link_hash_defined + || h->type == bfd_link_hash_defweak) + { + *sec = h->u.def.section; + *value = h->u.def.value; + return TRUE; + } + + if (h->type == bfd_link_hash_new + || h->type == bfd_link_hash_undefined + || h->type == bfd_link_hash_undefweak) + { + /* Check yet undefined reference to __start_XXX or __stop_XXX + symbols. The linker will later define such symbols for output + sections that have a name representable as a C identifier. */ + const char *sec_name; + if (strncmp (h->root.string, "__start_", 8) == 0) + sec_name = h->root.string + 8; + else if (strncmp (h->root.string, "__stop_", 7) == 0) + sec_name = h->root.string + 7; + else + sec_name = NULL; + + if (sec_name != NULL && *sec_name != '\0') + { + asection *s = bfd_get_section_by_name (output_bfd, sec_name); + if (s != NULL) + { + *sec = s; + *value = sec_name == (h->root.string + 7) ? s->size : 0; + return TRUE; + } + } + } + + return FALSE; +} diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index 90a31e65f28..42558baa073 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,27 @@ +2015-10-26 H.J. Lu <hongjiu.lu@intel.com> + + PR ld/19171 + * ld-i386/lea1.s: Add tests for address load of __start_XXX + and __stop_XXX. + * ld-i386/mov1.s: Likewise. + * ld-x86-64/lea1.s: Likewise. + * ld-x86-64/mov1.s: Likewise. + * ld-i386/lea1a.d: Updated. + * ld-i386/lea1b.d: Likewise. + * ld-i386/lea1c.d: Likewise. + * ld-i386/mov1a.d: Likewise. + * ld-i386/mov1b.d: Likewise. + * ld-x86-64/lea1a.d: Likewise. + * ld-x86-64/lea1b.d: Likewise. + * ld-x86-64/lea1c.d: Likewise. + * ld-x86-64/lea1d.d: Likewise. + * ld-x86-64/lea1e.d: Likewise. + * ld-x86-64/lea1f.d: Likewise. + * ld-x86-64/mov1a.d: Likewise. + * ld-x86-64/mov1b.d: Likewise. + * ld-x86-64/mov1c.d: Likewise. + * ld-x86-64/mov1d.d: Likewise. + 2015-10-23 H.J. Lu <hongjiu.lu@intel.com> PR ld/19167 diff --git a/ld/testsuite/ld-i386/lea1.s b/ld/testsuite/ld-i386/lea1.s index f754ec03374..8849a38fb7a 100644 --- a/ld/testsuite/ld-i386/lea1.s +++ b/ld/testsuite/ld-i386/lea1.s @@ -1,3 +1,5 @@ + .section my_section,"aw",@progbits + .long 0x12345678 .text .globl foo .type foo, @function @@ -9,6 +11,8 @@ foo: _start: movl foo@GOT(%ecx), %eax movl bar@GOT(%ecx), %eax + movl __start_my_section@GOT(%ecx), %eax + movl __stop_my_section@GOT(%ecx), %eax .size _start, .-_start .comm pad,4,4 .comm bar,4,4 diff --git a/ld/testsuite/ld-i386/lea1a.d b/ld/testsuite/ld-i386/lea1a.d index 0435d3495b9..d8825227008 100644 --- a/ld/testsuite/ld-i386/lea1a.d +++ b/ld/testsuite/ld-i386/lea1a.d @@ -11,4 +11,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%ecx\),%eax [ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%ecx\),%eax #pass diff --git a/ld/testsuite/ld-i386/lea1b.d b/ld/testsuite/ld-i386/lea1b.d index 8cef2c4f64a..b3f6507d177 100644 --- a/ld/testsuite/ld-i386/lea1b.d +++ b/ld/testsuite/ld-i386/lea1b.d @@ -11,4 +11,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%ecx\),%eax [ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8d 81 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%ecx\),%eax #pass diff --git a/ld/testsuite/ld-i386/lea1c.d b/ld/testsuite/ld-i386/lea1c.d index 54ec0deb18e..dd76258be34 100644 --- a/ld/testsuite/ld-i386/lea1c.d +++ b/ld/testsuite/ld-i386/lea1c.d @@ -11,4 +11,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax [ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax +[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax +[ ]*[a-f0-9]+: 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+,%eax #pass diff --git a/ld/testsuite/ld-i386/mov1.s b/ld/testsuite/ld-i386/mov1.s index c813e718b18..0ed8015e7e4 100644 --- a/ld/testsuite/ld-i386/mov1.s +++ b/ld/testsuite/ld-i386/mov1.s @@ -1,6 +1,10 @@ .text + .weak __start_my_section + .weak __stop_my_section .globl _start .type _start, @function _start: movl _DYNAMIC@GOT(%ecx), %eax + movl __start_my_section@GOT(%ecx), %eax + movl __stop_my_section@GOT(%ecx), %eax .size _start, .-_start diff --git a/ld/testsuite/ld-i386/mov1a.d b/ld/testsuite/ld-i386/mov1a.d index d8ce6b821f7..d189627744a 100644 --- a/ld/testsuite/ld-i386/mov1a.d +++ b/ld/testsuite/ld-i386/mov1a.d @@ -10,4 +10,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 8b 81 ([0-9a-f]{2} ){4} * mov -0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8b 81 ([0-9a-f]{2} ){4} * mov -0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8b 81 ([0-9a-f]{2} ){4} * mov -0x[a-f0-9]+\(%ecx\),%eax #pass diff --git a/ld/testsuite/ld-i386/mov1b.d b/ld/testsuite/ld-i386/mov1b.d index 583dfc82d46..ae40862384e 100644 --- a/ld/testsuite/ld-i386/mov1b.d +++ b/ld/testsuite/ld-i386/mov1b.d @@ -10,4 +10,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 8b 81 ([0-9a-f]{2} ){4} * mov -0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8b 81 ([0-9a-f]{2} ){4} * mov -0x[a-f0-9]+\(%ecx\),%eax +[ ]*[a-f0-9]+: 8b 81 ([0-9a-f]{2} ){4} * mov -0x[a-f0-9]+\(%ecx\),%eax #pass diff --git a/ld/testsuite/ld-x86-64/lea1.s b/ld/testsuite/ld-x86-64/lea1.s index c2a499c5bf1..07a2e354734 100644 --- a/ld/testsuite/ld-x86-64/lea1.s +++ b/ld/testsuite/ld-x86-64/lea1.s @@ -1,3 +1,5 @@ + .section my_section,"aw",@progbits + .long 0x12345678 .text .globl foo .type foo, @function @@ -9,6 +11,8 @@ foo: _start: movq foo@GOTPCREL(%rip), %rax movq bar@GOTPCREL(%rip), %rax + movq __start_my_section@GOTPCREL(%rip), %rax + movq __stop_my_section@GOTPCREL(%rip), %rax .size _start, .-_start .comm pad,4,4 .comm bar,4,4 diff --git a/ld/testsuite/ld-x86-64/lea1a.d b/ld/testsuite/ld-x86-64/lea1a.d index 75dad702da0..36e9f546d30 100644 --- a/ld/testsuite/ld-x86-64/lea1a.d +++ b/ld/testsuite/ld-x86-64/lea1a.d @@ -11,4 +11,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <foo> [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <bar> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__start_my_section> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__stop_my_section> #pass diff --git a/ld/testsuite/ld-x86-64/lea1b.d b/ld/testsuite/ld-x86-64/lea1b.d index d968ca29dfb..a92acd73e05 100644 --- a/ld/testsuite/ld-x86-64/lea1b.d +++ b/ld/testsuite/ld-x86-64/lea1b.d @@ -11,4 +11,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <foo> [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <bar> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__start_my_section> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__stop_my_section> #pass diff --git a/ld/testsuite/ld-x86-64/lea1c.d b/ld/testsuite/ld-x86-64/lea1c.d index 5f7e6c36977..072b1ee0983 100644 --- a/ld/testsuite/ld-x86-64/lea1c.d +++ b/ld/testsuite/ld-x86-64/lea1c.d @@ -11,4 +11,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <foo> [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <bar> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__start_my_section> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__stop_my_section> #pass diff --git a/ld/testsuite/ld-x86-64/lea1d.d b/ld/testsuite/ld-x86-64/lea1d.d index 524980f9b98..2613061b948 100644 --- a/ld/testsuite/ld-x86-64/lea1d.d +++ b/ld/testsuite/ld-x86-64/lea1d.d @@ -11,4 +11,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <foo> [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <bar> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__start_my_section> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__stop_my_section> #pass diff --git a/ld/testsuite/ld-x86-64/lea1e.d b/ld/testsuite/ld-x86-64/lea1e.d index 22e6dcc04df..109c1cd1be9 100644 --- a/ld/testsuite/ld-x86-64/lea1e.d +++ b/ld/testsuite/ld-x86-64/lea1e.d @@ -11,4 +11,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <foo> [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <bar> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__start_my_section> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__stop_my_section> #pass diff --git a/ld/testsuite/ld-x86-64/lea1f.d b/ld/testsuite/ld-x86-64/lea1f.d index 9aff34d0b82..8d6cd783454 100644 --- a/ld/testsuite/ld-x86-64/lea1f.d +++ b/ld/testsuite/ld-x86-64/lea1f.d @@ -11,4 +11,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea -0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <foo> [ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <bar> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__start_my_section> +[ ]*[a-f0-9]+: 48 8d 05 ([0-9a-f]{2} ){4} * lea 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <__stop_my_section> #pass diff --git a/ld/testsuite/ld-x86-64/mov1.s b/ld/testsuite/ld-x86-64/mov1.s index 2a11b7a19f4..844129cc663 100644 --- a/ld/testsuite/ld-x86-64/mov1.s +++ b/ld/testsuite/ld-x86-64/mov1.s @@ -1,6 +1,10 @@ .text + .weak __start_my_section + .weak __stop_my_section .globl _start .type _start, @function _start: movq _DYNAMIC@GOTPCREL(%rip), %rax + movq __start_my_section@GOTPCREL(%rip), %rax + movq __stop_my_section@GOTPCREL(%rip), %rax .size _start, .-_start diff --git a/ld/testsuite/ld-x86-64/mov1a.d b/ld/testsuite/ld-x86-64/mov1a.d index df156be1177..4ac6d7ea49c 100644 --- a/ld/testsuite/ld-x86-64/mov1a.d +++ b/ld/testsuite/ld-x86-64/mov1a.d @@ -10,4 +10,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> +[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> +[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> #pass diff --git a/ld/testsuite/ld-x86-64/mov1b.d b/ld/testsuite/ld-x86-64/mov1b.d index 2f2f6f5e5df..f112c1cba5b 100644 --- a/ld/testsuite/ld-x86-64/mov1b.d +++ b/ld/testsuite/ld-x86-64/mov1b.d @@ -10,4 +10,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> +[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> +[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> #pass diff --git a/ld/testsuite/ld-x86-64/mov1c.d b/ld/testsuite/ld-x86-64/mov1c.d index a57e1c184cd..bb7bab1113d 100644 --- a/ld/testsuite/ld-x86-64/mov1c.d +++ b/ld/testsuite/ld-x86-64/mov1c.d @@ -10,4 +10,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> +[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> +[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> #pass diff --git a/ld/testsuite/ld-x86-64/mov1d.d b/ld/testsuite/ld-x86-64/mov1d.d index 955d33e51a5..794a546f86a 100644 --- a/ld/testsuite/ld-x86-64/mov1d.d +++ b/ld/testsuite/ld-x86-64/mov1d.d @@ -10,4 +10,6 @@ Disassembly of section .text: #... [ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> +[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> +[ ]*[a-f0-9]+: 48 8b 05 ([0-9a-f]{2} ){4} * mov 0x[a-f0-9]+\(%rip\),%rax # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+> #pass |