From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x530.google.com (mail-pg1-x530.google.com [IPv6:2607:f8b0:4864:20::530]) by sourceware.org (Postfix) with ESMTPS id D058D387721C for ; Tue, 6 Dec 2022 21:10:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D058D387721C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-x530.google.com with SMTP id w37so14489293pga.5 for ; Tue, 06 Dec 2022 13:10:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=DpfRfjQ0bwt/bGnBmQAX+CvKI730SF2SBYUGtvwoEGU=; b=EpiOInSQfja/eWZWj2AatC7Zh0SuBWDTUWofNOh2yz6TbSjQ2qXI3M2KrH2lwxkE+x 9dsMKB2VyM+KfqmQjPwOxXx9ZG6QVVqF4sAkA0tFcdUQ/ozUj/nXsnGf+4Lgn5zLS+8z w2xxGd8Nee2naD0iqTQS6mlnWe0BQtKr9NkaksphFHaqguIznUdCPx6fmnRjVpb94c6S sthtDe9q/kA2hHAfdTCkcwoepSwfAwOU466W5ALIxCYP5XYgZUopgUUo1qGnci37zetv K5wpDSDqMbH6qD4POMklloLiQwNennnV4Am5uFIzNGdYR4VF1sw2Cgn+PHUMETBqWqjY A+NA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=DpfRfjQ0bwt/bGnBmQAX+CvKI730SF2SBYUGtvwoEGU=; b=vMoinKp/IKt4BkI3jVB/oFRQpNamyH29aYbM+8gxw0K9Tqu/0dYaPA1BodwHC8tOjt 3Xw9wnV7zzh7PHGggMuBNF0wF5HB/VE3PPb5nci1x3rpV7jn0YLlpNGuZBQBmedY9Ox5 K+R57G46e/zdhFxxdnm7Z7wklVd5JC/5trC4IoGhnVQsxvxptjNSkGDAXZDF8BF2YUbW uo8br6ICmUwTCQOD7OPv72GwGp/1+mqVoSCr/L/+eRpdc2Nr9443dNIg1/LBvymyKZUM 86lsg3kk3jpcTLKL9WY9Y/wpXme3Fh8pzwHr6Bv4Fj3aRzkmvzDsz9P99RoIhCvxji13 qq+w== X-Gm-Message-State: ANoB5plA6ZWfto8flGkkwusV8g4f66AL51f5xAEVtU9uKF74Lt10omnS VvxR0Ku/IwB0LhFZoNNccdYAbHwhtVQ= X-Google-Smtp-Source: AA0mqf53cJvfGPBGNjM16SidUH6sgAIWZh6B+JbdCeuSwlCi8G+lh/mnnRkJUq+5bm5IELO9+vayKQ== X-Received: by 2002:a05:6a00:acd:b0:566:900d:51f2 with SMTP id c13-20020a056a000acd00b00566900d51f2mr619994pfl.33.1670361046079; Tue, 06 Dec 2022 13:10:46 -0800 (PST) Received: from gnu-cfl-3.localdomain ([172.56.30.207]) by smtp.gmail.com with ESMTPSA id g2-20020a625202000000b0056da073b2b7sm4919298pfb.210.2022.12.06.13.10.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 06 Dec 2022 13:10:45 -0800 (PST) Received: from gnu-cfl-3.. (localhost [IPv6:::1]) by gnu-cfl-3.localdomain (Postfix) with ESMTP id 3340E740150 for ; Tue, 6 Dec 2022 13:10:44 -0800 (PST) From: "H.J. Lu" To: binutils@sourceware.org Subject: [PATCH] x86-64: Remove BND from 64-bit IBT PLT Date: Tue, 6 Dec 2022 13:10:44 -0800 Message-Id: <20221206211044.766653-1-hjl.tools@gmail.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3023.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Since MPX support has been removed from x86-64 psABI, remove BND from 64-bit IBT PLT by using x32 IBT PLT. bfd/ PR ld/29851 * elf64-x86-64.c (elf_x86_64_get_synthetic_symtab): Also check x32 IBT PLT for 64-bit. (elf_x86_64_link_setup_gnu_properties): Always use x32 IBT PLT. ld/ PR ld/29851 * testsuite/ld-x86-64/ibt-plt-1.d: Updated. * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2b.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2d.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3b.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3d.d: Likewise. * testsuite/ld-x86-64/plt-main-ibt-x32.dd: Moved to ... * testsuite/ld-x86-64/plt-main-ibt.dd: This. * testsuite/ld-x86-64/x86-64.exp: Don't use plt-main-ibt-x32.dd. --- bfd/elf64-x86-64.c | 44 ++++++++++++++++------ ld/testsuite/ld-x86-64/ibt-plt-1.d | 20 +++++----- ld/testsuite/ld-x86-64/ibt-plt-2a.d | 20 +++++----- ld/testsuite/ld-x86-64/ibt-plt-2b.d | 2 +- ld/testsuite/ld-x86-64/ibt-plt-2c.d | 20 +++++----- ld/testsuite/ld-x86-64/ibt-plt-2d.d | 2 +- ld/testsuite/ld-x86-64/ibt-plt-3a.d | 20 +++++----- ld/testsuite/ld-x86-64/ibt-plt-3b.d | 2 +- ld/testsuite/ld-x86-64/ibt-plt-3c.d | 20 +++++----- ld/testsuite/ld-x86-64/ibt-plt-3d.d | 2 +- ld/testsuite/ld-x86-64/plt-main-ibt-x32.dd | 7 ---- ld/testsuite/ld-x86-64/plt-main-ibt.dd | 2 +- ld/testsuite/ld-x86-64/x86-64.exp | 9 +---- 13 files changed, 90 insertions(+), 80 deletions(-) delete mode 100644 ld/testsuite/ld-x86-64/plt-main-ibt-x32.dd diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index fb872793d5f..2a5f5a5faae 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -4926,6 +4926,8 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd, 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[] = @@ -4957,11 +4959,15 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd, { 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; @@ -4987,7 +4993,21 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd, 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) @@ -5037,6 +5057,16 @@ elf_x86_64_get_synthetic_symtab (bfd *abfd, 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) @@ -5298,16 +5328,8 @@ elf_x86_64_link_setup_gnu_properties (struct bfd_link_info *info) 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)) { diff --git a/ld/testsuite/ld-x86-64/ibt-plt-1.d b/ld/testsuite/ld-x86-64/ibt-plt-1.d index b8b968df321..283dbf39036 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-1.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-1.d @@ -10,28 +10,28 @@ Disassembly of section .plt: [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]+ : +[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]+ - +[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]+ + +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) [a-f0-9]+ : +[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]+ - +[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]+ + +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) Disassembly of section .text: diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2a.d b/ld/testsuite/ld-x86-64/ibt-plt-2a.d index 3db74c36288..6f8ec7e0b1f 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2a.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2a.d @@ -10,28 +10,28 @@ Disassembly of section .plt: 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 : +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: f2 ff 25 a5 01 20 00 bnd jmp \*0x2001a5\(%rip\) # 2003d0 - +[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 + +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) 0+230 : +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: f2 ff 25 9d 01 20 00 bnd jmp \*0x20019d\(%rip\) # 2003d8 - +[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 + +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) Disassembly of section .text: diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2b.d b/ld/testsuite/ld-x86-64/ibt-plt-2b.d index 2bb59d0d836..e322ce395f1 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2b.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2b.d @@ -30,7 +30,7 @@ Contents of the .eh_frame section: 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 diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2c.d b/ld/testsuite/ld-x86-64/ibt-plt-2c.d index dd47bc7f27a..74184aed366 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2c.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2c.d @@ -10,28 +10,28 @@ Disassembly of section .plt: [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]+ : +[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]+ - +[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]+ + +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) [a-f0-9]+ : +[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]+ - +[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]+ + +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) Disassembly of section .text: diff --git a/ld/testsuite/ld-x86-64/ibt-plt-2d.d b/ld/testsuite/ld-x86-64/ibt-plt-2d.d index 9bfc415821d..b456bd3d706 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-2d.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-2d.d @@ -30,7 +30,7 @@ Contents of the .eh_frame section: 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 diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3a.d b/ld/testsuite/ld-x86-64/ibt-plt-3a.d index a7e048c04ed..a0ef8b11597 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3a.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3a.d @@ -10,28 +10,28 @@ Disassembly of section .plt: 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 : +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: f2 ff 25 a5 01 20 00 bnd jmp \*0x2001a5\(%rip\) # 2003d0 - +[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 + +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) 0+230 : +[a-f0-9]+: f3 0f 1e fa endbr64 - +[a-f0-9]+: f2 ff 25 9d 01 20 00 bnd jmp \*0x20019d\(%rip\) # 2003d8 - +[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 + +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) Disassembly of section .text: diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3b.d b/ld/testsuite/ld-x86-64/ibt-plt-3b.d index a9986573871..0e2c3eaa38a 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3b.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3b.d @@ -30,7 +30,7 @@ Contents of the .eh_frame section: 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 diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3c.d b/ld/testsuite/ld-x86-64/ibt-plt-3c.d index dac290e20cd..8be6783efcb 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3c.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3c.d @@ -10,28 +10,28 @@ Disassembly of section .plt: [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]+ : +[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]+ - +[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]+ + +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) [a-f0-9]+ : +[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]+ - +[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]+ + +[a-f0-9]+: 66 0f 1f 44 00 00 nopw 0x0\(%rax,%rax,1\) Disassembly of section .text: diff --git a/ld/testsuite/ld-x86-64/ibt-plt-3d.d b/ld/testsuite/ld-x86-64/ibt-plt-3d.d index 5a4a38c709b..30d90209b04 100644 --- a/ld/testsuite/ld-x86-64/ibt-plt-3d.d +++ b/ld/testsuite/ld-x86-64/ibt-plt-3d.d @@ -30,7 +30,7 @@ Contents of the .eh_frame section: 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 diff --git a/ld/testsuite/ld-x86-64/plt-main-ibt-x32.dd b/ld/testsuite/ld-x86-64/plt-main-ibt-x32.dd deleted file mode 100644 index 4c417df12ad..00000000000 --- a/ld/testsuite/ld-x86-64/plt-main-ibt-x32.dd +++ /dev/null @@ -1,7 +0,0 @@ -#... -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 diff --git a/ld/testsuite/ld-x86-64/plt-main-ibt.dd b/ld/testsuite/ld-x86-64/plt-main-ibt.dd index 035dd877bf3..4c417df12ad 100644 --- a/ld/testsuite/ld-x86-64/plt-main-ibt.dd +++ b/ld/testsuite/ld-x86-64/plt-main-ibt.dd @@ -3,5 +3,5 @@ Disassembly of section .plt.got: [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 diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 136371bd5a2..e30f210bf13 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -2127,13 +2127,8 @@ if { [isnative] && [check_compiler_available] } { } 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" \ -- 2.38.1