This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Disable R_X86_64_PLT32 generation as branch marker on Solaris/x86
- From: Rainer Orth <ro at CeBiTec dot Uni-Bielefeld dot DE>
- To: binutils at sourceware dot org
- Date: Wed, 27 Mar 2019 17:50:57 +0100
- Subject: Disable R_X86_64_PLT32 generation as branch marker on Solaris/x86
The fix H.J. implemented for PR gas/22791 in the thread starting at
[PATCH] x86-64: Treat PC32 relocation with branch as PLT32
https://sourceware.org/ml/binutils/2018-02/msg00065.html
is causing problems on Solaris/x86. The native linker is strongly
preferred there, and there's no intention of implementing the linker
optimization he plans there. Besides, the kernel runtime linker,
otherwise has no need to deal with that reloc at all, and instead of
adding (possibly even more) workarounds with no benefit, it seems
appropriate to disable the R_X86_64_PLT32 generation as branch marker on
Solaris/x86 in the first place.
The patch itself is trivial, the only complication is adapting the
testsuite. Since I've found no way to have conditional sections in the
.d files, I've instead used the solution already found elsewhere of
having separate .d files for the affected tests on Solaris and selecting
the right one in i386/i386.exp.
Tested on amd64-pc-solaris2.11 and x86_64-pc-linux-gnu without
regressions. Ok for master (and perhaps the 2.32 branch)?
Thanks.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University
2019-03-06 Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE>
* config/tc-i386.c (need_plt32_p) [TE_SOLARIS]: Return FALSE.
* testsuite/gas/i386/reloc64-solaris.d,
testsuite/gas/i386/x86-64-jump-solaris.d,
testsuite/gas/i386/x86-64-mpx-branch-1-solaris.d,
testsuite/gas/i386/x86-64-mpx-branch-2-solaris.d,
testsuite/gas/i386/x86-64-nop-3-solaris.d,
testsuite/gas/i386/x86-64-nop-4-solaris.d,
testsuite/gas/i386/x86-64-nop-5-solaris.d,
testsuite/gas/i386/x86-64-relax-2-solaris.d,
testsuite/gas/i386/x86-64-relax-3-solaris.d: New tests.
* testsuite/gas/i386/i386.exp: Use non-R_X86_64_PLT32 variants on
Solaris.
# HG changeset patch
# Parent 2eb8cc27418899c8039e79f1e172df1076ea2889
Disable R_X86_64_PLT32 generation as branch marker on Solaris/x86
diff --git a/gas/config/tc-i386.c b/gas/config/tc-i386.c
--- a/gas/config/tc-i386.c
+++ b/gas/config/tc-i386.c
@@ -7784,6 +7784,12 @@ need_plt32_p (symbolS *s)
if (!IS_ELF)
return FALSE;
+#ifdef TE_SOLARIS
+ /* Don't emit PLT32 relocation on Solaris: neither native linker nor
+ krtld support it. */
+ return FALSE;
+#endif
+
/* Since there is no need to prepare for PLT branch on x86-64, we
can generate R_X86_64_PLT32, instead of R_X86_64_PC32, which can
be used as a marker for 32-bit PC-relative branches. */
diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp
--- a/gas/testsuite/gas/i386/i386.exp
+++ b/gas/testsuite/gas/i386/i386.exp
@@ -1009,10 +1009,18 @@ if [expr ([istarget "i*86-*-*"] || [ista
# ELF specific tests
if [is_elf_format] then {
+ # Use separate .d files on Solaris/x86: gas doesn't emit PLT32
+ # relocations as branch markers there.
+ if { [istarget "*-*-solaris*"] } then {
+ set plt32_suffix "-solaris"
+ } else {
+ set plt32_suffix ""
+ }
+
# Verify that @unwind works.
run_dump_test "x86-64-unwind"
- run_dump_test "reloc64"
+ run_dump_test "reloc64${plt32_suffix}"
run_list_test "reloc64" "--defsym _bad_=1"
run_dump_test "mixed-mode-reloc64"
run_dump_test "x86-64-ifunc"
@@ -1023,8 +1031,8 @@ if [expr ([istarget "i*86-*-*"] || [ista
run_dump_test "k1om"
run_dump_test "x86-64-localpic"
run_dump_test "debug1"
- run_dump_test "x86-64-mpx-branch-1"
- run_dump_test "x86-64-mpx-branch-2"
+ run_dump_test "x86-64-mpx-branch-1${plt32_suffix}"
+ run_dump_test "x86-64-mpx-branch-2${plt32_suffix}"
run_dump_test "x86-64-dw2-compress-2"
run_dump_test "x86-64-dw2-compressed-2"
@@ -1036,10 +1044,10 @@ if [expr ([istarget "i*86-*-*"] || [ista
run_dump_test "x86-64-size-5"
run_list_test "x86-64-size-inval-1" "-al"
- run_dump_test "x86-64-relax-2"
- run_dump_test "x86-64-relax-3"
+ run_dump_test "x86-64-relax-2${plt32_suffix}"
+ run_dump_test "x86-64-relax-3${plt32_suffix}"
- run_dump_test "x86-64-jump"
+ run_dump_test "x86-64-jump${plt32_suffix}"
run_dump_test "x86-64-branch-2"
run_list_test "x86-64-branch-3" "-al -mintel64"
run_list_test "x86-64-branch-4" "-al -mintel64"
@@ -1049,9 +1057,9 @@ if [expr ([istarget "i*86-*-*"] || [ista
run_dump_test "x86-64-gotpcrel-2"
run_dump_test "x86-64-addend"
- run_dump_test "x86-64-nop-3"
- run_dump_test "x86-64-nop-4"
- run_dump_test "x86-64-nop-5"
+ run_dump_test "x86-64-nop-3${plt32_suffix}"
+ run_dump_test "x86-64-nop-4${plt32_suffix}"
+ run_dump_test "x86-64-nop-5${plt32_suffix}"
run_dump_test "x86-64-nop-6"
run_dump_test "evex-no-scale-64"
diff --git a/gas/testsuite/gas/i386/reloc64-solaris.d b/gas/testsuite/gas/i386/reloc64-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/reloc64-solaris.d
@@ -0,0 +1,99 @@
+#as: -mx86-used-note=no
+#source: reloc64.s
+#objdump: -Drw
+#name: x86-64 relocs
+
+.*: +file format .*x86-64.*
+
+Disassembly of section \.text:
+#...
+.*[ ]+R_X86_64_64[ ]+xtrn
+.*[ ]+R_X86_64_32S[ ]+xtrn
+.*[ ]+R_X86_64_32[ ]+xtrn
+.*[ ]+R_X86_64_16[ ]+xtrn
+.*[ ]+R_X86_64_8[ ]+xtrn
+.*[ ]+R_X86_64_32S[ ]+xtrn
+.*[ ]+R_X86_64_32[ ]+xtrn
+.*[ ]+R_X86_64_PC64[ ]+xtrn\+0x0*2
+.*[ ]+R_X86_64_PC32[ ]+xtrn\+0x0*2
+.*[ ]+R_X86_64_PC16[ ]+xtrn\+0x0*2
+.*[ ]+R_X86_64_PC8[ ]+xtrn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L[ ]+xtrn
+.*[ ]+R_X86_64_GOTPC32[ ]+_GLOBAL_OFFSET_TABLE_
+.*[ ]+R_X86_64_GOTPC32[ ]+_GLOBAL_OFFSET_TABLE_
+.*[ ]+R_X86_64_PLT32[ ]+xtrn
+.*[ ]+R_X86_64_TLSGD[ ]+xtrn
+.*[ ]+R_X86_64_GOTTPOFF[ ]+xtrn
+.*[ ]+R_X86_64_TLSLD[ ]+xtrn
+.*[ ]+R_X86_64_DTPOFF32[ ]+xtrn
+.*[ ]+R_X86_64_TPOFF32[ ]+xtrn
+.*[ ]+R_X86_64_16[ ]+xtrn
+.*[ ]+R_X86_64_PC16[ ]+xtrn
+.*[ ]+R_X86_64_8[ ]+xtrn
+.*[ ]+R_X86_64_PC8[ ]+xtrn
+.*[ ]+R_X86_64_GOT32[ ]+xtrn-0x4
+.*[ ]+R_X86_64_GOT32[ ]+xtrn\+0x4
+.*[ ]+R_X86_64_GOTPLT64[ ]+xtrn
diff --git a/gas/testsuite/gas/i386/x86-64-jump-solaris.d b/gas/testsuite/gas/i386/x86-64-jump-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-jump-solaris.d
@@ -0,0 +1,44 @@
+#objdump: -drw
+#source: x86-64-jump.s
+#name: x86-64 jump
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <.text>:
+[ ]*[a-f0-9]+: eb fe jmp (0x0|0 <.text>)
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 0x7 3: R_X86_64_PC32 xxx-0x4
+[ ]*[a-f0-9]+: ff 24 25 00 00 00 00 jmpq \*0x0 a: R_X86_64_32S xxx
+[ ]*[a-f0-9]+: ff e7 jmpq \*%rdi
+[ ]*[a-f0-9]+: ff 27 jmpq \*\(%rdi\)
+[ ]*[a-f0-9]+: ff 2c bd 00 00 00 00 ljmp \*0x0\(,%rdi,4\) 15: R_X86_64_32S xxx
+[ ]*[a-f0-9]+: 66 ff 2c bd 00 00 00 00 ljmpw \*0x0\(,%rdi,4\) 1d: R_X86_64_32S xxx
+[ ]*[a-f0-9]+: ff 2c 25 00 00 00 00 ljmp \*0x0 24: R_X86_64_32S xxx
+[ ]*[a-f0-9]+: 66 ff 2c 25 00 00 00 00 ljmpw \*0x0 2c: R_X86_64_32S xxx
+[ ]*[a-f0-9]+: e8 cb ff ff ff callq 0x0
+[ ]*[a-f0-9]+: e8 00 00 00 00 callq 0x3a 36: R_X86_64_PC32 xxx-0x4
+[ ]*[a-f0-9]+: ff 14 25 00 00 00 00 callq \*0x0 3d: R_X86_64_32S xxx
+[ ]*[a-f0-9]+: ff d7 callq \*%rdi
+[ ]*[a-f0-9]+: ff 17 callq \*\(%rdi\)
+[ ]*[a-f0-9]+: ff 1c bd 00 00 00 00 lcall \*0x0\(,%rdi,4\) 48: R_X86_64_32S xxx
+[ ]*[a-f0-9]+: 66 ff 1c bd 00 00 00 00 lcallw \*0x0\(,%rdi,4\) 50: R_X86_64_32S xxx
+[ ]*[a-f0-9]+: ff 1c 25 00 00 00 00 lcall \*0x0 57: R_X86_64_32S xxx
+[ ]*[a-f0-9]+: 66 ff 1c 25 00 00 00 00 lcallw \*0x0 5f: R_X86_64_32S xxx
+[ ]*[a-f0-9]+: 67 e3 00 jecxz 0x66 65: R_X86_64_PC8 \$\+0x2
+[ ]*[a-f0-9]+: 90 nop
+[ ]*[a-f0-9]+: e3 00 jrcxz 0x69 68: R_X86_64_PC8 \$\+0x1
+[ ]*[a-f0-9]+: 90 nop
+[ ]*[a-f0-9]+: 66 ff 13 callw \*\(%rbx\)
+[ ]*[a-f0-9]+: ff 1b lcall \*\(%rbx\)
+[ ]*[a-f0-9]+: 66 ff 23 jmpw \*\(%rbx\)
+[ ]*[a-f0-9]+: ff 2b ljmp \*\(%rbx\)
+[ ]*[a-f0-9]+: eb 00 jmp 0x76
+[ ]*[a-f0-9]+: 90 nop
+[ ]*[a-f0-9]+: 67 e3 00 jecxz 0x7a
+[ ]*[a-f0-9]+: 90 nop
+[ ]*[a-f0-9]+: e3 00 jrcxz 0x7d
+[ ]*[a-f0-9]+: 90 nop
+[ ]*[a-f0-9]+: eb 00 jmp 0x80
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-mpx-branch-1-solaris.d b/gas/testsuite/gas/i386/x86-64-mpx-branch-1-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-mpx-branch-1-solaris.d
@@ -0,0 +1,29 @@
+#as: -J
+#source: x86-64-mpx-branch-1.s
+#objdump: -dwr
+#name: x86-64 MPX branch
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo1-0xc>:
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 6 <foo1-0x6> 2: R_X86_64_PC32 \*ABS\*\+0x10003c
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq c <foo1> 8: R_X86_64_PC32 \*ABS\*\+0x10003c
+
+0+c <foo1>:
+[ ]*[a-f0-9]+: f2 eb fd bnd jmp c <foo1>
+[ ]*[a-f0-9]+: f2 72 fa bnd jb c <foo1>
+[ ]*[a-f0-9]+: f2 e8 f4 ff ff ff bnd callq c <foo1>
+[ ]*[a-f0-9]+: f2 eb 09 bnd jmp 24 <foo2>
+[ ]*[a-f0-9]+: f2 72 06 bnd jb 24 <foo2>
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 24 <foo2>
+
+0+24 <foo2>:
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq 2a <foo2\+0x6> 26: R_X86_64_PC32 foo-0x4
+[ ]*[a-f0-9]+: f2 0f 82 00 00 00 00 bnd jb 31 <foo2\+0xd> 2d: R_X86_64_PC32 foo-0x4
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 37 <foo2\+0x13> 33: R_X86_64_PC32 foo-0x4
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq 3d <foo2\+0x19> 39: R_X86_64_PLT32 foo-0x4
+[ ]*[a-f0-9]+: f2 0f 82 00 00 00 00 bnd jb 44 <foo2\+0x20> 40: R_X86_64_PLT32 foo-0x4
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 4a <foo2\+0x26> 46: R_X86_64_PLT32 foo-0x4
diff --git a/gas/testsuite/gas/i386/x86-64-mpx-branch-2-solaris.d b/gas/testsuite/gas/i386/x86-64-mpx-branch-2-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-mpx-branch-2-solaris.d
@@ -0,0 +1,29 @@
+#as: -J -madd-bnd-prefix
+#source: x86-64-mpx-branch-2.s
+#objdump: -dwr
+#name: x86-64 branch with BND prefix
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo1-0xc>:
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 6 <foo1-0x6> 2: R_X86_64_PC32 \*ABS\*\+0x10003c
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq c <foo1> 8: R_X86_64_PC32 \*ABS\*\+0x10003c
+
+0+c <foo1>:
+[ ]*[a-f0-9]+: f2 eb fd bnd jmp c <foo1>
+[ ]*[a-f0-9]+: f2 72 fa bnd jb c <foo1>
+[ ]*[a-f0-9]+: f2 e8 f4 ff ff ff bnd callq c <foo1>
+[ ]*[a-f0-9]+: f2 eb 09 bnd jmp 24 <foo2>
+[ ]*[a-f0-9]+: f2 72 06 bnd jb 24 <foo2>
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 24 <foo2>
+
+0+24 <foo2>:
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq 2a <foo2\+0x6> 26: R_X86_64_PC32 foo-0x4
+[ ]*[a-f0-9]+: f2 0f 82 00 00 00 00 bnd jb 31 <foo2\+0xd> 2d: R_X86_64_PC32 foo-0x4
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 37 <foo2\+0x13> 33: R_X86_64_PC32 foo-0x4
+[ ]*[a-f0-9]+: f2 e9 00 00 00 00 bnd jmpq 3d <foo2\+0x19> 39: R_X86_64_PLT32 foo-0x4
+[ ]*[a-f0-9]+: f2 0f 82 00 00 00 00 bnd jb 44 <foo2\+0x20> 40: R_X86_64_PLT32 foo-0x4
+[ ]*[a-f0-9]+: f2 e8 00 00 00 00 bnd callq 4a <foo2\+0x26> 46: R_X86_64_PLT32 foo-0x4
diff --git a/gas/testsuite/gas/i386/x86-64-nop-3-solaris.d b/gas/testsuite/gas/i386/x86-64-nop-3-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-nop-3-solaris.d
@@ -0,0 +1,21 @@
+#source: nop-3.s
+#objdump: -drw
+#name: x86-64 .nops 3
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+: 31 c0 xor %eax,%eax
+ +[a-f0-9]+: 85 c0 test %eax,%eax
+ +[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+ +[a-f0-9]+: 31 c0 xor %eax,%eax
+ +[a-f0-9]+: 31 c0 xor %eax,%eax
+
+Disassembly of section .altinstr_replacement:
+
+0+ <.altinstr_replacement>:
+ +[a-f0-9]+: e9 00 00 00 00 jmpq 5 <_start\+0x5> 1: R_X86_64_PC32 foo-0x4
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-nop-4-solaris.d b/gas/testsuite/gas/i386/x86-64-nop-4-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-nop-4-solaris.d
@@ -0,0 +1,24 @@
+#source: nop-4.s
+#objdump: -drw
+#name: x86-64 .nops 4
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+: 31 c0 xor %eax,%eax
+ +[a-f0-9]+: 85 c0 test %eax,%eax
+ +[a-f0-9]+: 66 0f 1f 84 00 00 00 00 00 nopw 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: 31 c0 xor %eax,%eax
+ +[a-f0-9]+: 31 c0 xor %eax,%eax
+
+Disassembly of section .altinstr_replacement:
+
+0+ <.altinstr_replacement>:
+ +[a-f0-9]+: 89 c0 mov %eax,%eax
+ +[a-f0-9]+: 89 c0 mov %eax,%eax
+ +[a-f0-9]+: 89 c0 mov %eax,%eax
+ +[a-f0-9]+: e9 00 00 00 00 jmpq b <_start\+0xb> 7: R_X86_64_PC32 foo-0x4
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-nop-5-solaris.d b/gas/testsuite/gas/i386/x86-64-nop-5-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-nop-5-solaris.d
@@ -0,0 +1,27 @@
+#source: nop-5.s
+#objdump: -drw
+#name: x86-64 .nops 5
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <_start>:
+ +[a-f0-9]+: 31 c0 xor %eax,%eax
+ +[a-f0-9]+: 85 c0 test %eax,%eax
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: 31 c0 xor %eax,%eax
+ +[a-f0-9]+: 31 c0 xor %eax,%eax
+
+Disassembly of section .altinstr_replacement:
+
+0+ <.altinstr_replacement>:
+ +[a-f0-9]+: 89 c0 mov %eax,%eax
+ +[a-f0-9]+: 89 c0 mov %eax,%eax
+ +[a-f0-9]+: 89 c0 mov %eax,%eax
+ +[a-f0-9]+: 89 c0 mov %eax,%eax
+ +[a-f0-9]+: e9 00 00 00 00 jmpq d <_start\+0xd> 9: R_X86_64_PC32 foo-0x4
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-relax-2-solaris.d b/gas/testsuite/gas/i386/x86-64-relax-2-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-relax-2-solaris.d
@@ -0,0 +1,34 @@
+#source: relax-3.s
+#as: -mshared
+#objdump: -dwr
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo>:
+[ ]*[a-f0-9]+: eb 24 jmp 26 <local>
+[ ]*[a-f0-9]+: eb 1e jmp 22 <hidden_def>
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 9 <foo\+0x9> 5: R_X86_64_PC32 global_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq e <foo\+0xe> a: R_X86_64_PLT32 global_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 13 <foo\+0x13> f: R_X86_64_PC32 weak_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 18 <foo\+0x18> 14: R_X86_64_PC32 weak_hidden_undef-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 1d <foo\+0x1d> 19: R_X86_64_PC32 weak_hidden_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 22 <hidden_def> 1e: R_X86_64_PC32 hidden_undef-0x4
+
+0+22 <hidden_def>:
+[ ]*[a-f0-9]+: c3 retq
+
+0+23 <weak_hidden_def>:
+[ ]*[a-f0-9]+: c3 retq
+
+0+24 <global_def>:
+[ ]*[a-f0-9]+: c3 retq
+
+0+25 <weak_def>:
+[ ]*[a-f0-9]+: c3 retq
+
+0+26 <local>:
+[ ]*[a-f0-9]+: c3 retq
+#pass
diff --git a/gas/testsuite/gas/i386/x86-64-relax-3-solaris.d b/gas/testsuite/gas/i386/x86-64-relax-3-solaris.d
new file mode 100644
--- /dev/null
+++ b/gas/testsuite/gas/i386/x86-64-relax-3-solaris.d
@@ -0,0 +1,33 @@
+#source: relax-3.s
+#objdump: -dwr
+
+.*: +file format .*
+
+
+Disassembly of section .text:
+
+0+ <foo>:
+[ ]*[a-f0-9]+: eb 21 jmp 23 <local>
+[ ]*[a-f0-9]+: eb 1b jmp 1f <hidden_def>
+[ ]*[a-f0-9]+: eb 1b jmp 21 <global_def>
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq b <foo\+0xb> 7: R_X86_64_PLT32 global_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 10 <foo\+0x10> c: R_X86_64_PC32 weak_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 15 <foo\+0x15> 11: R_X86_64_PC32 weak_hidden_undef-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 1a <foo\+0x1a> 16: R_X86_64_PC32 weak_hidden_def-0x4
+[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 1f <hidden_def> 1b: R_X86_64_PC32 hidden_undef-0x4
+
+0+1f <hidden_def>:
+[ ]*[a-f0-9]+: c3 retq
+
+0+20 <weak_hidden_def>:
+[ ]*[a-f0-9]+: c3 retq
+
+0+21 <global_def>:
+[ ]*[a-f0-9]+: c3 retq
+
+0+22 <weak_def>:
+[ ]*[a-f0-9]+: c3 retq
+
+0+23 <local>:
+[ ]*[a-f0-9]+: c3 retq
+#pass