Optimize x86 GOT32X/GOTPCRELX relocations
authorH.J. Lu <hjl.tools@gmail.com>
Fri, 26 Feb 2016 17:38:08 +0000 (09:38 -0800)
committerH.J. Lu <hjl.tools@gmail.com>
Fri, 26 Feb 2016 17:39:24 +0000 (09:39 -0800)
R_386_GOT32X, R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX relocations
retrieve the symbol address via its GOT slot.  If the symbol address is
known at the link-time, we can use it directly by changing instruction
encoding.  Indirect branch can only be converted to PC relative direct
branch.  MOV can be changed to LEA or encoded differently with signed
address.  The subset of binary operations can be encoded only with
signed address.

If undefined weak symbol is resolved to zero link-time, we can use it
as address.  Zero addresss can't used with PC relative direct branch
when PIC is true since the current PC is unknown.  In 64-bit, 32-bit
relocation for PC relatiave direct branch to zero may also overflow.

If this optimization causes relocation overflow, --no-relax can be used
to work around it.

bfd/

PR ld/19609
* elf32-i386.c (elf_i386_convert_load): Convert to R_386_32 for
load with locally bound symbols if PIC is false or there is no
base register.  Optimize branch to 0 if PIC is false.
(elf_i386_relocate_section): Don't generate dynamic relocations
against undefined weak symbols if PIC is false.
* elf64-x86-64.c (elf_x86_64_convert_load): Disable optimization
if we can't estimate relocation overflow with --no-relax.
Convert to R_X86_64_32S/R_X86_64_32 for load with locally bound
symbols if PIC is false.  Optimize branch to 0 if PIC is false.
(elf_x86_64_relocate_section): Don't generate dynamic relocations
against undefined weak symbols if PIC is false.

ld/

PR ld/19609
* testsuite/ld-i386/got1.dd: Updated.
* testsuite/ld-i386/lea1c.d: Likewise.
* testsuite/ld-i386/load1-nacl.d: Likewise.
* testsuite/ld-i386/load1.d: Likewise.
* testsuite/ld-i386/load4b.d: Likewise.
* testsuite/ld-i386/load5b.d: Likewise.
* testsuite/ld-i386/mov1b.d: Likewise.
* testsuite/ld-x86-64/mov1b.d: Likewise.
* testsuite/ld-x86-64/mov1d.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-i386.d: Likewise.
* testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
* testsuite/ld-x86-64/gotpcrel1.dd: Likewise.
* testsuite/ld-x86-64/lea1a.d: Likewise.
* testsuite/ld-x86-64/lea1b.d: Likewise.
* testsuite/ld-x86-64/lea1c.d: Likewise.
* testsuite/ld-x86-64/lea1d.d: Likewise.
* testsuite/ld-x86-64/lea1e.d: Likewise.
* testsuite/ld-x86-64/lea1f.d: Likewise.
* testsuite/ld-x86-64/mov1b.d: Likewise.
* testsuite/ld-x86-64/mov1d.d: Likewise.
* testsuite/ld-x86-64/pr13082-3b.d: Likewise.
* testsuite/ld-x86-64/pr13082-4b.d: Likewise.
* testsuite/ld-x86-64/lea1.s: Add tests for 32-bit registers.
* testsuite/ld-i386/pr19609-1.s: New file.
* testsuite/ld-i386/pr19609-1a.d: Likewise.
* testsuite/ld-i386/pr19609-1b.d: Likewise.
* testsuite/ld-i386/pr19609-1c.d: Likewise.
* testsuite/ld-i386/pr19609-1d.d: Likewise.
* testsuite/ld-i386/pr19609-1e.d: Likewise.
* testsuite/ld-i386/pr19609-1f.d: Likewise.
* testsuite/ld-i386/pr19609-1g.d: Likewise.
* testsuite/ld-i386/pr19609-1h.d: Likewise.
* testsuite/ld-i386/pr19609-1i.d: Likewise.
* testsuite/ld-i386/pr19609-2.s: Likewise.
* testsuite/ld-i386/pr19609-2a.d: Likewise.
* testsuite/ld-i386/pr19609-2b.d: Likewise.
* testsuite/ld-i386/pr19609-2c.d: Likewise.
* testsuite/ld-i386/undefweak.s: Likewise.
* testsuite/ld-i386/undefweaka.d: Likewise.
* testsuite/ld-i386/undefweakb.d: Likewise.
* testsuite/ld-x86-64/pr13082-3c.d: Likewise.
* testsuite/ld-x86-64/pr13082-3d.d: Likewise.
* testsuite/ld-x86-64/pr19609-1.s: Likewise.
* testsuite/ld-x86-64/pr19609-1a.d: Likewise.
* testsuite/ld-x86-64/pr19609-1b.d: Likewise.
* testsuite/ld-x86-64/pr19609-1c.d: Likewise.
* testsuite/ld-x86-64/pr19609-1d.d: Likewise.
* testsuite/ld-x86-64/pr19609-1e.d: Likewise.
* testsuite/ld-x86-64/pr19609-1f.d: Likewise.
* testsuite/ld-x86-64/pr19609-1g.d: Likewise.
* testsuite/ld-x86-64/pr19609-1h.d: Likewise.
* testsuite/ld-x86-64/pr19609-1i.d: Likewise.
* testsuite/ld-x86-64/pr19609-1j.d: Likewise.
* testsuite/ld-x86-64/pr19609-1k.d: Likewise.
* testsuite/ld-x86-64/pr19609-1l.d: Likewise.
* testsuite/ld-x86-64/pr19609-1m.d: Likewise.
* testsuite/ld-x86-64/pr19609-2.s: Likewise.
* testsuite/ld-x86-64/pr19609-2a.d: Likewise.
* testsuite/ld-x86-64/pr19609-2b.d: Likewise.
* testsuite/ld-x86-64/pr19609-2c.d: Likewise.
* testsuite/ld-x86-64/pr19609-2d.d: Likewise.
* testsuite/ld-x86-64/pr19609-3.s: Likewise.
* testsuite/ld-x86-64/pr19609-3a.d: Likewise.
* testsuite/ld-x86-64/pr19609-3b.d: Likewise.
* testsuite/ld-x86-64/pr19609-4.s: Likewise.
* testsuite/ld-x86-64/pr19609-4a.d: Likewise.
* testsuite/ld-x86-64/pr19609-4b.d: Likewise.
* testsuite/ld-x86-64/pr19609-4c.d: Likewise.
* testsuite/ld-x86-64/pr19609-4d.d: Likewise.
* testsuite/ld-x86-64/pr19609-4e.d: Likewise.
* testsuite/ld-x86-64/pr19609-5.s: Likewise.
* testsuite/ld-x86-64/pr19609-5a.d: Likewise.
* testsuite/ld-x86-64/pr19609-5b.d: Likewise.
* testsuite/ld-x86-64/pr19609-5c.d: Likewise.
* testsuite/ld-x86-64/pr19609-5d.d: Likewise.
* testsuite/ld-x86-64/pr19609-5e.d: Likewise.
* testsuite/ld-x86-64/pr19609-6.s: Likewise.
* testsuite/ld-x86-64/pr19609-6a.d: Likewise.
* testsuite/ld-x86-64/pr19609-6b.d: Likewise.
* testsuite/ld-x86-64/pr19609-6c.d: Likewise.
* testsuite/ld-x86-64/pr19609-6d.d: Likewise.
* testsuite/ld-x86-64/pr19609-7.s: Likewise.
* testsuite/ld-x86-64/pr19609-7a.d: Likewise.
* testsuite/ld-x86-64/pr19609-7b.d: Likewise.
* testsuite/ld-x86-64/pr19609-7c.d: Likewise.
* testsuite/ld-x86-64/pr19609-7d.d: Likewise.
* testsuite/ld-i386/i386.exp: Run undefweak tests and tests for
PR ld/19609.
* testsuite/ld-x86-64/x86-64.exp: Run pr13082-3c, pr13082-3d
and tests for PR ld/19609.

92 files changed:
bfd/ChangeLog
bfd/elf32-i386.c
bfd/elf64-x86-64.c
ld/ChangeLog
ld/testsuite/ld-i386/got1.dd
ld/testsuite/ld-i386/i386.exp
ld/testsuite/ld-i386/lea1c.d
ld/testsuite/ld-i386/load1-nacl.d
ld/testsuite/ld-i386/load1.d
ld/testsuite/ld-i386/load4b.d
ld/testsuite/ld-i386/load5b.d
ld/testsuite/ld-i386/mov1b.d
ld/testsuite/ld-i386/pr19609-1.s [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-1a.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-1b.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-1c.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-1d.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-1e.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-1f.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-1g.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-1h.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-1i.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-2.s [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-2a.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-2b.d [new file with mode: 0644]
ld/testsuite/ld-i386/pr19609-2c.d [new file with mode: 0644]
ld/testsuite/ld-i386/undefweak.s [new file with mode: 0644]
ld/testsuite/ld-i386/undefweaka.d [new file with mode: 0644]
ld/testsuite/ld-i386/undefweakb.d [new file with mode: 0644]
ld/testsuite/ld-ifunc/ifunc-21-i386.d
ld/testsuite/ld-ifunc/ifunc-21-x86-64.d
ld/testsuite/ld-ifunc/ifunc-22-i386.d
ld/testsuite/ld-ifunc/ifunc-22-x86-64.d
ld/testsuite/ld-x86-64/gotpcrel1.dd
ld/testsuite/ld-x86-64/lea1.s
ld/testsuite/ld-x86-64/lea1a.d
ld/testsuite/ld-x86-64/lea1b.d
ld/testsuite/ld-x86-64/lea1c.d
ld/testsuite/ld-x86-64/lea1d.d
ld/testsuite/ld-x86-64/lea1e.d
ld/testsuite/ld-x86-64/lea1f.d
ld/testsuite/ld-x86-64/mov1b.d
ld/testsuite/ld-x86-64/mov1d.d
ld/testsuite/ld-x86-64/pr13082-3b.d
ld/testsuite/ld-x86-64/pr13082-3c.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr13082-3d.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr13082-4b.d
ld/testsuite/ld-x86-64/pr19609-1.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1c.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1d.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1e.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1f.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1g.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1h.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1i.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1j.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1k.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1l.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-1m.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-2.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-2a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-2b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-2c.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-2d.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-3.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-3a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-3b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-4.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-4a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-4b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-4c.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-4d.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-4e.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-5.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-5a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-5b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-5c.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-5d.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-5e.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-6.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-6a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-6b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-6c.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-6d.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-7.s [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-7a.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-7b.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-7c.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/pr19609-7d.d [new file with mode: 0644]
ld/testsuite/ld-x86-64/x86-64.exp

index a2e5f1edb3290ab7d31b23b4065de96814ef2bbc..0b52c17463ef1bed89348b1b69c0475b89fd1441 100644 (file)
@@ -1,3 +1,18 @@
+2016-02-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/19609
+       * elf32-i386.c (elf_i386_convert_load): Convert to R_386_32 for
+       load with locally bound symbols if PIC is false or there is no
+       base register.  Optimize branch to 0 if PIC is false.
+       (elf_i386_relocate_section): Don't generate dynamic relocations
+       against undefined weak symbols if PIC is false.
+       * elf64-x86-64.c (elf_x86_64_convert_load): Disable optimization
+       if we can't estimate relocation overflow with --no-relax.
+       Convert to R_X86_64_32S/R_X86_64_32 for load with locally bound
+       symbols if PIC is false.  Optimize branch to 0 if PIC is false.
+       (elf_x86_64_relocate_section): Don't generate dynamic relocations
+       against undefined weak symbols if PIC is false.
+
 2016-02-26  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/19645
index 2ae5e44fceeb879b2b2109c8bc65ccfaa1d33287..ab3945de00b280275cfdc9b6e0bab0fa72db7f3c 100644 (file)
@@ -2863,6 +2863,7 @@ elf_i386_convert_load (bfd *abfd, asection *sec,
   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.  */
@@ -2889,6 +2890,8 @@ elf_i386_convert_load (bfd *abfd, asection *sec,
   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;
@@ -2913,6 +2916,7 @@ elf_i386_convert_load (bfd *abfd, asection *sec,
       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;
@@ -2929,9 +2933,7 @@ elf_i386_convert_load (bfd *abfd, asection *sec,
       modrm = bfd_get_8 (abfd, contents + roff - 1);
       baseless = (modrm & 0xc7) == 0x5;
 
-      if (r_type == R_386_GOT32X
-         && baseless
-         && bfd_link_pic (link_info))
+      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
@@ -2960,7 +2962,7 @@ elf_i386_convert_load (bfd *abfd, asection *sec,
 
       opcode = bfd_get_8 (abfd, contents + roff - 2);
 
-      /* It is OK to convert mov to lea.  */
+      /* 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
@@ -2968,14 +2970,12 @@ elf_i386_convert_load (bfd *abfd, asection *sec,
             instructions.  */
          if (r_type != R_386_GOT32X)
            continue;
-
-         /* It is OK to convert indirect branch to direct branch.  It
-            is OK to convert adc, add, and, cmp, or, sbb, sub, test,
-            xor only when PIC is false.   */
-         if (opcode != 0xff && bfd_link_pic (link_info))
-           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)
@@ -3010,6 +3010,27 @@ elf_i386_convert_load (bfd *abfd, asection *sec,
       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,
+                                          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)]".  */
@@ -3087,27 +3108,29 @@ convert_branch:
 convert_load:
              if (opcode == 0x8b)
                {
-                 /* Convert "mov foo@GOT(%reg1), %reg2" to
-                    "lea foo@GOTOFF(%reg1), %reg2".  */
-                 if (r_type == R_386_GOT32X
-                     && (baseless || !bfd_link_pic (link_info)))
+                 if (to_reloc_32)
                    {
+                     /* Convert "mov foo@GOT[(%reg1)], %reg2" to
+                        "mov $foo, %reg2" with R_386_32.  */
                      r_type = R_386_32;
-                     /* For R_386_32, convert
-                        "lea foo@GOTOFF(%reg1), %reg2" to
-                        "lea foo@GOT, %reg2".  */
-                     if (!baseless)
-                       {
-                         modrm = 0x5 | (modrm & 0x38);
-                         bfd_put_8 (abfd, modrm, contents + roff - 1);
-                       }
+                     modrm = 0xc0 | (modrm & 0x38) >> 3;
+                     bfd_put_8 (abfd, modrm, contents + roff - 1);
+                     opcode = 0xc7;
                    }
                  else
-                   r_type = R_386_GOTOFF;
-                 opcode = 0x8d;
+                   {
+                     /* 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
@@ -4369,10 +4392,10 @@ r_386_got32:
                      || eh->func_pointer_refcount > 0
                      || (h->root.type == bfd_link_hash_undefweak
                          && !resolved_to_zero))
-                 && ((h->def_dynamic
-                      && !h->def_regular)
-                     || h->root.type == bfd_link_hash_undefweak
-                     || h->root.type == bfd_link_hash_undefined)))
+                 && ((h->def_dynamic && !h->def_regular)
+                     /* Undefined weak symbol is bound locally when
+                        PIC is false.  */
+                     || h->root.type == bfd_link_hash_undefweak)))
            {
              Elf_Internal_Rela outrel;
              bfd_boolean skip, relocate;
index 6ca3b2e06a416e15fb1b871f94b2d36f240fdb9a..c6968501cad2d9341de185094667a7f20e0e3f6c 100644 (file)
@@ -3070,6 +3070,8 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec,
   bfd_boolean changed_relocs;
   bfd_signed_vma *local_got_refcounts;
   bfd_vma maxpagesize;
+  bfd_boolean is_pic;
+  bfd_boolean require_reloc_pc32;
 
   /* Don't even try to convert non-ELF outputs.  */
   if (!is_elf_hash_table (link_info->hash))
@@ -3105,6 +3107,13 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec,
        goto error_return;
     }
 
+  is_pic = bfd_link_pic (link_info);
+
+  /* TRUE if we can convert only to R_X86_64_PC32.  Enable it for
+     --no-relax.  */
+  require_reloc_pc32
+    = link_info->disable_target_specific_optimizations > 1;
+
   irelend = internal_relocs + sec->reloc_count;
   for (irel = internal_relocs; irel < irelend; irel++)
     {
@@ -3118,10 +3127,12 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec,
       bfd_signed_vma raddend;
       unsigned int opcode;
       unsigned int modrm;
+      bfd_boolean relocx;
+      bfd_boolean to_reloc_pc32;
 
-      if (r_type != R_X86_64_GOTPCREL
-         && r_type != R_X86_64_GOTPCRELX
-         && r_type != R_X86_64_REX_GOTPCRELX)
+      relocx = (r_type == R_X86_64_GOTPCRELX
+               || r_type == R_X86_64_REX_GOTPCRELX);
+      if (!relocx && r_type != R_X86_64_GOTPCREL)
        continue;
 
       roff = irel->r_offset;
@@ -3135,26 +3146,27 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec,
 
       opcode = bfd_get_8 (abfd, contents + roff - 2);
 
-      /* It is OK to convert mov to lea.  */
+      /* Convert mov to lea since it has been done for a while.  */
       if (opcode != 0x8b)
        {
          /* Only convert R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX
-            for mov call, jmp or one of adc, add, and, cmp, or, sbb,
-            sub, test, xor instructions.  */
-         if (r_type != R_X86_64_GOTPCRELX
-             && r_type != R_X86_64_REX_GOTPCRELX)
+            for call, jmp or one of adc, add, and, cmp, or, sbb, sub,
+            test, xor instructions.  */
+         if (!relocx)
            continue;
-
-         /* It is OK to convert indirect branch to direct branch.  */
-         if (opcode != 0xff)
-           {
-             /* It is OK to convert adc, add, and, cmp, or, sbb, sub,
-                test, xor only when PIC is false.   */
-             if (bfd_link_pic (link_info))
-               continue;
-           }
        }
 
+      /* We convert only to R_X86_64_PC32:
+        1. Branch.
+        2. R_X86_64_GOTPCREL since we can't modify REX byte.
+        3. require_reloc_pc32 is true.
+        4. PIC.
+       */
+      to_reloc_pc32 = (opcode == 0xff
+                      || !relocx
+                      || require_reloc_pc32
+                      || is_pic);
+
       /* Get the symbol referred to by the reloc.  */
       if (r_symndx < symtab_hdr->sh_info)
        {
@@ -3195,22 +3207,59 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec,
          /* 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->def_regular
-              || h->root.type == bfd_link_hash_defined
-              || h->root.type == bfd_link_hash_defweak)
-             && h->type != STT_GNU_IFUNC
-             && h != htab->elf.hdynamic
-             && SYMBOL_REFERENCES_LOCAL (link_info, h))
+         if (h->type == STT_GNU_IFUNC)
+           continue;
+
+         /* Undefined weak symbol is only bound locally in executable
+            and its reference is resolved as 0 without relocation
+            overflow.  We can only perform this optimization for
+            GOTPCRELX relocations since we need to modify REX byte.
+            It is OK convert mov with R_X86_64_GOTPCREL to
+            R_X86_64_PC32.  */
+         if ((relocx || opcode == 0x8b)
+             && UNDEFINED_WEAK_RESOLVED_TO_ZERO (link_info,
+                                                 elf_x86_64_hash_entry (h)))
+           {
+             if (opcode == 0xff)
+               {
+                 /* Skip for branch instructions since R_X86_64_PC32
+                    may overflow.  */
+                 if (require_reloc_pc32)
+                   continue;
+               }
+             else if (relocx)
+               {
+                 /* For non-branch instructions, we can convert to
+                    R_X86_64_32/R_X86_64_32S since we know if there
+                    is a REX byte.  */
+                 to_reloc_pc32 = FALSE;
+               }
+
+             /* Since we don't know the current PC when PIC is true,
+                we can't convert to R_X86_64_PC32.  */
+             if (to_reloc_pc32 && is_pic)
+               continue;
+
+             goto convert;
+           }
+         else if ((h->def_regular
+                   || h->root.type == bfd_link_hash_defined
+                   || h->root.type == bfd_link_hash_defweak)
+                  && h != htab->elf.hdynamic
+                  && SYMBOL_REFERENCES_LOCAL (link_info, h))
            {
              /* bfd_link_hash_new or bfd_link_hash_undefined is
-                set by an assignment in a linker script in
-                bfd_elf_record_link_assignment.  FIXME: If we
-                ever get a linker error due relocation overflow,
-                we will skip this optimization.  */
+                set by an assignment in a linker script in
+                bfd_elf_record_link_assignment.   */
              if (h->def_regular
                  && (h->root.type == bfd_link_hash_new
                      || h->root.type == bfd_link_hash_undefined))
-               goto convert;
+               {
+                 /* Skip since R_X86_64_32/R_X86_64_32S may overflow.  */
+                 if (require_reloc_pc32)
+                   continue;
+                 goto convert;
+               }
              tsec = h->root.u.def.section;
              toff = h->root.u.def.value;
              symtype = h->type;
@@ -3219,6 +3268,10 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec,
            continue;
        }
 
+      /* We can only estimate relocation overflow for R_X86_64_PC32.  */
+      if (!to_reloc_pc32)
+       goto convert;
+
       if (tsec->sec_info_type == SEC_INFO_TYPE_MERGE)
        {
          /* At this stage in linking, no SEC_MERGE symbol has been
@@ -3342,15 +3395,55 @@ convert:
        }
       else
        {
+         unsigned int rex;
+         unsigned int rex_mask = REX_R;
+
+         if (r_type == R_X86_64_REX_GOTPCRELX)
+           rex = bfd_get_8 (abfd, contents + roff - 3);
+         else
+           rex = 0;
+
          if (opcode == 0x8b)
            {
-             /* Convert "mov foo@GOTPCREL(%rip), %reg" to
-                "lea foo(%rip), %reg".  */
-             opcode = 0x8d;
-             r_type = R_X86_64_PC32;
+             if (to_reloc_pc32)
+               {
+                 /* Convert "mov foo@GOTPCREL(%rip), %reg" to
+                    "lea foo(%rip), %reg".  */
+                 opcode = 0x8d;
+                 r_type = R_X86_64_PC32;
+               }
+             else
+               {
+                 /* Convert "mov foo@GOTPCREL(%rip), %reg" to
+                    "mov $foo, %reg".  */
+                 opcode = 0xc7;
+                 modrm = bfd_get_8 (abfd, contents + roff - 1);
+                 modrm = 0xc0 | (modrm & 0x38) >> 3;
+                 if ((rex & REX_W) != 0
+                     && ABI_64_P (link_info->output_bfd))
+                   {
+                     /* Keep the REX_W bit in REX byte for LP64.  */
+                     r_type = R_X86_64_32S;
+                     goto rewrite_modrm_rex;
+                   }
+                 else
+                   {
+                     /* If the REX_W bit in REX byte isn't needed,
+                        use R_X86_64_32 and clear the W bit to avoid
+                        sign-extend imm32 to imm64.  */
+                     r_type = R_X86_64_32;
+                     /* Clear the W bit in REX byte.  */
+                     rex_mask |= REX_W;
+                     goto rewrite_modrm_rex;
+                   }
+               }
            }
          else
            {
+             /* R_X86_64_PC32 isn't supported.  */
+             if (to_reloc_pc32)
+               continue;
+
              modrm = bfd_get_8 (abfd, contents + roff - 1);
              if (opcode == 0x85)
                {
@@ -3366,18 +3459,23 @@ convert:
                  modrm = 0xc0 | (modrm & 0x38) >> 3 | (opcode & 0x3c);
                  opcode = 0x81;
                }
+
+             /* Use R_X86_64_32 with 32-bit operand to avoid relocation
+                overflow when sign-extending imm32 to imm64.  */
+             r_type = (rex & REX_W) != 0 ? R_X86_64_32S : R_X86_64_32;
+
+rewrite_modrm_rex:
              bfd_put_8 (abfd, modrm, contents + roff - 1);
 
-             if (r_type == R_X86_64_REX_GOTPCRELX)
+             if (rex)
                {
                  /* Move the R bit to the B bit in REX byte.  */
-                 unsigned int rex = bfd_get_8 (abfd, contents + roff - 3);
-                 rex = (rex & ~REX_R) | (rex & REX_R) >> 2;
+                 rex = (rex & ~rex_mask) | (rex & REX_R) >> 2;
                  bfd_put_8 (abfd, rex, contents + roff - 3);
                }
-             /* No addend for R_X86_64_32S relocation.  */
+
+             /* No addend for R_X86_64_32/R_X86_64_32S relocations.  */
              irel->r_addend = 0;
-             r_type = R_X86_64_32S;
            }
 
          bfd_put_8 (abfd, opcode, contents + roff - 2);
@@ -4688,9 +4786,9 @@ direct:
                      || eh->func_pointer_refcount > 0
                      || (h->root.type == bfd_link_hash_undefweak
                          && !resolved_to_zero))
-                 && ((h->def_dynamic
-                      && !h->def_regular)
-                     || h->root.type == bfd_link_hash_undefweak
+                 && ((h->def_dynamic && !h->def_regular)
+                     /* Undefined weak symbol is bound locally when
+                        PIC is false.  */
                      || h->root.type == bfd_link_hash_undefined)))
            {
              Elf_Internal_Rela outrel;
index 2c020123d364179509c8d96cafbb71ff2dff0899..ef2e60feadc83bb278ed0d87bfaad71af718b240 100644 (file)
@@ -1,3 +1,99 @@
+2016-02-26  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR ld/19609
+       * testsuite/ld-i386/got1.dd: Updated.
+       * testsuite/ld-i386/lea1c.d: Likewise.
+       * testsuite/ld-i386/load1-nacl.d: Likewise.
+       * testsuite/ld-i386/load1.d: Likewise.
+       * testsuite/ld-i386/load4b.d: Likewise.
+       * testsuite/ld-i386/load5b.d: Likewise.
+       * testsuite/ld-i386/mov1b.d: Likewise.
+       * testsuite/ld-x86-64/mov1b.d: Likewise.
+       * testsuite/ld-x86-64/mov1d.d: Likewise.
+       * testsuite/ld-ifunc/ifunc-21-i386.d: Likewise.
+       * testsuite/ld-ifunc/ifunc-21-x86-64.d: Likewise.
+       * testsuite/ld-ifunc/ifunc-22-i386.d: Likewise.
+       * testsuite/ld-ifunc/ifunc-22-x86-64.d: Likewise.
+       * testsuite/ld-x86-64/gotpcrel1.dd: Likewise.
+       * testsuite/ld-x86-64/lea1a.d: Likewise.
+       * testsuite/ld-x86-64/lea1b.d: Likewise.
+       * testsuite/ld-x86-64/lea1c.d: Likewise.
+       * testsuite/ld-x86-64/lea1d.d: Likewise.
+       * testsuite/ld-x86-64/lea1e.d: Likewise.
+       * testsuite/ld-x86-64/lea1f.d: Likewise.
+       * testsuite/ld-x86-64/mov1b.d: Likewise.
+       * testsuite/ld-x86-64/mov1d.d: Likewise.
+       * testsuite/ld-x86-64/pr13082-3b.d: Likewise.
+       * testsuite/ld-x86-64/pr13082-4b.d: Likewise.
+       * testsuite/ld-x86-64/lea1.s: Add tests for 32-bit registers.
+       * testsuite/ld-i386/pr19609-1.s: New file.
+       * testsuite/ld-i386/pr19609-1a.d: Likewise.
+       * testsuite/ld-i386/pr19609-1b.d: Likewise.
+       * testsuite/ld-i386/pr19609-1c.d: Likewise.
+       * testsuite/ld-i386/pr19609-1d.d: Likewise.
+       * testsuite/ld-i386/pr19609-1e.d: Likewise.
+       * testsuite/ld-i386/pr19609-1f.d: Likewise.
+       * testsuite/ld-i386/pr19609-1g.d: Likewise.
+       * testsuite/ld-i386/pr19609-1h.d: Likewise.
+       * testsuite/ld-i386/pr19609-1i.d: Likewise.
+       * testsuite/ld-i386/pr19609-2.s: Likewise.
+       * testsuite/ld-i386/pr19609-2a.d: Likewise.
+       * testsuite/ld-i386/pr19609-2b.d: Likewise.
+       * testsuite/ld-i386/pr19609-2c.d: Likewise.
+       * testsuite/ld-i386/undefweak.s: Likewise.
+       * testsuite/ld-i386/undefweaka.d: Likewise.
+       * testsuite/ld-i386/undefweakb.d: Likewise.
+       * testsuite/ld-x86-64/pr13082-3c.d: Likewise.
+       * testsuite/ld-x86-64/pr13082-3d.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1.s: Likewise.
+       * testsuite/ld-x86-64/pr19609-1a.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1b.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1c.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1d.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1e.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1f.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1g.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1h.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1i.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1j.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1k.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1l.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-1m.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-2.s: Likewise.
+       * testsuite/ld-x86-64/pr19609-2a.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-2b.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-2c.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-2d.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-3.s: Likewise.
+       * testsuite/ld-x86-64/pr19609-3a.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-3b.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-4.s: Likewise.
+       * testsuite/ld-x86-64/pr19609-4a.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-4b.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-4c.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-4d.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-4e.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-5.s: Likewise.
+       * testsuite/ld-x86-64/pr19609-5a.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-5b.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-5c.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-5d.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-5e.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-6.s: Likewise.
+       * testsuite/ld-x86-64/pr19609-6a.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-6b.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-6c.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-6d.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-7.s: Likewise.
+       * testsuite/ld-x86-64/pr19609-7a.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-7b.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-7c.d: Likewise.
+       * testsuite/ld-x86-64/pr19609-7d.d: Likewise.
+       * testsuite/ld-i386/i386.exp: Run undefweak tests and tests for
+       PR ld/19609.
+       * testsuite/ld-x86-64/x86-64.exp: Run pr13082-3c, pr13082-3d
+       and tests for PR ld/19609.
+
 2016-02-26  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR ld/19645
index e6e82dee9101b8c19090a73dae1f0b1fed641b72..cfea36bf8d6704be9f88ed58b54a19872b1a6a5e 100644 (file)
@@ -4,7 +4,7 @@
 [      ]*[a-f0-9]+:    [ a-f0-9]+      addr16 call [a-f0-9]+ <foo>
 [      ]*[a-f0-9]+:    [ a-f0-9]+      call   \*0x[a-f0-9]+
 [      ]*[a-f0-9]+:    [ a-f0-9]+      call   \*0x[a-f0-9]+
-[      ]*[a-f0-9]+:    [ a-f0-9]+      lea   *0x[a-f0-9]+,%eax
+[      ]*[a-f0-9]+:    [ a-f0-9]+      mov   *\$0x[a-f0-9]+,%eax
 [      ]*[a-f0-9]+:    ff d0                   call   \*%eax
 [      ]*[a-f0-9]+:    [ a-f0-9]+      mov   *0x[a-f0-9]+,%eax
 [      ]*[a-f0-9]+:    ff d0                   call   \*%eax
@@ -12,7 +12,7 @@
 [      ]*[a-f0-9]+:    ff d0                   call   \*%eax
 [      ]*[a-f0-9]+:    [ a-f0-9]+      call   [a-f0-9]+ <__x86.get_pc_thunk.cx>
 [      ]*[a-f0-9]+:    [ a-f0-9]+      add    \$0x[a-f0-9]+,%ecx
-[      ]*[a-f0-9]+:    [ a-f0-9]+      lea   *0x[a-f0-9]+,%ecx
+[      ]*[a-f0-9]+:    [ a-f0-9]+      mov   *\$0x[a-f0-9]+,%ecx
 [      ]*[a-f0-9]+:    ff d1                   call   \*%ecx
 [      ]*[a-f0-9]+:    83 ec 0c                sub    \$0xc,%esp
 [      ]*[a-f0-9]+:    6a 00                   push   \$0x0
index 5ddf045a945b263cb090d12800829814bfb60f06..e5f4aaadd327d15683531862d1b93c1016abaa59 100644 (file)
@@ -350,6 +350,20 @@ run_dump_test "pr19636-4b"
 run_dump_test "pr19636-4c"
 run_dump_test "pr19636-4d"
 run_dump_test "pr19645"
+run_dump_test "pr19609-1a"
+run_dump_test "pr19609-1b"
+run_dump_test "pr19609-1c"
+run_dump_test "pr19609-1d"
+run_dump_test "pr19609-1e"
+run_dump_test "pr19609-1f"
+run_dump_test "pr19609-1g"
+run_dump_test "pr19609-1h"
+run_dump_test "pr19609-1i"
+run_dump_test "pr19609-2a"
+run_dump_test "pr19609-2b"
+run_dump_test "pr19609-2c"
+run_dump_test "undefweaka"
+run_dump_test "undefweakb"
 
 if { !([istarget "i?86-*-linux*"]
        || [istarget "i?86-*-gnu*"]
index 0c3580d21ae828ba1fe2c5e3a8eb9063e5f2a106..b461089042aa83bd774ab126c99b52f7952ae747 100644 (file)
@@ -9,8 +9,8 @@
 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
+[      ]*[a-f0-9]+:    c7 c0 ([0-9a-f]{2} ){4} *       mov    \$0x[a-f0-9]+,%eax
+[      ]*[a-f0-9]+:    c7 c0 ([0-9a-f]{2} ){4} *       mov    \$0x[a-f0-9]+,%eax
+[      ]*[a-f0-9]+:    c7 c0 ([0-9a-f]{2} ){4} *       mov    \$0x[a-f0-9]+,%eax
+[      ]*[a-f0-9]+:    c7 c0 ([0-9a-f]{2} ){4} *       mov    \$0x[a-f0-9]+,%eax
 #pass
index 1245639a19f7014310bf82f409ec1cda1a6eb9f9..1dbba1107fc446259b21897a8ff27735ef2b532e 100644 (file)
@@ -16,7 +16,7 @@ SYMBOL TABLE:
 Disassembly of section .text:
 
 0+20000 <_start>:
-[      ]*[a-f0-9]+:    8d 05 80 00 03 10       lea    0x10030080,%eax
+[      ]*[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
@@ -26,7 +26,7 @@ Disassembly of section .text:
 [      ]*[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]+:    8d 05 80 00 03 10       lea    0x10030080,%eax
+[      ]*[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
@@ -36,7 +36,7 @@ Disassembly of section .text:
 [      ]*[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]+:    8d 05 81 00 03 10       lea    0x10030081,%eax
+[      ]*[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
@@ -46,7 +46,7 @@ Disassembly of section .text:
 [      ]*[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]+:    8d 05 81 00 03 10       lea    0x10030081,%eax
+[      ]*[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
index a252a15efa2c6f8b1a07c5fe799751679fdf9a76..9c4aa8e164e3eec9d916130b8b5b200a1c363420 100644 (file)
@@ -15,7 +15,7 @@ SYMBOL TABLE:
 Disassembly of section .text:
 
 0+8048074 <_start>:
-[      ]*[a-f0-9]+:    8d 05 70 91 04 08       lea    0x8049170,%eax
+[      ]*[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
@@ -25,7 +25,7 @@ Disassembly of section .text:
 [      ]*[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]+:    8d 05 70 91 04 08       lea    0x8049170,%eax
+[      ]*[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
@@ -35,7 +35,7 @@ Disassembly of section .text:
 [      ]*[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]+:    8d 05 71 91 04 08       lea    0x8049171,%eax
+[      ]*[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
@@ -45,7 +45,7 @@ Disassembly of section .text:
 [      ]*[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]+:    8d 05 71 91 04 08       lea    0x8049171,%eax
+[      ]*[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
index 0f6f4e27e5dd8a93b71f5550e87f7e135c936a4c..9d1732b40f3df3bf67238a55bec7292fe7e379e9 100644 (file)
@@ -9,5 +9,5 @@
 Disassembly of section .text:
 
 #...
-[      ]*[a-f0-9]+:    8d 05 ([0-9a-f]{2} ){4} *       lea    0x[a-f0-9]+,%eax
+[      ]*[a-f0-9]+:    c7 c0 ([0-9a-f]{2} ){4} *       mov    \$0x[a-f0-9]+,%eax
 #pass
index 6db0b2839f2a829adfbbb12f943e09045b4999ac..96726a452dc4ad4cbf8ddf6fe4350180c1f367d4 100644 (file)
@@ -9,5 +9,5 @@
 Disassembly of section .text:
 
 #...
-[      ]*[a-f0-9]+:    8d 05 ([0-9a-f]{2} ){4} *       lea    0x[a-f0-9]+,%eax
+[      ]*[a-f0-9]+:    c7 c0 ([0-9a-f]{2} ){4} *       mov    \$0x[a-f0-9]+,%eax
 #pass
index ae40862384e702a0033c7d2c71ff6df7fdc38376..1b7cc2fa727daf6b900e40d03a19dbc81a421a5c 100644 (file)
@@ -1,6 +1,6 @@
 #source: mov1.s
 #as: --32
-#ld: -pie -melf_i386
+#ld: -pie -melf_i386 --no-dynamic-linker
 #objdump: -dw
 
 .*: +file format .*
@@ -10,6 +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
+[      ]*[a-f0-9]+:    c7 c0 00 00 00 00 *     mov    \$0x0,%eax
+[      ]*[a-f0-9]+:    c7 c0 00 00 00 00 *     mov    \$0x0,%eax
 #pass
diff --git a/ld/testsuite/ld-i386/pr19609-1.s b/ld/testsuite/ld-i386/pr19609-1.s
new file mode 100644 (file)
index 0000000..f0b8eac
--- /dev/null
@@ -0,0 +1,12 @@
+       .text
+       .weak bar
+       .globl  _start
+       .type   _start, @function
+_start:
+       cmp     bar@GOT(%edx), %eax
+       cmp     bar@GOT(%edx), %ecx
+       mov     bar@GOT(%edx), %eax
+       mov     bar@GOT(%edx), %ecx
+       test    bar@GOT(%edx), %eax
+       test    bar@GOT(%edx), %ecx
+       .size   _start, .-_start
diff --git a/ld/testsuite/ld-i386/pr19609-1a.d b/ld/testsuite/ld-i386/pr19609-1a.d
new file mode 100644 (file)
index 0000000..214adaf
--- /dev/null
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    81 f8 00 00 00 00       cmp    \$0x0,%eax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    c7 c0 00 00 00 00       mov    \$0x0,%eax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    f7 c0 00 00 00 00       test   \$0x0,%eax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1b.d b/ld/testsuite/ld-i386/pr19609-1b.d
new file mode 100644 (file)
index 0000000..ebd6bc9
--- /dev/null
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -melf_i386 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    81 f8 00 00 00 00       cmp    \$0x0,%eax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    c7 c0 00 00 00 00       mov    \$0x0,%eax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    f7 c0 00 00 00 00       test   \$0x0,%eax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1c.d b/ld/testsuite/ld-i386/pr19609-1c.d
new file mode 100644 (file)
index 0000000..e7d1c13
--- /dev/null
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -shared -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    3b 82 fc ff ff ff       cmp    -0x4\(%edx\),%eax
+[      ]*[a-f0-9]+:    3b 8a fc ff ff ff       cmp    -0x4\(%edx\),%ecx
+[      ]*[a-f0-9]+:    8b 82 fc ff ff ff       mov    -0x4\(%edx\),%eax
+[      ]*[a-f0-9]+:    8b 8a fc ff ff ff       mov    -0x4\(%edx\),%ecx
+[      ]*[a-f0-9]+:    85 82 fc ff ff ff       test   %eax,-0x4\(%edx\)
+[      ]*[a-f0-9]+:    85 8a fc ff ff ff       test   %ecx,-0x4\(%edx\)
diff --git a/ld/testsuite/ld-i386/pr19609-1d.d b/ld/testsuite/ld-i386/pr19609-1d.d
new file mode 100644 (file)
index 0000000..4b50f8c
--- /dev/null
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -E -melf_i386 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    81 f8 00 00 00 00       cmp    \$0x0,%eax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    c7 c0 00 00 00 00       mov    \$0x0,%eax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    f7 c0 00 00 00 00       test   \$0x0,%eax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1e.d b/ld/testsuite/ld-i386/pr19609-1e.d
new file mode 100644 (file)
index 0000000..a515ad6
--- /dev/null
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -shared -E -Bsymbolic -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    3b 82 fc ff ff ff       cmp    -0x4\(%edx\),%eax
+[      ]*[a-f0-9]+:    3b 8a fc ff ff ff       cmp    -0x4\(%edx\),%ecx
+[      ]*[a-f0-9]+:    8b 82 fc ff ff ff       mov    -0x4\(%edx\),%eax
+[      ]*[a-f0-9]+:    8b 8a fc ff ff ff       mov    -0x4\(%edx\),%ecx
+[      ]*[a-f0-9]+:    85 82 fc ff ff ff       test   %eax,-0x4\(%edx\)
+[      ]*[a-f0-9]+:    85 8a fc ff ff ff       test   %ecx,-0x4\(%edx\)
diff --git a/ld/testsuite/ld-i386/pr19609-1f.d b/ld/testsuite/ld-i386/pr19609-1f.d
new file mode 100644 (file)
index 0000000..99ed5bb
--- /dev/null
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie --dynamic-list-data -melf_i386 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    81 f8 00 00 00 00       cmp    \$0x0,%eax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    c7 c0 00 00 00 00       mov    \$0x0,%eax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    f7 c0 00 00 00 00       test   \$0x0,%eax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1g.d b/ld/testsuite/ld-i386/pr19609-1g.d
new file mode 100644 (file)
index 0000000..2fc9731
--- /dev/null
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -E -melf_i386 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    81 f8 00 00 00 00       cmp    \$0x0,%eax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    c7 c0 00 00 00 00       mov    \$0x0,%eax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    f7 c0 00 00 00 00       test   \$0x0,%eax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1h.d b/ld/testsuite/ld-i386/pr19609-1h.d
new file mode 100644 (file)
index 0000000..79fe5d5
--- /dev/null
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -E -Bsymbolic-functions -melf_i386 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    81 f8 00 00 00 00       cmp    \$0x0,%eax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    c7 c0 00 00 00 00       mov    \$0x0,%eax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    f7 c0 00 00 00 00       test   \$0x0,%eax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
diff --git a/ld/testsuite/ld-i386/pr19609-1i.d b/ld/testsuite/ld-i386/pr19609-1i.d
new file mode 100644 (file)
index 0000000..ce15bc9
--- /dev/null
@@ -0,0 +1,17 @@
+#source: pr19609-1.s
+#as: --32 -mrelax-relocations=no
+#ld: -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    3b 82 fc ff ff ff       cmp    -0x4\(%edx\),%eax
+[      ]*[a-f0-9]+:    3b 8a fc ff ff ff       cmp    -0x4\(%edx\),%ecx
+[      ]*[a-f0-9]+:    c7 c0 00 00 00 00       mov    \$0x0,%eax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    85 82 fc ff ff ff       test   %eax,-0x4\(%edx\)
+[      ]*[a-f0-9]+:    85 8a fc ff ff ff       test   %ecx,-0x4\(%edx\)
diff --git a/ld/testsuite/ld-i386/pr19609-2.s b/ld/testsuite/ld-i386/pr19609-2.s
new file mode 100644 (file)
index 0000000..622dbd4
--- /dev/null
@@ -0,0 +1,6 @@
+       .text
+       .weak bar
+       .globl  _start
+       .type   _start, @function
+_start:
+       call    *bar@GOT(%edx)
diff --git a/ld/testsuite/ld-i386/pr19609-2a.d b/ld/testsuite/ld-i386/pr19609-2a.d
new file mode 100644 (file)
index 0000000..ea1e461
--- /dev/null
@@ -0,0 +1,12 @@
+#source: pr19609-2.s
+#as: --32 -mrelax-relocations=yes
+#ld: -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[        ]+addr16 call 0 <_start-0x[0-9a-f]+>
diff --git a/ld/testsuite/ld-i386/pr19609-2b.d b/ld/testsuite/ld-i386/pr19609-2b.d
new file mode 100644 (file)
index 0000000..a4bf598
--- /dev/null
@@ -0,0 +1,12 @@
+#source: pr19609-2.s
+#as: --32 -mrelax-relocations=yes
+#ld: -pie -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    ff 92 fc ff ff ff       call   \*-0x4\(%edx\)
diff --git a/ld/testsuite/ld-i386/pr19609-2c.d b/ld/testsuite/ld-i386/pr19609-2c.d
new file mode 100644 (file)
index 0000000..2553f8a
--- /dev/null
@@ -0,0 +1,12 @@
+#source: pr19609-2.s
+#as: --32 -mrelax-relocations=yes
+#ld: -shared -melf_i386
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    ff 92 fc ff ff ff       call   \*-0x4\(%edx\)
diff --git a/ld/testsuite/ld-i386/undefweak.s b/ld/testsuite/ld-i386/undefweak.s
new file mode 100644 (file)
index 0000000..f34c917
--- /dev/null
@@ -0,0 +1,10 @@
+       .text
+       .globl _start
+_start:
+       mov     .Ljmp(%eax), %eax
+       jmp     *(%eax)
+       .section        .data.rel.ro.local,"aw",@progbits
+       .weak func
+       .align  8
+.Ljmp:
+       .long func
diff --git a/ld/testsuite/ld-i386/undefweaka.d b/ld/testsuite/ld-i386/undefweaka.d
new file mode 100644 (file)
index 0000000..c106ebf
--- /dev/null
@@ -0,0 +1,9 @@
+#source: undefweak.s
+#as: --32
+#ld: -shared -melf_i386
+#readelf: -r --wide
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 2 entries:
+ Offset     Info    Type                Sym. Value  Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
+[0-9a-f]+ +[0-9a-f]+ +R_386_32 +[0-9a-f]+ +func
diff --git a/ld/testsuite/ld-i386/undefweakb.d b/ld/testsuite/ld-i386/undefweakb.d
new file mode 100644 (file)
index 0000000..48ebad8
--- /dev/null
@@ -0,0 +1,11 @@
+#source: undefweak.s
+#as: --32
+#ld: -pie -melf_i386
+#readelf: -r --wide -x .data.rel.ro
+
+Relocation section '.rel.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+ Offset     Info    Type                Sym. Value  Symbol's Name
+[0-9a-f]+ +[0-9a-f]+ +R_386_RELATIVE +
+
+Hex dump of section '.data.rel.ro':
+  0x[a-f0-9]+ 00000000                            ....
index c7ca8113f8300fc633c3e59216185df592335a22..36fcfc093e11b3ec5a935b979854ad3941347750 100644 (file)
 [      ]*[a-f0-9]+:    03 83 0c 00 00 00       add    0xc\(%ebx\),%eax
 [      ]*[a-f0-9]+:    8b 83 0c 00 00 00       mov    0xc\(%ebx\),%eax
 [      ]*[a-f0-9]+:    85 83 0c 00 00 00       test   %eax,0xc\(%ebx\)
-[      ]*[a-f0-9]+:    8d ([0-9a-f]{2} ){5}[   ]+lea[  ]+.*
+[      ]*[a-f0-9]+:    c7 c0 b5 80 04 08       mov    \$0x80480b5,%eax
+
+0+80480b4 <foo>:
+[      ]*[a-f0-9]+:    c3                      ret    
+
+0+80480b5 <bar>:
+[      ]*[a-f0-9]+:    c3                      ret    
 #pass
index ae75487f421d2e03935dc8d25b557adc6dce9d39..e28734e1cfc5aea872b0dd6bb207e5be56fa91aa 100644 (file)
 [      ]*[a-f0-9]+:    48 03 05 35 00 20 00    add    0x200035\(%rip\),%rax        # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
 [      ]*[a-f0-9]+:    48 8b 05 2e 00 20 00    mov    0x20002e\(%rip\),%rax        # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
 [      ]*[a-f0-9]+:    48 85 05 27 00 20 00    test   %rax,0x200027\(%rip\)        # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
-[      ]*[a-f0-9]+:    48 8d ([0-9a-f]{2} ){5}[        ]+lea[  ]+.*
+[      ]*[a-f0-9]+:    48 c7 c0 09 01 40 00    mov    \$0x400109,%rax
+
+0+400108 <foo>:
+[      ]*[a-f0-9]+:    c3                      retq   
+
+0+400109 <bar>:
+[      ]*[a-f0-9]+:    c3                      retq   
 #pass
index c7ca8113f8300fc633c3e59216185df592335a22..36fcfc093e11b3ec5a935b979854ad3941347750 100644 (file)
 [      ]*[a-f0-9]+:    03 83 0c 00 00 00       add    0xc\(%ebx\),%eax
 [      ]*[a-f0-9]+:    8b 83 0c 00 00 00       mov    0xc\(%ebx\),%eax
 [      ]*[a-f0-9]+:    85 83 0c 00 00 00       test   %eax,0xc\(%ebx\)
-[      ]*[a-f0-9]+:    8d ([0-9a-f]{2} ){5}[   ]+lea[  ]+.*
+[      ]*[a-f0-9]+:    c7 c0 b5 80 04 08       mov    \$0x80480b5,%eax
+
+0+80480b4 <foo>:
+[      ]*[a-f0-9]+:    c3                      ret    
+
+0+80480b5 <bar>:
+[      ]*[a-f0-9]+:    c3                      ret    
 #pass
index ae75487f421d2e03935dc8d25b557adc6dce9d39..e28734e1cfc5aea872b0dd6bb207e5be56fa91aa 100644 (file)
 [      ]*[a-f0-9]+:    48 03 05 35 00 20 00    add    0x200035\(%rip\),%rax        # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
 [      ]*[a-f0-9]+:    48 8b 05 2e 00 20 00    mov    0x20002e\(%rip\),%rax        # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
 [      ]*[a-f0-9]+:    48 85 05 27 00 20 00    test   %rax,0x200027\(%rip\)        # 600128 <_GLOBAL_OFFSET_TABLE_\+0x18>
-[      ]*[a-f0-9]+:    48 8d ([0-9a-f]{2} ){5}[        ]+lea[  ]+.*
+[      ]*[a-f0-9]+:    48 c7 c0 09 01 40 00    mov    \$0x400109,%rax
+
+0+400108 <foo>:
+[      ]*[a-f0-9]+:    c3                      retq   
+
+0+400109 <bar>:
+[      ]*[a-f0-9]+:    c3                      retq   
 #pass
index 187a1a58bb4ba542bb3e81a3e13d19d0b4bdb78b..46321dbba469c11d29e17bf7689bb69be40884bd 100644 (file)
@@ -4,7 +4,7 @@
 [      ]*[a-f0-9]+:    [ a-f0-9]+      addr32 callq [a-f0-9]+ <foo>
 [      ]*[a-f0-9]+:    [ a-f0-9]+      callq  \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
 [      ]*[a-f0-9]+:    [ a-f0-9]+      callq  \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
-[      ]*[a-f0-9]+:    [ a-f0-9]+      lea    0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <foo>
+[      ]*[a-f0-9]+:    [ a-f0-9]+      (rex mov|mov   ) \$0x[a-f0-9]+,%(r|e)ax
 [      ]*[a-f0-9]+:    ff d0                   callq  \*%rax
 [      ]*[a-f0-9]+:    [ a-f0-9]+      mov    0x[a-f0-9]+\(%rip\),%rcx        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
 [      ]*[a-f0-9]+:    ff d1                   callq  \*%rcx
index 07a2e35473425efd87ed49bc610485892cd06ab8..2c9982e16dc2c44bc3365265722fba55c322351a 100644 (file)
@@ -9,10 +9,12 @@ foo:
        .globl  _start
        .type   _start, @function
 _start:
+       movl    foo@GOTPCREL(%rip), %eax
+       movl    bar@GOTPCREL(%rip), %r11d
        movq    foo@GOTPCREL(%rip), %rax
-       movq    bar@GOTPCREL(%rip), %rax
+       movq    bar@GOTPCREL(%rip), %r11
        movq    __start_my_section@GOTPCREL(%rip), %rax
-       movq    __stop_my_section@GOTPCREL(%rip), %rax
+       movq    __stop_my_section@GOTPCREL(%rip), %r11
        .size   _start, .-_start
        .comm   pad,4,4
        .comm   bar,4,4
index 36e9f546d30ff0db285ea88446df31db1e327232..9b662cb839fc12d551836adf8ab1b3824d5a9098 100644 (file)
@@ -9,8 +9,11 @@
 Disassembly of section .text:
 
 #...
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    8d 05 ([0-9a-f]{2} ){4} *       lea    -0x[a-f0-9]+\(%rip\),%eax        # [a-f0-9]+ <foo>
+[      ]*[a-f0-9]+:    44 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11d        # [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]+ <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]+:    4c 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11        # [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>
+[      ]*[a-f0-9]+:    4c 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <__stop_my_section>
 #pass
index a92acd73e0544d66cbbccd96f0254634b548b436..9108149b3a3842f78f1aed193797af10aa260b07 100644 (file)
@@ -9,8 +9,11 @@
 Disassembly of section .text:
 
 #...
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    8d 05 ([0-9a-f]{2} ){4} *       lea    -0x[a-f0-9]+\(%rip\),%eax        # [a-f0-9]+ <foo>
+[      ]*[a-f0-9]+:    44 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11d        # [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]+ <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]+:    4c 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11        # [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>
+[      ]*[a-f0-9]+:    4c 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <__stop_my_section>
 #pass
index 072b1ee09831c999713214cb1da8480a8c1f998a..68fec03d1050320d3d45169fdb535379d69d080c 100644 (file)
@@ -1,5 +1,5 @@
 #source: lea1.s
-#as: --64
+#as: --64 -mrelax-relocations=yes
 #ld: -melf_x86_64
 #objdump: -dw
 
@@ -9,8 +9,11 @@
 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>
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    c7 c0 ([0-9a-f]{2} ){4} *       mov    \$0x[a-f0-9]+,%eax
+[      ]*[a-f0-9]+:    41 c7 c3 ([0-9a-f]{2} ){4} *    mov    \$0x[a-f0-9]+,%r11d
+[      ]*[a-f0-9]+:    48 c7 c0 ([0-9a-f]{2} ){4} *    mov    \$0x[a-f0-9]+,%rax
+[      ]*[a-f0-9]+:    49 c7 c3 ([0-9a-f]{2} ){4} *    mov    \$0x[a-f0-9]+,%r11
+[      ]*[a-f0-9]+:    48 c7 c0 ([0-9a-f]{2} ){4} *    mov    \$0x[a-f0-9]+,%rax
+[      ]*[a-f0-9]+:    49 c7 c3 ([0-9a-f]{2} ){4} *    mov    \$0x[a-f0-9]+,%r11
 #pass
index 2613061b948954e2805f5f8d798257cacb57c845..4d708d22c3a082d41e789fed6984535fade45a9e 100644 (file)
@@ -9,8 +9,11 @@
 Disassembly of section .text:
 
 #...
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    8d 05 ([0-9a-f]{2} ){4} *       lea    -0x[a-f0-9]+\(%rip\),%eax        # [a-f0-9]+ <foo>
+[      ]*[a-f0-9]+:    44 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11d        # [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]+ <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]+:    4c 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11        # [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>
+[      ]*[a-f0-9]+:    4c 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <__stop_my_section>
 #pass
index 109c1cd1be9ea856440c853f280d6ed3c316a91d..da6013791810bc492872300453764b2ca2cfe22c 100644 (file)
@@ -9,8 +9,11 @@
 Disassembly of section .text:
 
 #...
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    8d 05 ([0-9a-f]{2} ){4} *       lea    -0x[a-f0-9]+\(%rip\),%eax        # [a-f0-9]+ <foo>
+[      ]*[a-f0-9]+:    44 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11d        # [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]+ <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]+:    4c 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11        # [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>
+[      ]*[a-f0-9]+:    4c 8d 1d ([0-9a-f]{2} ){4} *    lea    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <__stop_my_section>
 #pass
index 8d6cd78345451a50399da408e09e7c55af96a5fa..b7abeb30c0cea4c325773ec88ac307523502a52c 100644 (file)
@@ -1,5 +1,5 @@
 #source: lea1.s
-#as: --x32
+#as: --x32 -mrelax-relocations=yes
 #ld: -melf32_x86_64
 #objdump: -dw
 
@@ -9,8 +9,11 @@
 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>
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    c7 c0 ([0-9a-f]{2} ){4} *       mov    \$0x[a-f0-9]+,%eax
+[      ]*[a-f0-9]+:    41 c7 c3 ([0-9a-f]{2} ){4} *    mov    \$0x[a-f0-9]+,%r11d
+[      ]*[a-f0-9]+:    40 c7 c0 ([0-9a-f]{2} ){4} *    rex mov \$0x[a-f0-9]+,%eax
+[      ]*[a-f0-9]+:    41 c7 c3 ([0-9a-f]{2} ){4} *    mov    \$0x[a-f0-9]+,%r11d
+[      ]*[a-f0-9]+:    40 c7 c0 ([0-9a-f]{2} ){4} *    rex mov \$0x[a-f0-9]+,%eax
+[      ]*[a-f0-9]+:    41 c7 c3 ([0-9a-f]{2} ){4} *    mov    \$0x[a-f0-9]+,%r11d
 #pass
index f112c1cba5b70c0f920d3feeb4e51cb211c13edc..74218539d977da5a5f74b69de4c5604890b70480 100644 (file)
@@ -1,6 +1,6 @@
 #source: mov1.s
-#as: --64
-#ld: -pie -melf_x86_64
+#as: --64 -mrelax-relocations=yes
+#ld: -pie -melf_x86_64 --no-dynamic-linker
 #objdump: -dw
 
 .*: +file format .*
@@ -10,6 +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]+>
+[      ]*[a-f0-9]+:    48 c7 c0 00 00 00 00 *  mov    \$0x0,%rax
+[      ]*[a-f0-9]+:    48 c7 c0 00 00 00 00 *  mov    \$0x0,%rax
 #pass
index 794a546f86a8b5937d1cfa464061a30f934f2dd9..7cdab0cd54b59b0a9eb36f0ff62867e9bf13fd54 100644 (file)
@@ -1,6 +1,6 @@
 #source: mov1.s
-#as: --x32
-#ld: -pie -melf32_x86_64
+#as: --x32 -mrelax-relocations=yes
+#ld: -pie -melf32_x86_64 --no-dynamic-linker
 #objdump: -dw
 
 .*: +file format .*
@@ -10,6 +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]+>
+[      ]*[a-f0-9]+:    40 c7 c0 00 00 00 00 *  rex mov \$0x0,%eax
+[      ]*[a-f0-9]+:    40 c7 c0 00 00 00 00 *  rex mov \$0x0,%eax
 #pass
index 766dd741bbbb40429cf259ef0535f8d04eb9181e..c3c3f86153cd013bb89c1130d1846d75139bea4c 100644 (file)
@@ -2,6 +2,9 @@
 #name: PR ld/13082-3 (b)
 #as: --x32
 #ld: -pie -melf32_x86_64
-#readelf: -r --wide
+#readelf: -r -x .data.rel.ro
 
 There are no relocations in this file.
+
+Hex dump of section '.data.rel.ro':
+  0x[a-f0-9]+ 00000000 00000000                   ........
diff --git a/ld/testsuite/ld-x86-64/pr13082-3c.d b/ld/testsuite/ld-x86-64/pr13082-3c.d
new file mode 100644 (file)
index 0000000..9947425
--- /dev/null
@@ -0,0 +1,9 @@
+#source: pr13082-3.s
+#name: PR ld/13082-3 (c)
+#as: --64
+#ld: -shared -melf_x86_64
+#readelf: -r --wide
+
+Relocation section '.rela.dyn' at offset 0x[0-9a-f]+ contains 1 entries:
+    Offset             Info             Type               Symbol's Value  Symbol's Name \+ Addend
+[0-9a-f]+ +[0-9a-f]+ +R_X86_64_64 +[0-9a-f]+ +func \+ 0
diff --git a/ld/testsuite/ld-x86-64/pr13082-3d.d b/ld/testsuite/ld-x86-64/pr13082-3d.d
new file mode 100644 (file)
index 0000000..8385d50
--- /dev/null
@@ -0,0 +1,10 @@
+#source: pr13082-3.s
+#name: PR ld/13082-3 (d)
+#as: --64
+#ld: -pie -melf_x86_64
+#readelf: -r -x .data.rel.ro
+
+There are no relocations in this file.
+
+Hex dump of section '.data.rel.ro':
+  0x[a-f0-9]+ 00000000 00000000                   ........
index 6d4a35b7d65129e907d0ac32b9bbad88780fa8a3..2b7584c289b73d2fc3d630f0452f636ff6f8a4ce 100644 (file)
@@ -2,6 +2,9 @@
 #name: PR ld/13082-4 (b)
 #as: --x32
 #ld: -pie -melf32_x86_64
-#readelf: -r --wide
+#readelf: -r -x .data.rel.ro
 
 There are no relocations in this file.
+
+Hex dump of section '.data.rel.ro':
+  0x[a-f0-9]+ 01000000 00000000                   ........
diff --git a/ld/testsuite/ld-x86-64/pr19609-1.s b/ld/testsuite/ld-x86-64/pr19609-1.s
new file mode 100644 (file)
index 0000000..91cc130
--- /dev/null
@@ -0,0 +1,20 @@
+       .text
+       .weak bar
+       .globl  _start
+       .type   _start, @function
+_start:
+       cmp     bar@GOTPCREL(%rip), %rax
+       cmp     bar@GOTPCREL(%rip), %ecx
+       cmp     bar@GOTPCREL(%rip), %r11
+       cmp     bar@GOTPCREL(%rip), %r12d
+
+       mov     bar@GOTPCREL(%rip), %rax
+       mov     bar@GOTPCREL(%rip), %ecx
+       mov     bar@GOTPCREL(%rip), %r11
+       mov     bar@GOTPCREL(%rip), %r12d
+
+       test    %rax, bar@GOTPCREL(%rip)
+       test    %ecx, bar@GOTPCREL(%rip)
+       test    %r11, bar@GOTPCREL(%rip)
+       test    %r12d, bar@GOTPCREL(%rip)
+       .size   _start, .-_start
diff --git a/ld/testsuite/ld-x86-64/pr19609-1a.d b/ld/testsuite/ld-x86-64/pr19609-1a.d
new file mode 100644 (file)
index 0000000..a908e39
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 --no-relax
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 81 f8 00 00 00 00    cmp    \$0x0,%rax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 81 fb 00 00 00 00    cmp    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 81 fc 00 00 00 00    cmp    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 c7 c0 00 00 00 00    mov    \$0x0,%rax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 c7 c3 00 00 00 00    mov    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 c7 c4 00 00 00 00    mov    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 f7 c0 00 00 00 00    test   \$0x0,%rax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 f7 c3 00 00 00 00    test   \$0x0,%r11
+[      ]*[a-f0-9]+:    41 f7 c4 00 00 00 00    test   \$0x0,%r12d
diff --git a/ld/testsuite/ld-x86-64/pr19609-1b.d b/ld/testsuite/ld-x86-64/pr19609-1b.d
new file mode 100644 (file)
index 0000000..d5e2e85
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --64 -mrelax-relocations=yes
+#ld: -pie -melf_x86_64 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 81 f8 00 00 00 00    cmp    \$0x0,%rax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 81 fb 00 00 00 00    cmp    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 81 fc 00 00 00 00    cmp    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 c7 c0 00 00 00 00    mov    \$0x0,%rax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 c7 c3 00 00 00 00    mov    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 c7 c4 00 00 00 00    mov    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 f7 c0 00 00 00 00    test   \$0x0,%rax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 f7 c3 00 00 00 00    test   \$0x0,%r11
+[      ]*[a-f0-9]+:    41 f7 c4 00 00 00 00    test   \$0x0,%r12d
diff --git a/ld/testsuite/ld-x86-64/pr19609-1c.d b/ld/testsuite/ld-x86-64/pr19609-1c.d
new file mode 100644 (file)
index 0000000..3b1e98d
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --64 -mrelax-relocations=yes
+#ld: -shared -melf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 3b 05 ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    3b 0d ([0-9a-f]{2} ){4} *       cmp    0x[a-f0-9]+\(%rip\),%ecx        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 3b 1d ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 3b 25 ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%r12d        # [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]+:    8b 0d ([0-9a-f]{2} ){4} *       mov    0x[a-f0-9]+\(%rip\),%ecx        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 8b 1d ([0-9a-f]{2} ){4} *    mov    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 8b 25 ([0-9a-f]{2} ){4} *    mov    0x[a-f0-9]+\(%rip\),%r12d        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    48 85 05 ([0-9a-f]{2} ){4} *    test   %rax,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    85 0d ([0-9a-f]{2} ){4} *       test   %ecx,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 85 1d ([0-9a-f]{2} ){4} *    test   %r11,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 85 25 ([0-9a-f]{2} ){4} *    test   %r12d,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
diff --git a/ld/testsuite/ld-x86-64/pr19609-1d.d b/ld/testsuite/ld-x86-64/pr19609-1d.d
new file mode 100644 (file)
index 0000000..980d8dc
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --64 -mrelax-relocations=yes
+#ld: -E -melf_x86_64 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 81 f8 00 00 00 00    cmp    \$0x0,%rax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 81 fb 00 00 00 00    cmp    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 81 fc 00 00 00 00    cmp    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 c7 c0 00 00 00 00    mov    \$0x0,%rax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 c7 c3 00 00 00 00    mov    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 c7 c4 00 00 00 00    mov    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 f7 c0 00 00 00 00    test   \$0x0,%rax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 f7 c3 00 00 00 00    test   \$0x0,%r11
+[      ]*[a-f0-9]+:    41 f7 c4 00 00 00 00    test   \$0x0,%r12d
diff --git a/ld/testsuite/ld-x86-64/pr19609-1e.d b/ld/testsuite/ld-x86-64/pr19609-1e.d
new file mode 100644 (file)
index 0000000..dac5fef
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --64 -mrelax-relocations=yes
+#ld: -shared -E -Bsymbolic -melf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 3b 05 ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    3b 0d ([0-9a-f]{2} ){4} *       cmp    0x[a-f0-9]+\(%rip\),%ecx        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 3b 1d ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 3b 25 ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%r12d        # [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]+:    8b 0d ([0-9a-f]{2} ){4} *       mov    0x[a-f0-9]+\(%rip\),%ecx        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 8b 1d ([0-9a-f]{2} ){4} *    mov    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 8b 25 ([0-9a-f]{2} ){4} *    mov    0x[a-f0-9]+\(%rip\),%r12d        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    48 85 05 ([0-9a-f]{2} ){4} *    test   %rax,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    85 0d ([0-9a-f]{2} ){4} *       test   %ecx,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 85 1d ([0-9a-f]{2} ){4} *    test   %r11,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 85 25 ([0-9a-f]{2} ){4} *    test   %r12d,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
diff --git a/ld/testsuite/ld-x86-64/pr19609-1f.d b/ld/testsuite/ld-x86-64/pr19609-1f.d
new file mode 100644 (file)
index 0000000..93a7f2c
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --64 -mrelax-relocations=yes
+#ld: -pie --dynamic-list-data -melf_x86_64 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 81 f8 00 00 00 00    cmp    \$0x0,%rax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 81 fb 00 00 00 00    cmp    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 81 fc 00 00 00 00    cmp    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 c7 c0 00 00 00 00    mov    \$0x0,%rax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 c7 c3 00 00 00 00    mov    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 c7 c4 00 00 00 00    mov    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 f7 c0 00 00 00 00    test   \$0x0,%rax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 f7 c3 00 00 00 00    test   \$0x0,%r11
+[      ]*[a-f0-9]+:    41 f7 c4 00 00 00 00    test   \$0x0,%r12d
diff --git a/ld/testsuite/ld-x86-64/pr19609-1g.d b/ld/testsuite/ld-x86-64/pr19609-1g.d
new file mode 100644 (file)
index 0000000..05a4964
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --64 -mrelax-relocations=yes
+#ld: -pie -E -melf_x86_64 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 81 f8 00 00 00 00    cmp    \$0x0,%rax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 81 fb 00 00 00 00    cmp    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 81 fc 00 00 00 00    cmp    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 c7 c0 00 00 00 00    mov    \$0x0,%rax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 c7 c3 00 00 00 00    mov    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 c7 c4 00 00 00 00    mov    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 f7 c0 00 00 00 00    test   \$0x0,%rax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 f7 c3 00 00 00 00    test   \$0x0,%r11
+[      ]*[a-f0-9]+:    41 f7 c4 00 00 00 00    test   \$0x0,%r12d
diff --git a/ld/testsuite/ld-x86-64/pr19609-1h.d b/ld/testsuite/ld-x86-64/pr19609-1h.d
new file mode 100644 (file)
index 0000000..5675076
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --x32 -mrelax-relocations=yes
+#ld: -melf32_x86_64 --no-relax
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 81 f8 00 00 00 00    cmp    \$0x0,%rax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 81 fb 00 00 00 00    cmp    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 81 fc 00 00 00 00    cmp    \$0x0,%r12d
+[      ]*[a-f0-9]+:    40 c7 c0 00 00 00 00    rex mov \$0x0,%eax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    41 c7 c3 00 00 00 00    mov    \$0x0,%r11d
+[      ]*[a-f0-9]+:    41 c7 c4 00 00 00 00    mov    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 f7 c0 00 00 00 00    test   \$0x0,%rax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 f7 c3 00 00 00 00    test   \$0x0,%r11
+[      ]*[a-f0-9]+:    41 f7 c4 00 00 00 00    test   \$0x0,%r12d
diff --git a/ld/testsuite/ld-x86-64/pr19609-1i.d b/ld/testsuite/ld-x86-64/pr19609-1i.d
new file mode 100644 (file)
index 0000000..8ef42ad
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --x32 -mrelax-relocations=yes
+#ld: -pie -melf32_x86_64 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 81 f8 00 00 00 00    cmp    \$0x0,%rax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 81 fb 00 00 00 00    cmp    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 81 fc 00 00 00 00    cmp    \$0x0,%r12d
+[      ]*[a-f0-9]+:    40 c7 c0 00 00 00 00    rex mov \$0x0,%eax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    41 c7 c3 00 00 00 00    mov    \$0x0,%r11d
+[      ]*[a-f0-9]+:    41 c7 c4 00 00 00 00    mov    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 f7 c0 00 00 00 00    test   \$0x0,%rax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 f7 c3 00 00 00 00    test   \$0x0,%r11
+[      ]*[a-f0-9]+:    41 f7 c4 00 00 00 00    test   \$0x0,%r12d
diff --git a/ld/testsuite/ld-x86-64/pr19609-1j.d b/ld/testsuite/ld-x86-64/pr19609-1j.d
new file mode 100644 (file)
index 0000000..4a36a70
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --x32
+#ld: -shared -melf32_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 3b 05 ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    3b 0d ([0-9a-f]{2} ){4} *       cmp    0x[a-f0-9]+\(%rip\),%ecx        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 3b 1d ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 3b 25 ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%r12d        # [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]+:    8b 0d ([0-9a-f]{2} ){4} *       mov    0x[a-f0-9]+\(%rip\),%ecx        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 8b 1d ([0-9a-f]{2} ){4} *    mov    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 8b 25 ([0-9a-f]{2} ){4} *    mov    0x[a-f0-9]+\(%rip\),%r12d        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    48 85 05 ([0-9a-f]{2} ){4} *    test   %rax,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    85 0d ([0-9a-f]{2} ){4} *       test   %ecx,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 85 1d ([0-9a-f]{2} ){4} *    test   %r11,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 85 25 ([0-9a-f]{2} ){4} *    test   %r12d,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
diff --git a/ld/testsuite/ld-x86-64/pr19609-1k.d b/ld/testsuite/ld-x86-64/pr19609-1k.d
new file mode 100644 (file)
index 0000000..faab0df
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --64 -mrelax-relocations=yes
+#ld: -pie -E -Bsymbolic-functions -melf_x86_64 --no-dynamic-linker
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 81 f8 00 00 00 00    cmp    \$0x0,%rax
+[      ]*[a-f0-9]+:    81 f9 00 00 00 00       cmp    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 81 fb 00 00 00 00    cmp    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 81 fc 00 00 00 00    cmp    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 c7 c0 00 00 00 00    mov    \$0x0,%rax
+[      ]*[a-f0-9]+:    c7 c1 00 00 00 00       mov    \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 c7 c3 00 00 00 00    mov    \$0x0,%r11
+[      ]*[a-f0-9]+:    41 c7 c4 00 00 00 00    mov    \$0x0,%r12d
+[      ]*[a-f0-9]+:    48 f7 c0 00 00 00 00    test   \$0x0,%rax
+[      ]*[a-f0-9]+:    f7 c1 00 00 00 00       test   \$0x0,%ecx
+[      ]*[a-f0-9]+:    49 f7 c3 00 00 00 00    test   \$0x0,%r11
+[      ]*[a-f0-9]+:    41 f7 c4 00 00 00 00    test   \$0x0,%r12d
diff --git a/ld/testsuite/ld-x86-64/pr19609-1l.d b/ld/testsuite/ld-x86-64/pr19609-1l.d
new file mode 100644 (file)
index 0000000..aedf5d8
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --64 -mrelax-relocations=no
+#ld: -melf_x86_64 --no-relax
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 3b 05 ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    3b 0d ([0-9a-f]{2} ){4} *       cmp    0x[a-f0-9]+\(%rip\),%ecx        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 3b 1d ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 3b 25 ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%r12d        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    48 8d 05 ([0-9a-f]{2} ){4} *    lea    -0x[a-f0-9]+\(%rip\),%rax        # 0 <_start-0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    8d 0d ([0-9a-f]{2} ){4} *       lea    -0x[a-f0-9]+\(%rip\),%ecx        # 0 <_start-0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 8d 1d ([0-9a-f]{2} ){4} *    lea    -0x[a-f0-9]+\(%rip\),%r11        # 0 <_start-0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 8d 25 ([0-9a-f]{2} ){4} *    lea    -0x[a-f0-9]+\(%rip\),%r12d        # 0 <_start-0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    48 85 05 ([0-9a-f]{2} ){4} *    test   %rax,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    85 0d ([0-9a-f]{2} ){4} *       test   %ecx,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 85 1d ([0-9a-f]{2} ){4} *    test   %r11,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 85 25 ([0-9a-f]{2} ){4} *    test   %r12d,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
diff --git a/ld/testsuite/ld-x86-64/pr19609-1m.d b/ld/testsuite/ld-x86-64/pr19609-1m.d
new file mode 100644 (file)
index 0000000..8e80cbb
--- /dev/null
@@ -0,0 +1,23 @@
+#source: pr19609-1.s
+#as: --64 -mrelax-relocations=no
+#ld: -pie -melf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 3b 05 ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    3b 0d ([0-9a-f]{2} ){4} *       cmp    0x[a-f0-9]+\(%rip\),%ecx        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 3b 1d ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 3b 25 ([0-9a-f]{2} ){4} *    cmp    0x[a-f0-9]+\(%rip\),%r12d        # [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]+:    8b 0d ([0-9a-f]{2} ){4} *       mov    0x[a-f0-9]+\(%rip\),%ecx        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 8b 1d ([0-9a-f]{2} ){4} *    mov    0x[a-f0-9]+\(%rip\),%r11        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 8b 25 ([0-9a-f]{2} ){4} *    mov    0x[a-f0-9]+\(%rip\),%r12d        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    48 85 05 ([0-9a-f]{2} ){4} *    test   %rax,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    85 0d ([0-9a-f]{2} ){4} *       test   %ecx,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    4c 85 1d ([0-9a-f]{2} ){4} *    test   %r11,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
+[      ]*[a-f0-9]+:    44 85 25 ([0-9a-f]{2} ){4} *    test   %r12d,0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
diff --git a/ld/testsuite/ld-x86-64/pr19609-2.s b/ld/testsuite/ld-x86-64/pr19609-2.s
new file mode 100644 (file)
index 0000000..d52ec9d
--- /dev/null
@@ -0,0 +1,9 @@
+       .data
+foo:
+       .quad   0
+       .text
+       .globl  _start
+       .type   _start, @function
+_start:
+       cmpq    foo@GOTPCREL(%rip), %rax
+       .size   _start, .-_start
diff --git a/ld/testsuite/ld-x86-64/pr19609-2a.d b/ld/testsuite/ld-x86-64/pr19609-2a.d
new file mode 100644 (file)
index 0000000..e2c6c89
--- /dev/null
@@ -0,0 +1,4 @@
+#source: pr19609-2.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000
+#error: .*relocation truncated to fit: R_X86_64_32S .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-2b.d b/ld/testsuite/ld-x86-64/pr19609-2b.d
new file mode 100644 (file)
index 0000000..ead4987
--- /dev/null
@@ -0,0 +1,4 @@
+#source: pr19609-2.s
+#as: --x32 -mrelax-relocations=yes
+#ld: -melf32_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000
+#error: .*relocation truncated to fit: R_X86_64_32S .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-2c.d b/ld/testsuite/ld-x86-64/pr19609-2c.d
new file mode 100644 (file)
index 0000000..458b08a
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19609-2.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 --no-relax
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+70000000 <_start>:
+[      ]*[a-f0-9]+:    48 3b 05 ([0-9a-f]{2} ){4}      cmp    -?0x[a-f0-9]+\(%rip\),%rax        # .*
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19609-2d.d b/ld/testsuite/ld-x86-64/pr19609-2d.d
new file mode 100644 (file)
index 0000000..32c4c8f
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19609-2.s
+#as: --x32 -mrelax-relocations=yes
+#ld: -melf32_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 --no-relax
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+70000000 <_start>:
+#pass
+[      ]*[a-f0-9]+:    48 3b 05 ([0-9a-f]{2} ){4}      cmp    -?0x[a-f0-9]+\(%rip\),%rax        # .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-3.s b/ld/testsuite/ld-x86-64/pr19609-3.s
new file mode 100644 (file)
index 0000000..b152946
--- /dev/null
@@ -0,0 +1,10 @@
+       .data
+foo:
+       .quad   0
+       .text
+       .globl  _start
+       .type   _start, @function
+_start:
+       cmpl    foo@GOTPCREL(%rip), %eax
+       cmpl    foo@GOTPCREL(%rip), %r11d
+       .size   _start, .-_start
diff --git a/ld/testsuite/ld-x86-64/pr19609-3a.d b/ld/testsuite/ld-x86-64/pr19609-3a.d
new file mode 100644 (file)
index 0000000..3248bb2
--- /dev/null
@@ -0,0 +1,14 @@
+#source: pr19609-3.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+70000000 <_start>:
+[      ]*[a-f0-9]+:    81 f8 00 00 00 a0       cmp    \$0xa0000000,%eax
+[      ]*[a-f0-9]+:    41 81 fb 00 00 00 a0    cmp    \$0xa0000000,%r11d
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19609-3b.d b/ld/testsuite/ld-x86-64/pr19609-3b.d
new file mode 100644 (file)
index 0000000..52ca5b7
--- /dev/null
@@ -0,0 +1,14 @@
+#source: pr19609-3.s
+#as: --x32 -mrelax-relocations=yes
+#ld: -melf32_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+70000000 <_start>:
+[      ]*[a-f0-9]+:    81 f8 00 00 00 a0       cmp    \$0xa0000000,%eax
+[      ]*[a-f0-9]+:    41 81 fb 00 00 00 a0    cmp    \$0xa0000000,%r11d
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19609-4.s b/ld/testsuite/ld-x86-64/pr19609-4.s
new file mode 100644 (file)
index 0000000..3db3ebb
--- /dev/null
@@ -0,0 +1,10 @@
+       .data
+foo:
+       .quad   0
+       .text
+       .globl  _start
+       .type   _start, @function
+_start:
+       movq    foo@GOTPCREL(%rip), %rax
+       movq    foo@GOTPCREL(%rip), %r11
+       .size   _start, .-_start
diff --git a/ld/testsuite/ld-x86-64/pr19609-4a.d b/ld/testsuite/ld-x86-64/pr19609-4a.d
new file mode 100644 (file)
index 0000000..ce952ed
--- /dev/null
@@ -0,0 +1,5 @@
+#source: pr19609-4.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000
+#error: .*relocation truncated to fit: R_X86_64_32S .*
+#error: .*relocation truncated to fit: R_X86_64_32S .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-4b.d b/ld/testsuite/ld-x86-64/pr19609-4b.d
new file mode 100644 (file)
index 0000000..cb92aa6
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19609-4.s
+#as: --x32 -mrelax-relocations=yes
+#ld: -melf32_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+70000000 <_start>:
+[      ]*[a-f0-9]+:    40 c7 c0 00 00 00 a0    rex mov \$0xa0000000,%eax
+[      ]*[a-f0-9]+:    41 c7 c3 00 00 00 a0    mov    \$0xa0000000,%r11d
diff --git a/ld/testsuite/ld-x86-64/pr19609-4c.d b/ld/testsuite/ld-x86-64/pr19609-4c.d
new file mode 100644 (file)
index 0000000..ce952ed
--- /dev/null
@@ -0,0 +1,5 @@
+#source: pr19609-4.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000
+#error: .*relocation truncated to fit: R_X86_64_32S .*
+#error: .*relocation truncated to fit: R_X86_64_32S .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-4d.d b/ld/testsuite/ld-x86-64/pr19609-4d.d
new file mode 100644 (file)
index 0000000..cb92aa6
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19609-4.s
+#as: --x32 -mrelax-relocations=yes
+#ld: -melf32_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+70000000 <_start>:
+[      ]*[a-f0-9]+:    40 c7 c0 00 00 00 a0    rex mov \$0xa0000000,%eax
+[      ]*[a-f0-9]+:    41 c7 c3 00 00 00 a0    mov    \$0xa0000000,%r11d
diff --git a/ld/testsuite/ld-x86-64/pr19609-4e.d b/ld/testsuite/ld-x86-64/pr19609-4e.d
new file mode 100644 (file)
index 0000000..527fe5d
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19609-4.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 -Ttext=0x70000000 -Tdata=0xa0000000 --no-relax
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+70000000 <_start>:
+[      ]*[a-f0-9]+:    48 8d 05 f9 ff ff 2f    lea    0x2ffffff9\(%rip\),%rax        # a0000000 <foo>
+[      ]*[a-f0-9]+:    4c 8d 1d f2 ff ff 2f    lea    0x2ffffff2\(%rip\),%r11        # a0000000 <foo>
diff --git a/ld/testsuite/ld-x86-64/pr19609-5.s b/ld/testsuite/ld-x86-64/pr19609-5.s
new file mode 100644 (file)
index 0000000..85106bb
--- /dev/null
@@ -0,0 +1,6 @@
+       .text
+       .weak bar
+       .globl  _start
+       .type   _start, @function
+_start:
+       call    *bar@GOTPCREL(%rip)
diff --git a/ld/testsuite/ld-x86-64/pr19609-5a.d b/ld/testsuite/ld-x86-64/pr19609-5a.d
new file mode 100644 (file)
index 0000000..39948e0
--- /dev/null
@@ -0,0 +1,12 @@
+#source: pr19609-5.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]+[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4}[        ]+addr32 callq 0 <_start-0x[0-9a-f]+>
diff --git a/ld/testsuite/ld-x86-64/pr19609-5b.d b/ld/testsuite/ld-x86-64/pr19609-5b.d
new file mode 100644 (file)
index 0000000..4183d56
--- /dev/null
@@ -0,0 +1,12 @@
+#source: pr19609-5.s
+#as: --64 -mrelax-relocations=yes
+#ld: -pie -melf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]+[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4} *       callq  \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
diff --git a/ld/testsuite/ld-x86-64/pr19609-5c.d b/ld/testsuite/ld-x86-64/pr19609-5c.d
new file mode 100644 (file)
index 0000000..4eaeb2b
--- /dev/null
@@ -0,0 +1,12 @@
+#source: pr19609-5.s
+#as: --64 -mrelax-relocations=yes
+#ld: -shared -melf_x86_64
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]+[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4} *       callq  \*0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <_DYNAMIC\+0x[a-f0-9]+>
diff --git a/ld/testsuite/ld-x86-64/pr19609-5d.d b/ld/testsuite/ld-x86-64/pr19609-5d.d
new file mode 100644 (file)
index 0000000..959c63e
--- /dev/null
@@ -0,0 +1,4 @@
+#source: pr19609-5.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 -Ttext=0x80000000
+#error: .*relocation truncated to fit: R_X86_64_PC32 .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-5e.d b/ld/testsuite/ld-x86-64/pr19609-5e.d
new file mode 100644 (file)
index 0000000..b6b6c65
--- /dev/null
@@ -0,0 +1,12 @@
+#source: pr19609-5.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 -Ttext=0x80000000 --no-relax
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]+[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4} *       callq  \*-?0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <[0-9a-zA-Z_]+[\+\-]+0x[a-f0-9]+>
diff --git a/ld/testsuite/ld-x86-64/pr19609-6.s b/ld/testsuite/ld-x86-64/pr19609-6.s
new file mode 100644 (file)
index 0000000..4e3fc23
--- /dev/null
@@ -0,0 +1,6 @@
+       .text
+       .globl  _start
+       .type   _start, @function
+_start:
+       movq    foobar@GOTPCREL(%rip), %rax
+       .size   _start, .-_start
diff --git a/ld/testsuite/ld-x86-64/pr19609-6a.d b/ld/testsuite/ld-x86-64/pr19609-6a.d
new file mode 100644 (file)
index 0000000..4802ffe
--- /dev/null
@@ -0,0 +1,4 @@
+#source: pr19609-6.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 --defsym foobar=0x80000000
+#error: .*relocation truncated to fit: R_X86_64_32S .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-6b.d b/ld/testsuite/ld-x86-64/pr19609-6b.d
new file mode 100644 (file)
index 0000000..64e1f5b
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19609-6.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 --defsym foobar=0x80000000 --no-relax
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 8b 05 ([0-9a-f]{2} ){4} *    mov    0x[a-f0-9]+\(%rip\),%rax        # [a-f0-9]+ <_start\+0x[a-f0-9]+>
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19609-6c.d b/ld/testsuite/ld-x86-64/pr19609-6c.d
new file mode 100644 (file)
index 0000000..19ba1d8
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19609-6.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 --defsym foobar=0x70000000
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    48 c7 c0 00 00 00 70    mov    \$0x70000000,%rax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19609-6d.d b/ld/testsuite/ld-x86-64/pr19609-6d.d
new file mode 100644 (file)
index 0000000..3ef614d
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19609-6.s
+#as: --x32 -mrelax-relocations=yes
+#ld: -melf32_x86_64 --defsym foobar=0x80000000
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[      ]*[a-f0-9]+:    40 c7 c0 00 00 00 80    rex mov \$0x80000000,%eax
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19609-7.s b/ld/testsuite/ld-x86-64/pr19609-7.s
new file mode 100644 (file)
index 0000000..bc654f5
--- /dev/null
@@ -0,0 +1,7 @@
+       .text
+       .weak   foobar
+       .globl  _start
+       .type   _start, @function
+_start:
+       call    *foobar@GOTPCREL(%rip)
+       .size   _start, .-_start
diff --git a/ld/testsuite/ld-x86-64/pr19609-7a.d b/ld/testsuite/ld-x86-64/pr19609-7a.d
new file mode 100644 (file)
index 0000000..d960572
--- /dev/null
@@ -0,0 +1,4 @@
+#source: pr19609-7.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 -Ttext=0x80000000
+#error: .*relocation truncated to fit: R_X86_64_PC32 .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-7b.d b/ld/testsuite/ld-x86-64/pr19609-7b.d
new file mode 100644 (file)
index 0000000..2e8fd35
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19609-7.s
+#as: --64 -mrelax-relocations=yes
+#ld: -melf_x86_64 -Ttext=0x80000000 --no-relax
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4} *       callq  \*-?0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <.*0x[a-f0-9]+>
+#pass
diff --git a/ld/testsuite/ld-x86-64/pr19609-7c.d b/ld/testsuite/ld-x86-64/pr19609-7c.d
new file mode 100644 (file)
index 0000000..8bd919a
--- /dev/null
@@ -0,0 +1,4 @@
+#source: pr19609-7.s
+#as: --x32 -mrelax-relocations=yes
+#ld: -melf32_x86_64 -Ttext=0x80000000
+#error: .*relocation truncated to fit: R_X86_64_PC32 .*
diff --git a/ld/testsuite/ld-x86-64/pr19609-7d.d b/ld/testsuite/ld-x86-64/pr19609-7d.d
new file mode 100644 (file)
index 0000000..ba28828
--- /dev/null
@@ -0,0 +1,13 @@
+#source: pr19609-7.s
+#as: --x32 -mrelax-relocations=yes
+#ld: -melf32_x86_64 -Ttext=0x80000000 --no-relax
+#objdump: -dw
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+[a-f0-9]+ <_start>:
+[ ]*[a-f0-9]+: ff 15 ([0-9a-f]{2} ){4} *       callq  \*-?0x[a-f0-9]+\(%rip\)        # [a-f0-9]+ <.*0x[a-f0-9]+>
+#pass
index 5a3b24f8b7d62d6d0e61efc0a14e67ab1511eaba..4b4cf12c89a74bf564c3ada9dc0d21afe55bc823 100644 (file)
@@ -305,6 +305,8 @@ run_dump_test "pr13082-2a"
 run_dump_test "pr13082-2b"
 run_dump_test "pr13082-3a"
 run_dump_test "pr13082-3b"
+run_dump_test "pr13082-3c"
+run_dump_test "pr13082-3d"
 run_dump_test "pr13082-4a"
 run_dump_test "pr13082-4b"
 run_dump_test "pr13082-5a"
@@ -382,6 +384,43 @@ run_dump_test "pr19636-3a"
 run_dump_test "pr19636-3b"
 run_dump_test "pr19636-3c"
 run_dump_test "pr19645"
+run_dump_test "pr19609-1a"
+run_dump_test "pr19609-1b"
+run_dump_test "pr19609-1c"
+run_dump_test "pr19609-1d"
+run_dump_test "pr19609-1e"
+run_dump_test "pr19609-1f"
+run_dump_test "pr19609-1g"
+run_dump_test "pr19609-1h"
+run_dump_test "pr19609-1i"
+run_dump_test "pr19609-1j"
+run_dump_test "pr19609-1k"
+run_dump_test "pr19609-1l"
+run_dump_test "pr19609-1m"
+run_dump_test "pr19609-2a"
+run_dump_test "pr19609-2b"
+run_dump_test "pr19609-2c"
+run_dump_test "pr19609-2d"
+run_dump_test "pr19609-3a"
+run_dump_test "pr19609-3b"
+run_dump_test "pr19609-4a"
+run_dump_test "pr19609-4b"
+run_dump_test "pr19609-4c"
+run_dump_test "pr19609-4d"
+run_dump_test "pr19609-4e"
+run_dump_test "pr19609-5a"
+run_dump_test "pr19609-5b"
+run_dump_test "pr19609-5c"
+run_dump_test "pr19609-5d"
+run_dump_test "pr19609-5e"
+run_dump_test "pr19609-6a"
+run_dump_test "pr19609-6b"
+run_dump_test "pr19609-6c"
+run_dump_test "pr19609-6d"
+run_dump_test "pr19609-7a"
+run_dump_test "pr19609-7b"
+run_dump_test "pr19609-7c"
+run_dump_test "pr19609-7d"
 
 proc undefined_weak {cflags ldflags} {
     set testname "Undefined weak symbol"