From caa65211bbbfd53c40c9ce1b79b97ccf2c679a52 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Thu, 22 Oct 2015 04:53:04 -0700 Subject: [PATCH] Add "-z call-nop=PADDING" option to ld The ld linker can transform indirect call to a locally defined function, foo, via its GOT slot, to either "NOP call foo" or "call foo NOP" where NOP is a 1-byte NOP padding. This patch adds a "-z call-nop=PADDING" option to x86 ld to control 1-byte NOP padding for x86 call instruction. PADDING is one of prefix-addr, prefix-nop, suffix-nop, prefix-NUMBER or suffix-NUMBER. bfd/ * elf32-i386.c (elf_i386_convert_load): Use call_nop_byte and check call_nop_as_suffix for 1-byte NOP padding to pad call. * elf64-x86-64.c (elf_x86_64_convert_load): Likewise. include/ * bfdlink.h (bfd_link_info): Add call_nop_as_suffix and call_nop_byte. ld/ * ld/ld.texinfo: Document "-z call-nop=PADDING" option. * emulparams/call_nop.sh: New file. * emulparams/elf_i386_be.sh: Source ${srcdir}/emulparams/call_nop.sh. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_i386_vxworks.sh: Likewise. * emulparams/elf_iamcu.sh: Likewise. * emulparams/elf_k1om.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set link_info.call_nop_byte if $CALL_NOP_BYTE isn't empty. ld/testsuite/ * ld-i386/call3.s: New file. * ld-i386/call3a.d: Likewise. * ld-i386/call3b.d: Likewise. * ld-i386/call3c.d: Likewise. * ld-i386/call3d.d: Likewise. * ld-i386/call3e.d: Likewise. * ld-i386/call3f.d: Likewise. * ld-i386/call3g.d: Likewise. * ld-i386/call3h.d: Likewise. * ld-i386/load1-nacl.d: Likewise. * ld-x86-64/call1.s: Likewise. * ld-x86-64/call1a.d: Likewise. * ld-x86-64/call1b.d: Likewise. * ld-x86-64/call1c.d: Likewise. * ld-x86-64/call1d.d: Likewise. * ld-x86-64/call1e.d: Likewise. * ld-x86-64/call1f.d: Likewise. * ld-x86-64/call1g.d: Likewise. * ld-x86-64/call1h.d: Likewise. * ld-x86-64/call1i.d: Likewise. * ld-x86-64/load1a-nacl.d: Likewise. * ld-x86-64/load1b-nacl.d: Likewise. * ld-x86-64/load1c-nacl.d: Likewise. * ld-x86-64/load1d-nacl.d: Likewise. --- bfd/ChangeLog | 6 +++ bfd/elf32-i386.c | 10 ++++- bfd/elf64-x86-64.c | 14 +++++-- include/ChangeLog | 5 +++ include/bfdlink.h | 6 +++ ld/ChangeLog | 16 ++++++++ ld/emulparams/call_nop.sh | 48 ++++++++++++++++++++++ ld/emulparams/elf32_x86_64.sh | 1 + ld/emulparams/elf_i386.sh | 1 + ld/emulparams/elf_i386_be.sh | 1 + ld/emulparams/elf_i386_chaos.sh | 1 + ld/emulparams/elf_i386_ldso.sh | 1 + ld/emulparams/elf_i386_vxworks.sh | 1 + ld/emulparams/elf_iamcu.sh | 1 + ld/emulparams/elf_k1om.sh | 1 + ld/emulparams/elf_l1om.sh | 1 + ld/emulparams/elf_x86_64.sh | 1 + ld/emultempl/elf32.em | 1 + ld/ld.texinfo | 14 +++++++ ld/testsuite/ChangeLog | 27 +++++++++++++ ld/testsuite/ld-i386/call3.s | 9 +++++ ld/testsuite/ld-i386/call3a.d | 13 ++++++ ld/testsuite/ld-i386/call3b.d | 13 ++++++ ld/testsuite/ld-i386/call3c.d | 14 +++++++ ld/testsuite/ld-i386/call3d.d | 14 +++++++ ld/testsuite/ld-i386/call3e.d | 13 ++++++ ld/testsuite/ld-i386/call3f.d | 14 +++++++ ld/testsuite/ld-i386/call3g.d | 14 +++++++ ld/testsuite/ld-i386/call3h.d | 14 +++++++ ld/testsuite/ld-i386/i386.exp | 9 +++++ ld/testsuite/ld-i386/load1-nacl.d | 59 ++++++++++++++++++++++++++++ ld/testsuite/ld-i386/load1.d | 1 + ld/testsuite/ld-x86-64/call1.s | 9 +++++ ld/testsuite/ld-x86-64/call1a.d | 13 ++++++ ld/testsuite/ld-x86-64/call1b.d | 13 ++++++ ld/testsuite/ld-x86-64/call1c.d | 14 +++++++ ld/testsuite/ld-x86-64/call1d.d | 14 +++++++ ld/testsuite/ld-x86-64/call1e.d | 13 ++++++ ld/testsuite/ld-x86-64/call1f.d | 14 +++++++ ld/testsuite/ld-x86-64/call1g.d | 14 +++++++ ld/testsuite/ld-x86-64/call1h.d | 14 +++++++ ld/testsuite/ld-x86-64/call1i.d | 14 +++++++ ld/testsuite/ld-x86-64/load1a-nacl.d | 55 ++++++++++++++++++++++++++ ld/testsuite/ld-x86-64/load1a.d | 1 + ld/testsuite/ld-x86-64/load1b-nacl.d | 55 ++++++++++++++++++++++++++ ld/testsuite/ld-x86-64/load1b.d | 1 + ld/testsuite/ld-x86-64/load1c-nacl.d | 48 ++++++++++++++++++++++ ld/testsuite/ld-x86-64/load1c.d | 1 + ld/testsuite/ld-x86-64/load1d-nacl.d | 48 ++++++++++++++++++++++ ld/testsuite/ld-x86-64/load1d.d | 1 + ld/testsuite/ld-x86-64/x86-64.exp | 13 ++++++ 51 files changed, 694 insertions(+), 5 deletions(-) create mode 100644 ld/emulparams/call_nop.sh create mode 100644 ld/testsuite/ld-i386/call3.s create mode 100644 ld/testsuite/ld-i386/call3a.d create mode 100644 ld/testsuite/ld-i386/call3b.d create mode 100644 ld/testsuite/ld-i386/call3c.d create mode 100644 ld/testsuite/ld-i386/call3d.d create mode 100644 ld/testsuite/ld-i386/call3e.d create mode 100644 ld/testsuite/ld-i386/call3f.d create mode 100644 ld/testsuite/ld-i386/call3g.d create mode 100644 ld/testsuite/ld-i386/call3h.d create mode 100644 ld/testsuite/ld-i386/load1-nacl.d create mode 100644 ld/testsuite/ld-x86-64/call1.s create mode 100644 ld/testsuite/ld-x86-64/call1a.d create mode 100644 ld/testsuite/ld-x86-64/call1b.d create mode 100644 ld/testsuite/ld-x86-64/call1c.d create mode 100644 ld/testsuite/ld-x86-64/call1d.d create mode 100644 ld/testsuite/ld-x86-64/call1e.d create mode 100644 ld/testsuite/ld-x86-64/call1f.d create mode 100644 ld/testsuite/ld-x86-64/call1g.d create mode 100644 ld/testsuite/ld-x86-64/call1h.d create mode 100644 ld/testsuite/ld-x86-64/call1i.d create mode 100644 ld/testsuite/ld-x86-64/load1a-nacl.d create mode 100644 ld/testsuite/ld-x86-64/load1b-nacl.d create mode 100644 ld/testsuite/ld-x86-64/load1c-nacl.d create mode 100644 ld/testsuite/ld-x86-64/load1d-nacl.d diff --git a/bfd/ChangeLog b/bfd/ChangeLog index afc8029a667..961a3857f6c 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2015-10-22 H.J. Lu + + * elf32-i386.c (elf_i386_convert_load): Use call_nop_byte and + check call_nop_as_suffix for 1-byte NOP padding to pad call. + * elf64-x86-64.c (elf_x86_64_convert_load): Likewise. + 2015-10-22 H.J. Lu * elf64-x86-64.c: Include opcode/i386.h. diff --git a/bfd/elf32-i386.c b/bfd/elf32-i386.c index f56b39e8386..60cd91a665d 100644 --- a/bfd/elf32-i386.c +++ b/bfd/elf32-i386.c @@ -2924,8 +2924,14 @@ convert_branch: /* Convert to "nop call foo". ADDR_PREFIX_OPCODE is a nop prefix. */ modrm = 0xe8; - nop = ADDR_PREFIX_OPCODE; - nop_offset = roff - 2; + nop = link_info->call_nop_byte; + if (link_info->call_nop_as_suffix) + { + nop_offset = roff + 3; + irel->r_offset -= 1; + } + else + nop_offset = roff - 2; } else { diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c index f8bb0d5e4ec..f864834d250 100644 --- a/bfd/elf64-x86-64.c +++ b/bfd/elf64-x86-64.c @@ -3217,6 +3217,7 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec, { /* We have "call/jmp *foo@GOTPCREL(%rip)". */ unsigned int nop; + unsigned int disp; bfd_vma nop_offset; /* Convert R_X86_64_GOTPCRELX and R_X86_64_REX_GOTPCRELX to @@ -3224,7 +3225,6 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec, modrm = bfd_get_8 (abfd, contents + roff - 1); if (modrm == 0x25) { - unsigned int disp; /* Convert to "jmp foo nop". */ modrm = 0xe9; nop = NOP_OPCODE; @@ -3238,8 +3238,16 @@ elf_x86_64_convert_load (bfd *abfd, asection *sec, /* Convert to "nop call foo". ADDR_PREFIX_OPCODE is a nop prefix. */ modrm = 0xe8; - nop = ADDR_PREFIX_OPCODE; - nop_offset = irel->r_offset - 2; + nop = link_info->call_nop_byte; + if (link_info->call_nop_as_suffix) + { + nop_offset = irel->r_offset + 3; + disp = bfd_get_32 (abfd, contents + irel->r_offset); + irel->r_offset -= 1; + bfd_put_32 (abfd, disp, contents + irel->r_offset); + } + else + nop_offset = irel->r_offset - 2; } bfd_put_8 (abfd, nop, contents + nop_offset); bfd_put_8 (abfd, modrm, contents + irel->r_offset - 1); diff --git a/include/ChangeLog b/include/ChangeLog index 530169683a7..c6b8f0b52a3 100644 --- a/include/ChangeLog +++ b/include/ChangeLog @@ -1,3 +1,8 @@ +2015-10-22 H.J. Lu + + * bfdlink.h (bfd_link_info): Add call_nop_as_suffix and + call_nop_byte. + 2015-10-07 Claudiu Zissulescu * dis-asm.h (arc_get_disassembler): Correct declaration. diff --git a/include/bfdlink.h b/include/bfdlink.h index 2ffb3d1ab56..93abab1c04e 100644 --- a/include/bfdlink.h +++ b/include/bfdlink.h @@ -434,6 +434,12 @@ struct bfd_link_info /* TRUE if generation of .interp/PT_INTERP should be suppressed. */ unsigned int nointerp: 1; + /* TRUE if generate a 1-byte NOP as suffix for x86 call instruction. */ + unsigned int call_nop_as_suffix : 1; + + /* The 1-byte NOP for x86 call instruction. */ + char call_nop_byte; + /* Char that may appear as the first char of a symbol, but should be skipped (like symbol_leading_char) when looking up symbols in wrap_hash. Used by PowerPC Linux for 'dot' symbols. */ diff --git a/ld/ChangeLog b/ld/ChangeLog index 1a12b177c60..fae891568a3 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,19 @@ +2015-10-22 H.J. Lu + + * ld/ld.texinfo: Document "-z call-nop=PADDING" option. + * emulparams/call_nop.sh: New file. + * emulparams/elf_i386_be.sh: Source + ${srcdir}/emulparams/call_nop.sh. + * emulparams/elf_i386_chaos.sh: Likewise. + * emulparams/elf_i386_ldso.sh: Likewise. + * emulparams/elf_i386_vxworks.sh: Likewise. + * emulparams/elf_iamcu.sh: Likewise. + * emulparams/elf_k1om.sh: Likewise. + * emulparams/elf_l1om.sh: Likewise. + * emulparams/elf_x86_64.sh: Likewise. + * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set + link_info.call_nop_byte if $CALL_NOP_BYTE isn't empty. + 2015-10-21 Nick Clifton PR gas/19109 diff --git a/ld/emulparams/call_nop.sh b/ld/emulparams/call_nop.sh new file mode 100644 index 00000000000..fee4a8154e9 --- /dev/null +++ b/ld/emulparams/call_nop.sh @@ -0,0 +1,48 @@ +PARSE_AND_LIST_OPTIONS_CALL_NOP=' + fprintf (file, _("\ + -z call-nop=PADDING Use PADDING as 1-byte NOP for branch\n")); +' +PARSE_AND_LIST_ARGS_CASE_Z_CALL_NOP=' + else if (strncmp (optarg, "call-nop=", 9) == 0) + { + if (strcmp (optarg + 9, "prefix-addr") == 0) + { + link_info.call_nop_as_suffix = FALSE; + link_info.call_nop_byte = 0x67; + } + else if (strcmp (optarg + 9, "prefix-nop") == 0) + { + link_info.call_nop_as_suffix = FALSE; + link_info.call_nop_byte = 0x90; + } + else if (strcmp (optarg + 9, "suffix-nop") == 0) + { + link_info.call_nop_as_suffix = TRUE; + link_info.call_nop_byte = 0x90; + } + else if (strncmp (optarg + 9, "prefix-", 7) == 0) + { + char *end; + link_info.call_nop_byte = strtoul (optarg + 16 , &end, 0); + if (*end) + einfo (_("%P%F: invalid number for -z call-nop=prefix-: %s\n"), + optarg + 16); + link_info.call_nop_as_suffix = FALSE; + } + else if (strncmp (optarg + 9, "suffix-", 7) == 0) + { + char *end; + link_info.call_nop_byte = strtoul (optarg + 16, &end, 0); + if (*end) + einfo (_("%P%F: invalid number for -z call-nop=suffix-: %s\n"), + optarg + 16); + link_info.call_nop_as_suffix = TRUE; + } + else + einfo (_("%P%F: unsupported option: -z %s\n"), optarg); + } +' + +PARSE_AND_LIST_OPTIONS="$PARSE_AND_LIST_OPTIONS $PARSE_AND_LIST_OPTIONS_CALL_NOP" +PARSE_AND_LIST_ARGS_CASE_Z="$PARSE_AND_LIST_ARGS_CASE_Z $PARSE_AND_LIST_ARGS_CASE_Z_CALL_NOP" +CALL_NOP_BYTE=0x67 diff --git a/ld/emulparams/elf32_x86_64.sh b/ld/emulparams/elf32_x86_64.sh index 8fd96fb7805..0a035483923 100644 --- a/ld/emulparams/elf32_x86_64.sh +++ b/ld/emulparams/elf32_x86_64.sh @@ -1,5 +1,6 @@ . ${srcdir}/emulparams/plt_unwind.sh . ${srcdir}/emulparams/extern_protected_data.sh +. ${srcdir}/emulparams/call_nop.sh SCRIPT_NAME=elf ELFSIZE=32 OUTPUT_FORMAT="elf32-x86-64" diff --git a/ld/emulparams/elf_i386.sh b/ld/emulparams/elf_i386.sh index ae87f6b6617..7dceea9a2dd 100644 --- a/ld/emulparams/elf_i386.sh +++ b/ld/emulparams/elf_i386.sh @@ -1,5 +1,6 @@ . ${srcdir}/emulparams/plt_unwind.sh . ${srcdir}/emulparams/extern_protected_data.sh +. ${srcdir}/emulparams/call_nop.sh SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" NO_RELA_RELOCS=yes diff --git a/ld/emulparams/elf_i386_be.sh b/ld/emulparams/elf_i386_be.sh index 06a80c7ef3c..40ed8c6608b 100644 --- a/ld/emulparams/elf_i386_be.sh +++ b/ld/emulparams/elf_i386_be.sh @@ -1,4 +1,5 @@ . ${srcdir}/emulparams/extern_protected_data.sh +. ${srcdir}/emulparams/call_nop.sh SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" NO_RELA_RELOCS=yes diff --git a/ld/emulparams/elf_i386_chaos.sh b/ld/emulparams/elf_i386_chaos.sh index c59dbce1402..33757bfd9e1 100644 --- a/ld/emulparams/elf_i386_chaos.sh +++ b/ld/emulparams/elf_i386_chaos.sh @@ -1,5 +1,6 @@ . ${srcdir}/emulparams/plt_unwind.sh . ${srcdir}/emulparams/extern_protected_data.sh +. ${srcdir}/emulparams/call_nop.sh SCRIPT_NAME=elf_chaos OUTPUT_FORMAT="elf32-i386" TEXT_START_ADDR=0x40000000 diff --git a/ld/emulparams/elf_i386_ldso.sh b/ld/emulparams/elf_i386_ldso.sh index 7fd08fe8659..f7805819b9b 100644 --- a/ld/emulparams/elf_i386_ldso.sh +++ b/ld/emulparams/elf_i386_ldso.sh @@ -1,5 +1,6 @@ . ${srcdir}/emulparams/plt_unwind.sh . ${srcdir}/emulparams/extern_protected_data.sh +. ${srcdir}/emulparams/call_nop.sh SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-i386" NO_RELA_RELOCS=yes diff --git a/ld/emulparams/elf_i386_vxworks.sh b/ld/emulparams/elf_i386_vxworks.sh index 306e8d3ee66..cb289e6307d 100644 --- a/ld/emulparams/elf_i386_vxworks.sh +++ b/ld/emulparams/elf_i386_vxworks.sh @@ -12,3 +12,4 @@ GENERATE_PIE_SCRIPT=yes NO_SMALL_DATA=yes . ${srcdir}/emulparams/vxworks.sh . ${srcdir}/emulparams/extern_protected_data.sh +. ${srcdir}/emulparams/call_nop.sh diff --git a/ld/emulparams/elf_iamcu.sh b/ld/emulparams/elf_iamcu.sh index 39c7a57e6ce..5fae6515ea3 100644 --- a/ld/emulparams/elf_iamcu.sh +++ b/ld/emulparams/elf_iamcu.sh @@ -1,5 +1,6 @@ . ${srcdir}/emulparams/plt_unwind.sh . ${srcdir}/emulparams/extern_protected_data.sh +. ${srcdir}/emulparams/call_nop.sh SCRIPT_NAME=elf OUTPUT_FORMAT="elf32-iamcu" NO_RELA_RELOCS=yes diff --git a/ld/emulparams/elf_k1om.sh b/ld/emulparams/elf_k1om.sh index 0cd606a2880..289274daca6 100644 --- a/ld/emulparams/elf_k1om.sh +++ b/ld/emulparams/elf_k1om.sh @@ -1,5 +1,6 @@ . ${srcdir}/emulparams/plt_unwind.sh . ${srcdir}/emulparams/extern_protected_data.sh +. ${srcdir}/emulparams/call_nop.sh SCRIPT_NAME=elf ELFSIZE=64 OUTPUT_FORMAT="elf64-k1om" diff --git a/ld/emulparams/elf_l1om.sh b/ld/emulparams/elf_l1om.sh index 1964e857a07..17fa8e2579c 100644 --- a/ld/emulparams/elf_l1om.sh +++ b/ld/emulparams/elf_l1om.sh @@ -1,5 +1,6 @@ . ${srcdir}/emulparams/plt_unwind.sh . ${srcdir}/emulparams/extern_protected_data.sh +. ${srcdir}/emulparams/call_nop.sh SCRIPT_NAME=elf ELFSIZE=64 OUTPUT_FORMAT="elf64-l1om" diff --git a/ld/emulparams/elf_x86_64.sh b/ld/emulparams/elf_x86_64.sh index a304771d9df..5d31da1ba1b 100644 --- a/ld/emulparams/elf_x86_64.sh +++ b/ld/emulparams/elf_x86_64.sh @@ -1,5 +1,6 @@ . ${srcdir}/emulparams/plt_unwind.sh . ${srcdir}/emulparams/extern_protected_data.sh +. ${srcdir}/emulparams/call_nop.sh SCRIPT_NAME=elf ELFSIZE=64 OUTPUT_FORMAT="elf64-x86-64" diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 8ff5fe0a261..1dc215f80f9 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -103,6 +103,7 @@ gld${EMULATION_NAME}_before_parse (void) input_flags.dynamic = ${DYNAMIC_LINK-TRUE}; config.has_shared = `if test -n "$GENERATE_SHLIB_SCRIPT" ; then echo TRUE ; else echo FALSE ; fi`; config.separate_code = `if test "x${SEPARATE_CODE}" = xyes ; then echo TRUE ; else echo FALSE ; fi`; + `if test -n "$CALL_NOP_BYTE" ; then echo link_info.call_nop_byte = $CALL_NOP_BYTE; fi`; } EOF diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 63760552a6b..0c3a55184cd 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -1199,6 +1199,20 @@ generated by compiler. Updates on protected data symbols by another module aren't visible to the resulting shared library. Supported for i386 and x86-64. +@item call-nop=prefix-addr +@itemx call-nop=prefix-nop +@itemx call-nop=suffix-nop +@itemx call-nop=prefix-@var{byte} +@itemx call-nop=suffix-@var{byte} +Specify the 1-byte @code{NOP} padding when transforming indirect call +to a locally defined function, foo, via its GOT slot. +@option{call-nop=prefix-addr} generates @code{0x67 call foo}. +@option{call-nop=prefix-nop} generates @code{0x90 call foo}. +@option{call-nop=suffix-nop} generates @code{call foo 0x90}. +@option{call-nop=prefix-@var{byte}} generates @code{@var{byte} call foo}. +@option{call-nop=suffix-@var{byte}} generates @code{call foo @var{byte}}. +Supported for i386 and x86_64. + @end table Other keywords are ignored for Solaris compatibility. diff --git a/ld/testsuite/ChangeLog b/ld/testsuite/ChangeLog index b8d04f592c9..92d7ebf0aeb 100644 --- a/ld/testsuite/ChangeLog +++ b/ld/testsuite/ChangeLog @@ -1,3 +1,30 @@ +2015-10-22 H.J. Lu + + * ld-i386/call3.s: New file. + * ld-i386/call3a.d: Likewise. + * ld-i386/call3b.d: Likewise. + * ld-i386/call3c.d: Likewise. + * ld-i386/call3d.d: Likewise. + * ld-i386/call3e.d: Likewise. + * ld-i386/call3f.d: Likewise. + * ld-i386/call3g.d: Likewise. + * ld-i386/call3h.d: Likewise. + * ld-i386/load1-nacl.d: Likewise. + * ld-x86-64/call1.s: Likewise. + * ld-x86-64/call1a.d: Likewise. + * ld-x86-64/call1b.d: Likewise. + * ld-x86-64/call1c.d: Likewise. + * ld-x86-64/call1d.d: Likewise. + * ld-x86-64/call1e.d: Likewise. + * ld-x86-64/call1f.d: Likewise. + * ld-x86-64/call1g.d: Likewise. + * ld-x86-64/call1h.d: Likewise. + * ld-x86-64/call1i.d: Likewise. + * ld-x86-64/load1a-nacl.d: Likewise. + * ld-x86-64/load1b-nacl.d: Likewise. + * ld-x86-64/load1c-nacl.d: Likewise. + * ld-x86-64/load1d-nacl.d: Likewise. + 2015-10-22 H.J. Lu * ld-ifunc/ifunc-5r-local-x86-64.d: Replace R_X86_64_GOTPCREL diff --git a/ld/testsuite/ld-i386/call3.s b/ld/testsuite/ld-i386/call3.s new file mode 100644 index 00000000000..ce003c81d0f --- /dev/null +++ b/ld/testsuite/ld-i386/call3.s @@ -0,0 +1,9 @@ + .text + .globl foo + .type foo, @function +foo: + ret + .globl _start + .type _start, @function +_start: + call *foo@GOT diff --git a/ld/testsuite/ld-i386/call3a.d b/ld/testsuite/ld-i386/call3a.d new file mode 100644 index 00000000000..a8ff27f12f5 --- /dev/null +++ b/ld/testsuite/ld-i386/call3a.d @@ -0,0 +1,13 @@ +#source: call3.s +#as: --32 +#ld: -melf_i386 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4} * addr16 call +[a-f0-9]+ +#pass diff --git a/ld/testsuite/ld-i386/call3b.d b/ld/testsuite/ld-i386/call3b.d new file mode 100644 index 00000000000..06af6f5876e --- /dev/null +++ b/ld/testsuite/ld-i386/call3b.d @@ -0,0 +1,13 @@ +#source: call3.s +#as: --32 +#ld: -melf_i386 -z call-nop=prefix-addr +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4} * addr16 call +[a-f0-9]+ +#pass diff --git a/ld/testsuite/ld-i386/call3c.d b/ld/testsuite/ld-i386/call3c.d new file mode 100644 index 00000000000..64e83728e6f --- /dev/null +++ b/ld/testsuite/ld-i386/call3c.d @@ -0,0 +1,14 @@ +#source: call3.s +#as: --32 +#ld: -melf_i386 -z call-nop=prefix-nop +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * call +[a-f0-9]+ +#pass diff --git a/ld/testsuite/ld-i386/call3d.d b/ld/testsuite/ld-i386/call3d.d new file mode 100644 index 00000000000..a9274c8dbf0 --- /dev/null +++ b/ld/testsuite/ld-i386/call3d.d @@ -0,0 +1,14 @@ +#source: call3.s +#as: --32 +#ld: -melf_i386 -z call-nop=suffix-nop +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * call +[a-f0-9]+ +[ ]*[a-f0-9]+: 90 nop +#pass diff --git a/ld/testsuite/ld-i386/call3e.d b/ld/testsuite/ld-i386/call3e.d new file mode 100644 index 00000000000..2876b49ce2d --- /dev/null +++ b/ld/testsuite/ld-i386/call3e.d @@ -0,0 +1,13 @@ +#source: call3.s +#as: --32 +#ld: -melf_i386 -z call-nop=prefix-0x67 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4} * addr16 call +[a-f0-9]+ +#pass diff --git a/ld/testsuite/ld-i386/call3f.d b/ld/testsuite/ld-i386/call3f.d new file mode 100644 index 00000000000..5ab0cf170ac --- /dev/null +++ b/ld/testsuite/ld-i386/call3f.d @@ -0,0 +1,14 @@ +#source: call3.s +#as: --32 +#ld: -melf_i386 -z call-nop=prefix-0x90 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * call +[a-f0-9]+ +#pass diff --git a/ld/testsuite/ld-i386/call3g.d b/ld/testsuite/ld-i386/call3g.d new file mode 100644 index 00000000000..828777024f8 --- /dev/null +++ b/ld/testsuite/ld-i386/call3g.d @@ -0,0 +1,14 @@ +#source: call3.s +#as: --32 +#ld: -melf_i386 -z call-nop=suffix-0x90 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * call +[a-f0-9]+ +[ ]*[a-f0-9]+: 90 nop +#pass diff --git a/ld/testsuite/ld-i386/call3h.d b/ld/testsuite/ld-i386/call3h.d new file mode 100644 index 00000000000..83f371a1bfb --- /dev/null +++ b/ld/testsuite/ld-i386/call3h.d @@ -0,0 +1,14 @@ +#source: call3.s +#as: --32 +#ld: -melf_i386 -z call-nop=suffix-144 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * call +[a-f0-9]+ +[ ]*[a-f0-9]+: 90 nop +#pass diff --git a/ld/testsuite/ld-i386/i386.exp b/ld/testsuite/ld-i386/i386.exp index 3d28dcc08fa..9bf08da83fb 100644 --- a/ld/testsuite/ld-i386/i386.exp +++ b/ld/testsuite/ld-i386/i386.exp @@ -296,9 +296,18 @@ run_dump_test "mov1b" run_dump_test "branch1" run_dump_test "call1" run_dump_test "call2" +run_dump_test "call3a" +run_dump_test "call3b" +run_dump_test "call3c" +run_dump_test "call3d" +run_dump_test "call3e" +run_dump_test "call3f" +run_dump_test "call3g" +run_dump_test "call3h" run_dump_test "jmp1" run_dump_test "jmp2" run_dump_test "load1" +run_dump_test "load1-nacl" run_dump_test "load2" run_dump_test "load3" run_dump_test "load4a" diff --git a/ld/testsuite/ld-i386/load1-nacl.d b/ld/testsuite/ld-i386/load1-nacl.d new file mode 100644 index 00000000000..1245639a19f --- /dev/null +++ b/ld/testsuite/ld-i386/load1-nacl.d @@ -0,0 +1,59 @@ +#source: load1.s +#as: --32 +#ld: -melf_i386 +#objdump: -dw --sym +#target: i?86-*-nacl* x86_64-*-nacl* + +.*: +file format .* + +SYMBOL TABLE: +#... +10030080 l O .data 0+1 bar +#... +10030081 g O .data 0+1 foo +#... + +Disassembly of section .text: + +0+20000 <_start>: +[ ]*[a-f0-9]+: 8d 05 80 00 03 10 lea 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 +[ ]*[a-f0-9]+: 81 fa 80 00 03 10 cmp \$0x10030080,%edx +[ ]*[a-f0-9]+: 81 cf 80 00 03 10 or \$0x10030080,%edi +[ ]*[a-f0-9]+: 81 de 80 00 03 10 sbb \$0x10030080,%esi +[ ]*[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]+: 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 +[ ]*[a-f0-9]+: 81 fa 80 00 03 10 cmp \$0x10030080,%edx +[ ]*[a-f0-9]+: 81 cf 80 00 03 10 or \$0x10030080,%edi +[ ]*[a-f0-9]+: 81 de 80 00 03 10 sbb \$0x10030080,%esi +[ ]*[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]+: 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 +[ ]*[a-f0-9]+: 81 fa 81 00 03 10 cmp \$0x10030081,%edx +[ ]*[a-f0-9]+: 81 cf 81 00 03 10 or \$0x10030081,%edi +[ ]*[a-f0-9]+: 81 de 81 00 03 10 sbb \$0x10030081,%esi +[ ]*[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]+: 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 +[ ]*[a-f0-9]+: 81 fa 81 00 03 10 cmp \$0x10030081,%edx +[ ]*[a-f0-9]+: 81 cf 81 00 03 10 or \$0x10030081,%edi +[ ]*[a-f0-9]+: 81 de 81 00 03 10 sbb \$0x10030081,%esi +[ ]*[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 +#pass diff --git a/ld/testsuite/ld-i386/load1.d b/ld/testsuite/ld-i386/load1.d index e93531e2246..062ea183bf9 100644 --- a/ld/testsuite/ld-i386/load1.d +++ b/ld/testsuite/ld-i386/load1.d @@ -1,6 +1,7 @@ #as: --32 #ld: -melf_i386 #objdump: -dw --sym +#notarget: i?86-*-nacl* x86_64-*-nacl* .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/call1.s b/ld/testsuite/ld-x86-64/call1.s new file mode 100644 index 00000000000..92c9f058206 --- /dev/null +++ b/ld/testsuite/ld-x86-64/call1.s @@ -0,0 +1,9 @@ + .text + .globl foo + .type foo, @function +foo: + ret + .globl _start + .type _start, @function +_start: + call *foo@GOTPCREL(%rip) diff --git a/ld/testsuite/ld-x86-64/call1a.d b/ld/testsuite/ld-x86-64/call1a.d new file mode 100644 index 00000000000..2a63b1c73ec --- /dev/null +++ b/ld/testsuite/ld-x86-64/call1a.d @@ -0,0 +1,13 @@ +#source: call1.s +#as: --64 +#ld: -melf_x86_64 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4} * addr32 callq +[a-f0-9]+ +#pass diff --git a/ld/testsuite/ld-x86-64/call1b.d b/ld/testsuite/ld-x86-64/call1b.d new file mode 100644 index 00000000000..e782fa27262 --- /dev/null +++ b/ld/testsuite/ld-x86-64/call1b.d @@ -0,0 +1,13 @@ +#source: call1.s +#as: --64 +#ld: -melf_x86_64 -z call-nop=prefix-addr +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4} * addr32 callq +[a-f0-9]+ +#pass diff --git a/ld/testsuite/ld-x86-64/call1c.d b/ld/testsuite/ld-x86-64/call1c.d new file mode 100644 index 00000000000..d058fc75a11 --- /dev/null +++ b/ld/testsuite/ld-x86-64/call1c.d @@ -0,0 +1,14 @@ +#source: call1.s +#as: --64 +#ld: -melf_x86_64 -z call-nop=prefix-nop +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * callq +[a-f0-9]+ +#pass diff --git a/ld/testsuite/ld-x86-64/call1d.d b/ld/testsuite/ld-x86-64/call1d.d new file mode 100644 index 00000000000..8871cc6f334 --- /dev/null +++ b/ld/testsuite/ld-x86-64/call1d.d @@ -0,0 +1,14 @@ +#source: call1.s +#as: --64 +#ld: -melf_x86_64 -z call-nop=suffix-nop +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * callq +[a-f0-9]+ +[ ]*[a-f0-9]+: 90 nop +#pass diff --git a/ld/testsuite/ld-x86-64/call1e.d b/ld/testsuite/ld-x86-64/call1e.d new file mode 100644 index 00000000000..7127f1a326e --- /dev/null +++ b/ld/testsuite/ld-x86-64/call1e.d @@ -0,0 +1,13 @@ +#source: call1.s +#as: --64 +#ld: -melf_x86_64 -z call-nop=prefix-0x67 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 67 e8 ([0-9a-f]{2} ){4} * addr32 callq +[a-f0-9]+ +#pass diff --git a/ld/testsuite/ld-x86-64/call1f.d b/ld/testsuite/ld-x86-64/call1f.d new file mode 100644 index 00000000000..587bade37bc --- /dev/null +++ b/ld/testsuite/ld-x86-64/call1f.d @@ -0,0 +1,14 @@ +#source: call1.s +#as: --64 +#ld: -melf_x86_64 -z call-nop=prefix-0x90 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: 90 nop +[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * callq +[a-f0-9]+ +#pass diff --git a/ld/testsuite/ld-x86-64/call1g.d b/ld/testsuite/ld-x86-64/call1g.d new file mode 100644 index 00000000000..3bb512e4f7d --- /dev/null +++ b/ld/testsuite/ld-x86-64/call1g.d @@ -0,0 +1,14 @@ +#source: call1.s +#as: --64 +#ld: -melf_x86_64 -z call-nop=suffix-0x90 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * callq +[a-f0-9]+ +[ ]*[a-f0-9]+: 90 nop +#pass diff --git a/ld/testsuite/ld-x86-64/call1h.d b/ld/testsuite/ld-x86-64/call1h.d new file mode 100644 index 00000000000..c7c8dde5473 --- /dev/null +++ b/ld/testsuite/ld-x86-64/call1h.d @@ -0,0 +1,14 @@ +#source: call1.s +#as: --64 +#ld: -melf_x86_64 -z call-nop=suffix-144 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * callq +[a-f0-9]+ +[ ]*[a-f0-9]+: 90 nop +#pass diff --git a/ld/testsuite/ld-x86-64/call1i.d b/ld/testsuite/ld-x86-64/call1i.d new file mode 100644 index 00000000000..b3684adb672 --- /dev/null +++ b/ld/testsuite/ld-x86-64/call1i.d @@ -0,0 +1,14 @@ +#source: call1.s +#as: --x32 +#ld: -melf32_x86_64 -z call-nop=suffix-0x90 +#objdump: -dw + +.*: +file format .* + + +Disassembly of section .text: + +#... +[ ]*[a-f0-9]+: e8 ([0-9a-f]{2} ){4} * callq +[a-f0-9]+ +[ ]*[a-f0-9]+: 90 nop +#pass diff --git a/ld/testsuite/ld-x86-64/load1a-nacl.d b/ld/testsuite/ld-x86-64/load1a-nacl.d new file mode 100644 index 00000000000..aba9db95373 --- /dev/null +++ b/ld/testsuite/ld-x86-64/load1a-nacl.d @@ -0,0 +1,55 @@ +#source: load1.s +#as: --64 +#ld: -melf_x86_64 +#objdump: -dw --sym +#target: x86_64-*-nacl* + +.*: +file format .* + +SYMBOL TABLE: +#... +0+100300c8 l O .data 0+1 bar +#... +0+100300c9 g O .data 0+1 foo +#... + +Disassembly of section .text: + +0+20000 <_start>: +[ ]*[a-f0-9]+: 81 d0 c8 00 03 10 adc \$0x100300c8,%eax +[ ]*[a-f0-9]+: 81 c3 c8 00 03 10 add \$0x100300c8,%ebx +[ ]*[a-f0-9]+: 81 e1 c8 00 03 10 and \$0x100300c8,%ecx +[ ]*[a-f0-9]+: 81 fa c8 00 03 10 cmp \$0x100300c8,%edx +[ ]*[a-f0-9]+: 81 ce c8 00 03 10 or \$0x100300c8,%esi +[ ]*[a-f0-9]+: 81 df c8 00 03 10 sbb \$0x100300c8,%edi +[ ]*[a-f0-9]+: 81 ed c8 00 03 10 sub \$0x100300c8,%ebp +[ ]*[a-f0-9]+: 41 81 f0 c8 00 03 10 xor \$0x100300c8,%r8d +[ ]*[a-f0-9]+: 41 f7 c7 c8 00 03 10 test \$0x100300c8,%r15d +[ ]*[a-f0-9]+: 48 81 d0 c8 00 03 10 adc \$0x100300c8,%rax +[ ]*[a-f0-9]+: 48 81 c3 c8 00 03 10 add \$0x100300c8,%rbx +[ ]*[a-f0-9]+: 48 81 e1 c8 00 03 10 and \$0x100300c8,%rcx +[ ]*[a-f0-9]+: 48 81 fa c8 00 03 10 cmp \$0x100300c8,%rdx +[ ]*[a-f0-9]+: 48 81 cf c8 00 03 10 or \$0x100300c8,%rdi +[ ]*[a-f0-9]+: 48 81 de c8 00 03 10 sbb \$0x100300c8,%rsi +[ ]*[a-f0-9]+: 48 81 ed c8 00 03 10 sub \$0x100300c8,%rbp +[ ]*[a-f0-9]+: 49 81 f0 c8 00 03 10 xor \$0x100300c8,%r8 +[ ]*[a-f0-9]+: 49 f7 c7 c8 00 03 10 test \$0x100300c8,%r15 +[ ]*[a-f0-9]+: 81 d0 c9 00 03 10 adc \$0x100300c9,%eax +[ ]*[a-f0-9]+: 81 c3 c9 00 03 10 add \$0x100300c9,%ebx +[ ]*[a-f0-9]+: 81 e1 c9 00 03 10 and \$0x100300c9,%ecx +[ ]*[a-f0-9]+: 81 fa c9 00 03 10 cmp \$0x100300c9,%edx +[ ]*[a-f0-9]+: 81 ce c9 00 03 10 or \$0x100300c9,%esi +[ ]*[a-f0-9]+: 81 df c9 00 03 10 sbb \$0x100300c9,%edi +[ ]*[a-f0-9]+: 81 ed c9 00 03 10 sub \$0x100300c9,%ebp +[ ]*[a-f0-9]+: 41 81 f0 c9 00 03 10 xor \$0x100300c9,%r8d +[ ]*[a-f0-9]+: 41 f7 c7 c9 00 03 10 test \$0x100300c9,%r15d +[ ]*[a-f0-9]+: 48 81 d0 c9 00 03 10 adc \$0x100300c9,%rax +[ ]*[a-f0-9]+: 48 81 c3 c9 00 03 10 add \$0x100300c9,%rbx +[ ]*[a-f0-9]+: 48 81 e1 c9 00 03 10 and \$0x100300c9,%rcx +[ ]*[a-f0-9]+: 48 81 fa c9 00 03 10 cmp \$0x100300c9,%rdx +[ ]*[a-f0-9]+: 48 81 cf c9 00 03 10 or \$0x100300c9,%rdi +[ ]*[a-f0-9]+: 48 81 de c9 00 03 10 sbb \$0x100300c9,%rsi +[ ]*[a-f0-9]+: 48 81 ed c9 00 03 10 sub \$0x100300c9,%rbp +[ ]*[a-f0-9]+: 49 81 f0 c9 00 03 10 xor \$0x100300c9,%r8 +[ ]*[a-f0-9]+: 49 f7 c7 c9 00 03 10 test \$0x100300c9,%r15 +#pass diff --git a/ld/testsuite/ld-x86-64/load1a.d b/ld/testsuite/ld-x86-64/load1a.d index e03efbda01d..5c9349ee4d2 100644 --- a/ld/testsuite/ld-x86-64/load1a.d +++ b/ld/testsuite/ld-x86-64/load1a.d @@ -2,6 +2,7 @@ #as: --64 #ld: -melf_x86_64 #objdump: -dw --sym +#notarget: x86_64-*-nacl* .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/load1b-nacl.d b/ld/testsuite/ld-x86-64/load1b-nacl.d new file mode 100644 index 00000000000..b6fa43d8196 --- /dev/null +++ b/ld/testsuite/ld-x86-64/load1b-nacl.d @@ -0,0 +1,55 @@ +#source: load1.s +#as: --x32 +#ld: -melf32_x86_64 +#objdump: -dw --sym +#target: x86_64-*-nacl* + +.*: +file format .* + +SYMBOL TABLE: +#... +1003008c l O .data 0+1 bar +#... +1003008d g O .data 0+1 foo +#... + +Disassembly of section .text: + +0+20000 <_start>: +[ ]*[a-f0-9]+: 81 d0 8c 00 03 10 adc \$0x1003008c,%eax +[ ]*[a-f0-9]+: 81 c3 8c 00 03 10 add \$0x1003008c,%ebx +[ ]*[a-f0-9]+: 81 e1 8c 00 03 10 and \$0x1003008c,%ecx +[ ]*[a-f0-9]+: 81 fa 8c 00 03 10 cmp \$0x1003008c,%edx +[ ]*[a-f0-9]+: 81 ce 8c 00 03 10 or \$0x1003008c,%esi +[ ]*[a-f0-9]+: 81 df 8c 00 03 10 sbb \$0x1003008c,%edi +[ ]*[a-f0-9]+: 81 ed 8c 00 03 10 sub \$0x1003008c,%ebp +[ ]*[a-f0-9]+: 41 81 f0 8c 00 03 10 xor \$0x1003008c,%r8d +[ ]*[a-f0-9]+: 41 f7 c7 8c 00 03 10 test \$0x1003008c,%r15d +[ ]*[a-f0-9]+: 48 81 d0 8c 00 03 10 adc \$0x1003008c,%rax +[ ]*[a-f0-9]+: 48 81 c3 8c 00 03 10 add \$0x1003008c,%rbx +[ ]*[a-f0-9]+: 48 81 e1 8c 00 03 10 and \$0x1003008c,%rcx +[ ]*[a-f0-9]+: 48 81 fa 8c 00 03 10 cmp \$0x1003008c,%rdx +[ ]*[a-f0-9]+: 48 81 cf 8c 00 03 10 or \$0x1003008c,%rdi +[ ]*[a-f0-9]+: 48 81 de 8c 00 03 10 sbb \$0x1003008c,%rsi +[ ]*[a-f0-9]+: 48 81 ed 8c 00 03 10 sub \$0x1003008c,%rbp +[ ]*[a-f0-9]+: 49 81 f0 8c 00 03 10 xor \$0x1003008c,%r8 +[ ]*[a-f0-9]+: 49 f7 c7 8c 00 03 10 test \$0x1003008c,%r15 +[ ]*[a-f0-9]+: 81 d0 8d 00 03 10 adc \$0x1003008d,%eax +[ ]*[a-f0-9]+: 81 c3 8d 00 03 10 add \$0x1003008d,%ebx +[ ]*[a-f0-9]+: 81 e1 8d 00 03 10 and \$0x1003008d,%ecx +[ ]*[a-f0-9]+: 81 fa 8d 00 03 10 cmp \$0x1003008d,%edx +[ ]*[a-f0-9]+: 81 ce 8d 00 03 10 or \$0x1003008d,%esi +[ ]*[a-f0-9]+: 81 df 8d 00 03 10 sbb \$0x1003008d,%edi +[ ]*[a-f0-9]+: 81 ed 8d 00 03 10 sub \$0x1003008d,%ebp +[ ]*[a-f0-9]+: 41 81 f0 8d 00 03 10 xor \$0x1003008d,%r8d +[ ]*[a-f0-9]+: 41 f7 c7 8d 00 03 10 test \$0x1003008d,%r15d +[ ]*[a-f0-9]+: 48 81 d0 8d 00 03 10 adc \$0x1003008d,%rax +[ ]*[a-f0-9]+: 48 81 c3 8d 00 03 10 add \$0x1003008d,%rbx +[ ]*[a-f0-9]+: 48 81 e1 8d 00 03 10 and \$0x1003008d,%rcx +[ ]*[a-f0-9]+: 48 81 fa 8d 00 03 10 cmp \$0x1003008d,%rdx +[ ]*[a-f0-9]+: 48 81 cf 8d 00 03 10 or \$0x1003008d,%rdi +[ ]*[a-f0-9]+: 48 81 de 8d 00 03 10 sbb \$0x1003008d,%rsi +[ ]*[a-f0-9]+: 48 81 ed 8d 00 03 10 sub \$0x1003008d,%rbp +[ ]*[a-f0-9]+: 49 81 f0 8d 00 03 10 xor \$0x1003008d,%r8 +[ ]*[a-f0-9]+: 49 f7 c7 8d 00 03 10 test \$0x1003008d,%r15 +#pass diff --git a/ld/testsuite/ld-x86-64/load1b.d b/ld/testsuite/ld-x86-64/load1b.d index 5adc89d70fd..70ef274679d 100644 --- a/ld/testsuite/ld-x86-64/load1b.d +++ b/ld/testsuite/ld-x86-64/load1b.d @@ -2,6 +2,7 @@ #as: --x32 #ld: -melf32_x86_64 #objdump: -dw --sym +#notarget: x86_64-*-nacl* .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/load1c-nacl.d b/ld/testsuite/ld-x86-64/load1c-nacl.d new file mode 100644 index 00000000000..497006ae388 --- /dev/null +++ b/ld/testsuite/ld-x86-64/load1c-nacl.d @@ -0,0 +1,48 @@ +#source: load1.s +#as: --64 +#ld: -shared -melf_x86_64 +#objdump: -dw +#target: x86_64-*-nacl* + +.*: +file format .* + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: 13 05 22 03 01 10 adc 0x10010322\(%rip\),%eax # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 03 1d 1c 03 01 10 add 0x1001031c\(%rip\),%ebx # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 23 0d 16 03 01 10 and 0x10010316\(%rip\),%ecx # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 3b 15 10 03 01 10 cmp 0x10010310\(%rip\),%edx # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 0b 35 0a 03 01 10 or 0x1001030a\(%rip\),%esi # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 1b 3d 04 03 01 10 sbb 0x10010304\(%rip\),%edi # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 2b 2d fe 02 01 10 sub 0x100102fe\(%rip\),%ebp # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 44 33 05 f7 02 01 10 xor 0x100102f7\(%rip\),%r8d # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 44 85 3d f0 02 01 10 test %r15d,0x100102f0\(%rip\) # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 48 13 05 e9 02 01 10 adc 0x100102e9\(%rip\),%rax # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 48 03 1d e2 02 01 10 add 0x100102e2\(%rip\),%rbx # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 48 23 0d db 02 01 10 and 0x100102db\(%rip\),%rcx # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 48 3b 15 d4 02 01 10 cmp 0x100102d4\(%rip\),%rdx # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 48 0b 3d cd 02 01 10 or 0x100102cd\(%rip\),%rdi # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 48 1b 35 c6 02 01 10 sbb 0x100102c6\(%rip\),%rsi # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 48 2b 2d bf 02 01 10 sub 0x100102bf\(%rip\),%rbp # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 4c 33 05 b8 02 01 10 xor 0x100102b8\(%rip\),%r8 # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 4c 85 3d b1 02 01 10 test %r15,0x100102b1\(%rip\) # 10010328 <_DYNAMIC\+0xe0> +[ ]*[a-f0-9]+: 13 05 b3 02 01 10 adc 0x100102b3\(%rip\),%eax # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 03 1d ad 02 01 10 add 0x100102ad\(%rip\),%ebx # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 23 0d a7 02 01 10 and 0x100102a7\(%rip\),%ecx # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 3b 15 a1 02 01 10 cmp 0x100102a1\(%rip\),%edx # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 0b 35 9b 02 01 10 or 0x1001029b\(%rip\),%esi # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 1b 3d 95 02 01 10 sbb 0x10010295\(%rip\),%edi # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 2b 2d 8f 02 01 10 sub 0x1001028f\(%rip\),%ebp # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 44 33 05 88 02 01 10 xor 0x10010288\(%rip\),%r8d # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 44 85 3d 81 02 01 10 test %r15d,0x10010281\(%rip\) # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 48 13 05 7a 02 01 10 adc 0x1001027a\(%rip\),%rax # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 48 03 1d 73 02 01 10 add 0x10010273\(%rip\),%rbx # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 48 23 0d 6c 02 01 10 and 0x1001026c\(%rip\),%rcx # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 48 3b 15 65 02 01 10 cmp 0x10010265\(%rip\),%rdx # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 48 0b 3d 5e 02 01 10 or 0x1001025e\(%rip\),%rdi # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 48 1b 35 57 02 01 10 sbb 0x10010257\(%rip\),%rsi # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 48 2b 2d 50 02 01 10 sub 0x10010250\(%rip\),%rbp # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 4c 33 05 49 02 01 10 xor 0x10010249\(%rip\),%r8 # 10010330 <_DYNAMIC\+0xe8> +[ ]*[a-f0-9]+: 4c 85 3d 42 02 01 10 test %r15,0x10010242\(%rip\) # 10010330 <_DYNAMIC\+0xe8> +#pass diff --git a/ld/testsuite/ld-x86-64/load1c.d b/ld/testsuite/ld-x86-64/load1c.d index 2e0eb077afa..b589d972f4c 100644 --- a/ld/testsuite/ld-x86-64/load1c.d +++ b/ld/testsuite/ld-x86-64/load1c.d @@ -2,6 +2,7 @@ #as: --64 #ld: -shared -melf_x86_64 #objdump: -dw +#notarget: x86_64-*-nacl* .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/load1d-nacl.d b/ld/testsuite/ld-x86-64/load1d-nacl.d new file mode 100644 index 00000000000..97fd749f768 --- /dev/null +++ b/ld/testsuite/ld-x86-64/load1d-nacl.d @@ -0,0 +1,48 @@ +#source: load1.s +#as: --x32 +#ld: -shared -melf32_x86_64 +#objdump: -dw +#target: x86_64-*-nacl* + +.*: +file format .* + +Disassembly of section .text: + +0+ <_start>: +[ ]*[a-f0-9]+: 13 05 fa 01 01 10 adc 0x100101fa\(%rip\),%eax # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 03 1d f4 01 01 10 add 0x100101f4\(%rip\),%ebx # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 23 0d ee 01 01 10 and 0x100101ee\(%rip\),%ecx # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 3b 15 e8 01 01 10 cmp 0x100101e8\(%rip\),%edx # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 0b 35 e2 01 01 10 or 0x100101e2\(%rip\),%esi # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 1b 3d dc 01 01 10 sbb 0x100101dc\(%rip\),%edi # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 2b 2d d6 01 01 10 sub 0x100101d6\(%rip\),%ebp # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 44 33 05 cf 01 01 10 xor 0x100101cf\(%rip\),%r8d # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 44 85 3d c8 01 01 10 test %r15d,0x100101c8\(%rip\) # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 48 13 05 c1 01 01 10 adc 0x100101c1\(%rip\),%rax # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 48 03 1d ba 01 01 10 add 0x100101ba\(%rip\),%rbx # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 48 23 0d b3 01 01 10 and 0x100101b3\(%rip\),%rcx # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 48 3b 15 ac 01 01 10 cmp 0x100101ac\(%rip\),%rdx # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 48 0b 3d a5 01 01 10 or 0x100101a5\(%rip\),%rdi # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 48 1b 35 9e 01 01 10 sbb 0x1001019e\(%rip\),%rsi # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 48 2b 2d 97 01 01 10 sub 0x10010197\(%rip\),%rbp # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 4c 33 05 90 01 01 10 xor 0x10010190\(%rip\),%r8 # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 4c 85 3d 89 01 01 10 test %r15,0x10010189\(%rip\) # 10010200 <_DYNAMIC\+0x70> +[ ]*[a-f0-9]+: 13 05 8b 01 01 10 adc 0x1001018b\(%rip\),%eax # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 03 1d 85 01 01 10 add 0x10010185\(%rip\),%ebx # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 23 0d 7f 01 01 10 and 0x1001017f\(%rip\),%ecx # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 3b 15 79 01 01 10 cmp 0x10010179\(%rip\),%edx # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 0b 35 73 01 01 10 or 0x10010173\(%rip\),%esi # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 1b 3d 6d 01 01 10 sbb 0x1001016d\(%rip\),%edi # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 2b 2d 67 01 01 10 sub 0x10010167\(%rip\),%ebp # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 44 33 05 60 01 01 10 xor 0x10010160\(%rip\),%r8d # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 44 85 3d 59 01 01 10 test %r15d,0x10010159\(%rip\) # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 48 13 05 52 01 01 10 adc 0x10010152\(%rip\),%rax # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 48 03 1d 4b 01 01 10 add 0x1001014b\(%rip\),%rbx # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 48 23 0d 44 01 01 10 and 0x10010144\(%rip\),%rcx # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 48 3b 15 3d 01 01 10 cmp 0x1001013d\(%rip\),%rdx # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 48 0b 3d 36 01 01 10 or 0x10010136\(%rip\),%rdi # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 48 1b 35 2f 01 01 10 sbb 0x1001012f\(%rip\),%rsi # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 48 2b 2d 28 01 01 10 sub 0x10010128\(%rip\),%rbp # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 4c 33 05 21 01 01 10 xor 0x10010121\(%rip\),%r8 # 10010208 <_DYNAMIC\+0x78> +[ ]*[a-f0-9]+: 4c 85 3d 1a 01 01 10 test %r15,0x1001011a\(%rip\) # 10010208 <_DYNAMIC\+0x78> +#pass diff --git a/ld/testsuite/ld-x86-64/load1d.d b/ld/testsuite/ld-x86-64/load1d.d index 68292acc567..ec07c4f5438 100644 --- a/ld/testsuite/ld-x86-64/load1d.d +++ b/ld/testsuite/ld-x86-64/load1d.d @@ -2,6 +2,7 @@ #as: --x32 #ld: -shared -melf32_x86_64 #objdump: -dw +#notarget: x86_64-*-nacl* .*: +file format .* diff --git a/ld/testsuite/ld-x86-64/x86-64.exp b/ld/testsuite/ld-x86-64/x86-64.exp index 7b8990b58bf..6caea5f4d5b 100644 --- a/ld/testsuite/ld-x86-64/x86-64.exp +++ b/ld/testsuite/ld-x86-64/x86-64.exp @@ -325,6 +325,19 @@ run_dump_test "load1a" run_dump_test "load1b" run_dump_test "load1c" run_dump_test "load1d" +run_dump_test "load1a-nacl" +run_dump_test "load1b-nacl" +run_dump_test "load1c-nacl" +run_dump_test "load1d-nacl" +run_dump_test "call1a" +run_dump_test "call1b" +run_dump_test "call1c" +run_dump_test "call1d" +run_dump_test "call1e" +run_dump_test "call1f" +run_dump_test "call1g" +run_dump_test "call1h" +run_dump_test "call1i" run_dump_test "pr17935-1" run_dump_test "pr17935-2" run_dump_test "pr18160" -- 2.30.2