const struct elf_x86_non_lazy_plt_layout *non_lazy_bnd_plt;
const struct elf_x86_lazy_plt_layout *lazy_ibt_plt;
const struct elf_x86_non_lazy_plt_layout *non_lazy_ibt_plt;
+ const struct elf_x86_lazy_plt_layout *x32_lazy_ibt_plt;
+ const struct elf_x86_non_lazy_plt_layout *x32_non_lazy_ibt_plt;
asection *plt;
enum elf_x86_plt_type plt_type;
struct elf_x86_plt plts[] =
{
lazy_ibt_plt = &elf_x86_64_lazy_ibt_plt;
non_lazy_ibt_plt = &elf_x86_64_non_lazy_ibt_plt;
+ x32_lazy_ibt_plt = &elf_x32_lazy_ibt_plt;
+ x32_non_lazy_ibt_plt = &elf_x32_non_lazy_ibt_plt;
}
else
{
lazy_ibt_plt = &elf_x32_lazy_ibt_plt;
non_lazy_ibt_plt = &elf_x32_non_lazy_ibt_plt;
+ x32_lazy_ibt_plt = NULL;
+ x32_non_lazy_ibt_plt = NULL;
}
count = 0;
lazy_plt->plt0_got1_offset) == 0)
&& (memcmp (plt_contents + 6, lazy_plt->plt0_entry + 6,
2) == 0))
- plt_type = plt_lazy;
+ {
+ if (x32_lazy_ibt_plt != NULL
+ && (memcmp (plt_contents
+ + x32_lazy_ibt_plt->plt_entry_size,
+ x32_lazy_ibt_plt->plt_entry,
+ x32_lazy_ibt_plt->plt_got_offset) == 0))
+ {
+ /* The fist entry in the x32 lazy IBT PLT is the same
+ as the lazy PLT. */
+ plt_type = plt_lazy | plt_second;
+ lazy_plt = x32_lazy_ibt_plt;
+ }
+ else
+ plt_type = plt_lazy;
+ }
else if (lazy_bnd_plt != NULL
&& (memcmp (plt_contents, lazy_bnd_plt->plt0_entry,
lazy_bnd_plt->plt0_got1_offset) == 0)
plt_type = plt_second;
non_lazy_plt = non_lazy_ibt_plt;
}
+ else if (x32_non_lazy_ibt_plt != NULL
+ && plt->size >= x32_non_lazy_ibt_plt->plt_entry_size
+ && (memcmp (plt_contents,
+ x32_non_lazy_ibt_plt->plt_entry,
+ x32_non_lazy_ibt_plt->plt_got_offset) == 0))
+ {
+ /* Match x32 IBT PLT. */
+ plt_type = plt_second;
+ non_lazy_plt = x32_non_lazy_ibt_plt;
+ }
}
if (plt_type == plt_unknown)
init_table.non_lazy_plt = &elf_x86_64_non_lazy_plt;
}
- if (ABI_64_P (info->output_bfd))
- {
- init_table.lazy_ibt_plt = &elf_x86_64_lazy_ibt_plt;
- init_table.non_lazy_ibt_plt = &elf_x86_64_non_lazy_ibt_plt;
- }
- else
- {
- init_table.lazy_ibt_plt = &elf_x32_lazy_ibt_plt;
- init_table.non_lazy_ibt_plt = &elf_x32_non_lazy_ibt_plt;
- }
+ init_table.lazy_ibt_plt = &elf_x32_lazy_ibt_plt;
+ init_table.non_lazy_ibt_plt = &elf_x32_non_lazy_ibt_plt;
if (ABI_64_P (info->output_bfd))
{
[a-f0-9]+ <.plt>:
+[a-f0-9]+: ff 35 ([0-9a-f]{2} ){4}[ ]+push 0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x8>
- +[a-f0-9]+: f2 ff 25 ([0-9a-f]{2} ){4}[ ]+bnd jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+ +[a-f0-9]+: ff 25 ([0-9a-f]{2} ){4}[ ]+jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp [a-f0-9]+ <.*>
- +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <.*>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp [a-f0-9]+ <.*>
- +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <.*>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
[a-f0-9]+ <bar1@plt>:
+[a-f0-9]+: f3 0f 1e fa endbr64
- +[a-f0-9]+: f2 ff 25 ([0-9a-f]{2} ){4}[ ]+bnd jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar1>
- +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: ff 25 ([0-9a-f]{2} ){4}[ ]+jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar1>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
[a-f0-9]+ <bar2@plt>:
+[a-f0-9]+: f3 0f 1e fa endbr64
- +[a-f0-9]+: f2 ff 25 ([0-9a-f]{2} ){4}[ ]+bnd jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar2>
- +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: ff 25 ([0-9a-f]{2} ){4}[ ]+jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar2>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
Disassembly of section .text:
0+1f0 <.plt>:
+[a-f0-9]+: ff 35 ca 01 20 00 push 0x2001ca\(%rip\) # 2003c0 <_GLOBAL_OFFSET_TABLE_\+0x8>
- +[a-f0-9]+: f2 ff 25 cb 01 20 00 bnd jmp \*0x2001cb\(%rip\) # 2003c8 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+ +[a-f0-9]+: ff 25 cc 01 20 00 jmp \*0x2001cc\(%rip\) # 2003c8 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp 1f0 <.*>
- +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 1f0 <.*>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp 1f0 <.*>
- +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 1f0 <.*>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
0+220 <bar1@plt>:
+[a-f0-9]+: f3 0f 1e fa endbr64
- +[a-f0-9]+: f2 ff 25 a5 01 20 00 bnd jmp \*0x2001a5\(%rip\) # 2003d0 <bar1>
- +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: ff 25 a6 01 20 00 jmp \*0x2001a6\(%rip\) # 2003d0 <bar1>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
0+230 <bar2@plt>:
+[a-f0-9]+: f3 0f 1e fa endbr64
- +[a-f0-9]+: f2 ff 25 9d 01 20 00 bnd jmp \*0x20019d\(%rip\) # 2003d8 <bar2>
- +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: ff 25 9e 01 20 00 jmp \*0x20019e\(%rip\) # 2003d8 <bar2>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
Disassembly of section .text:
DW_CFA_advance_loc: 6 to 00000000000001f6
DW_CFA_def_cfa_offset: 24
DW_CFA_advance_loc: 10 to 0000000000000200
- DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit10; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\)
+ DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\)
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
[a-f0-9]+ <.plt>:
+[a-f0-9]+: ff 35 ([0-9a-f]{2} ){4}[ ]+push 0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x8>
- +[a-f0-9]+: f2 ff 25 ([0-9a-f]{2} ){4}[ ]+bnd jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+ +[a-f0-9]+: ff 25 ([0-9a-f]{2} ){4}[ ]+jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp [a-f0-9]+ <.*>
- +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <.*>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp [a-f0-9]+ <.*>
- +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <.*>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
[a-f0-9]+ <bar1@plt>:
+[a-f0-9]+: f3 0f 1e fa endbr64
- +[a-f0-9]+: f2 ff 25 ([0-9a-f]{2} ){4}[ ]+bnd jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar1>
- +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: ff 25 ([0-9a-f]{2} ){4}[ ]+jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar1>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
[a-f0-9]+ <bar2@plt>:
+[a-f0-9]+: f3 0f 1e fa endbr64
- +[a-f0-9]+: f2 ff 25 ([0-9a-f]{2} ){4}[ ]+bnd jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar2>
- +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: ff 25 ([0-9a-f]{2} ){4}[ ]+jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar2>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
Disassembly of section .text:
DW_CFA_advance_loc: 6 to [a-f0-9]+
DW_CFA_def_cfa_offset: 24
DW_CFA_advance_loc: 10 to [a-f0-9]+
- DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit10; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\)
+ DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\)
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
0+1f0 <.plt>:
+[a-f0-9]+: ff 35 ca 01 20 00 push 0x2001ca\(%rip\) # 2003c0 <_GLOBAL_OFFSET_TABLE_\+0x8>
- +[a-f0-9]+: f2 ff 25 cb 01 20 00 bnd jmp \*0x2001cb\(%rip\) # 2003c8 <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+ +[a-f0-9]+: ff 25 cc 01 20 00 jmp \*0x2001cc\(%rip\) # 2003c8 <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp 1f0 <.*>
- +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: e9 e2 ff ff ff jmp 1f0 <.*>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp 1f0 <.*>
- +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: e9 d2 ff ff ff jmp 1f0 <.*>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
0+220 <bar1@plt>:
+[a-f0-9]+: f3 0f 1e fa endbr64
- +[a-f0-9]+: f2 ff 25 a5 01 20 00 bnd jmp \*0x2001a5\(%rip\) # 2003d0 <bar1>
- +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: ff 25 a6 01 20 00 jmp \*0x2001a6\(%rip\) # 2003d0 <bar1>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
0+230 <bar2@plt>:
+[a-f0-9]+: f3 0f 1e fa endbr64
- +[a-f0-9]+: f2 ff 25 9d 01 20 00 bnd jmp \*0x20019d\(%rip\) # 2003d8 <bar2>
- +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: ff 25 9e 01 20 00 jmp \*0x20019e\(%rip\) # 2003d8 <bar2>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
Disassembly of section .text:
DW_CFA_advance_loc: 6 to 00000000000001f6
DW_CFA_def_cfa_offset: 24
DW_CFA_advance_loc: 10 to 0000000000000200
- DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit10; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\)
+ DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\)
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
[a-f0-9]+ <.plt>:
+[a-f0-9]+: ff 35 ([0-9a-f]{2} ){4}[ ]+push 0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x8>
- +[a-f0-9]+: f2 ff 25 ([0-9a-f]{2} ){4}[ ]+bnd jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
- +[a-f0-9]+: 0f 1f 00 nopl \(%rax\)
+ +[a-f0-9]+: ff 25 ([0-9a-f]{2} ){4}[ ]+jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <_GLOBAL_OFFSET_TABLE_\+0x10>
+ +[a-f0-9]+: 0f 1f 40 00 nopl 0x0\(%rax\)
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 00 00 00 00 push \$0x0
- +[a-f0-9]+: f2 e9 e1 ff ff ff bnd jmp [a-f0-9]+ <.*>
- +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: e9 e2 ff ff ff jmp [a-f0-9]+ <.*>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
+[a-f0-9]+: f3 0f 1e fa endbr64
+[a-f0-9]+: 68 01 00 00 00 push \$0x1
- +[a-f0-9]+: f2 e9 d1 ff ff ff bnd jmp [a-f0-9]+ <.*>
- +[a-f0-9]+: 90 nop
+ +[a-f0-9]+: e9 d2 ff ff ff jmp [a-f0-9]+ <.*>
+ +[a-f0-9]+: 66 90 xchg %ax,%ax
Disassembly of section .plt.sec:
[a-f0-9]+ <bar1@plt>:
+[a-f0-9]+: f3 0f 1e fa endbr64
- +[a-f0-9]+: f2 ff 25 ([0-9a-f]{2} ){4}[ ]+bnd jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar1>
- +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: ff 25 ([0-9a-f]{2} ){4}[ ]+jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar1>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
[a-f0-9]+ <bar2@plt>:
+[a-f0-9]+: f3 0f 1e fa endbr64
- +[a-f0-9]+: f2 ff 25 ([0-9a-f]{2} ){4}[ ]+bnd jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar2>
- +[a-f0-9]+: 0f 1f 44 00 00 nopl 0x0\(%rax,%rax,1\)
+ +[a-f0-9]+: ff 25 ([0-9a-f]{2} ){4}[ ]+jmp \*0x[a-f0-9]+\(%rip\) # [a-f0-9]+ <bar2>
+ +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\)
Disassembly of section .text:
DW_CFA_advance_loc: 6 to [a-f0-9]+
DW_CFA_def_cfa_offset: 24
DW_CFA_advance_loc: 10 to [a-f0-9]+
- DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit10; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\)
+ DW_CFA_def_cfa_expression \(DW_OP_breg7 \(rsp\): 8; DW_OP_breg16 \(rip\): 0; DW_OP_lit15; DW_OP_and; DW_OP_lit9; DW_OP_ge; DW_OP_lit3; DW_OP_shl; DW_OP_plus\)
DW_CFA_nop
DW_CFA_nop
DW_CFA_nop
+++ /dev/null
-#...
-Disassembly of section .plt.got:
-
-[a-f0-9]+ <[_a-z]+@plt>:
-[ ]*[a-f0-9]+: f3 0f 1e fa endbr64
-[ ]*[a-f0-9]+: ff 25 .. .. 3f 00 jmp +\*0x3f....\(%rip\) # ...... <.*>
-#pass
[a-f0-9]+ <[_a-z]+@plt>:
[ ]*[a-f0-9]+: f3 0f 1e fa endbr64
-[ ]*[a-f0-9]+: f2 ff 25 .. .. 3f 00 bnd jmp \*0x3f....\(%rip\) # ...... <.*>
+[ ]*[a-f0-9]+: ff 25 .. .. 3f 00 jmp +\*0x3f....\(%rip\) # ...... <.*>
#pass
}
if { [istarget "x86_64-*-linux*"] } {
- if { [istarget "x86_64-*-linux*-gnux32"] } {
- set pltdump {{objdump {-drw} plt-main-ibt-x32.dd}}
- set pltsecdump {{readelf {-SW} plt-main-ibt-now.rd} {objdump {-drw} plt-main-ibt-x32.dd}}
- } else {
- set pltdump {{objdump {-drw} plt-main-ibt.dd}}
- set pltsecdump {{readelf {-SW} plt-main-ibt-now.rd} {objdump {-drw} plt-main-ibt.dd}}
- }
+ set pltdump {{objdump {-drw} plt-main-ibt.dd}}
+ set pltsecdump {{readelf {-SW} plt-main-ibt-now.rd} {objdump {-drw} plt-main-ibt.dd}}
run_cc_link_tests [list \
[list \
"Build plt-main with -z ibtplt" \