diff options
author | H.J. Lu <hjl.tools@gmail.com> | 2015-05-08 05:04:12 -0700 |
---|---|---|
committer | H.J. Lu <hjl.tools@gmail.com> | 2015-05-08 05:05:49 -0700 |
commit | 573cc2e57db66165b390044338d3a4ad51f36bf8 (patch) | |
tree | d504be11ff656471087dfa0e9eae6808c2b90b3d /gas/testsuite | |
parent | 422349a385c2ccfc1e66f5c65560e5bd5fc97953 (diff) | |
download | fsf-binutils-gdb-573cc2e57db66165b390044338d3a4ad51f36bf8.zip fsf-binutils-gdb-573cc2e57db66165b390044338d3a4ad51f36bf8.tar.gz fsf-binutils-gdb-573cc2e57db66165b390044338d3a4ad51f36bf8.tar.bz2 |
Add -mno-shared to x86 assembler
On ELF target, the assembler normally generates code which can go into a
shared library where non-weak symbols can be preempted. The -mno-shared
option tells the assembler to generate code not for a shared library,
where non-weak symbols won't be preempted. The resulting code is slightly
smaller. This option mainly affects the handling of branch instructions.
gas/
* config/tc-i386.c (no_shared): New.
(OPTION_MNO_SHARED): Likewise.
(elf_symbol_resolved_in_segment_p): Check no_shared.
(md_longopts): Add mno-shared.
(md_parse_option): Handle OPTION_MNO_SHARED.
(md_show_usage): Add -mno-shared.
* doc/c-i386.texi: Document -mno-shared.
gas/testsuite/
* gas/i386/i386.exp: Run relax-4 and x86-64-relax-3.
* gas/i386/relax-4.d: New file.
* gas/i386/x86-64-relax-3.d: Likewise.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/i386.exp | 2 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/relax-4.d | 32 | ||||
-rw-r--r-- | gas/testsuite/gas/i386/x86-64-relax-3.d | 33 |
4 files changed, 73 insertions, 0 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog index 1cfa577..d63f48a 100644 --- a/gas/testsuite/ChangeLog +++ b/gas/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2015-05-08 H.J. Lu <hongjiu.lu@intel.com> + + * gas/i386/i386.exp: Run relax-4 and x86-64-relax-3. + * gas/i386/relax-4.d: New file. + * gas/i386/x86-64-relax-3.d: Likewise. + 2015-05-07 H.J. Lu <hongjiu.lu@intel.com> * gas/i386/i386.exp: Run relax-3 and x86-64-relax-2. diff --git a/gas/testsuite/gas/i386/i386.exp b/gas/testsuite/gas/i386/i386.exp index af56c26..bedd84c 100644 --- a/gas/testsuite/gas/i386/i386.exp +++ b/gas/testsuite/gas/i386/i386.exp @@ -396,6 +396,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_32_check]] run_dump_test "note" run_dump_test "relax-3" + run_dump_test "relax-4" } # This is a PE specific test. @@ -752,6 +753,7 @@ if [expr ([istarget "i*86-*-*"] || [istarget "x86_64-*-*"]) && [gas_64_check]] t run_list_test "x86-64-size-inval-1" "-al" run_dump_test "x86-64-relax-2" + run_dump_test "x86-64-relax-3" } set ASFLAGS "$old_ASFLAGS" diff --git a/gas/testsuite/gas/i386/relax-4.d b/gas/testsuite/gas/i386/relax-4.d new file mode 100644 index 0000000..b188841 --- /dev/null +++ b/gas/testsuite/gas/i386/relax-4.d @@ -0,0 +1,32 @@ +#source: relax-3.s +#as: -mno-shared +#objdump: -dwr + +.*: +file format .* + +Disassembly of section .text: + +0+ <foo>: +[ ]*[a-f0-9]+: eb 1c jmp 1e <local> +[ ]*[a-f0-9]+: eb 16 jmp 1a <hidden_def> +[ ]*[a-f0-9]+: eb 16 jmp 1c <global_def> +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 7 <foo\+0x7> 7: (R_386_PC)?(DISP)?32 weak_def +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp c <foo\+0xc> c: (R_386_PC)?(DISP)?32 weak_hidden_undef +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 11 <foo\+0x11> 11: (R_386_PC)?(DISP)?32 weak_hidden_def +[ ]*[a-f0-9]+: e9 fc ff ff ff jmp 16 <foo\+0x16> 16: (R_386_PC)?(DISP)?32 hidden_undef + +0+1a <hidden_def>: +[ ]*[a-f0-9]+: c3 ret + +0+1b <weak_hidden_def>: +[ ]*[a-f0-9]+: c3 ret + +0+1c <global_def>: +[ ]*[a-f0-9]+: c3 ret + +0+1d <weak_def>: +[ ]*[a-f0-9]+: c3 ret + +0+1e <local>: +[ ]*[a-f0-9]+: c3 ret +#pass diff --git a/gas/testsuite/gas/i386/x86-64-relax-3.d b/gas/testsuite/gas/i386/x86-64-relax-3.d new file mode 100644 index 0000000..d0c7ee4 --- /dev/null +++ b/gas/testsuite/gas/i386/x86-64-relax-3.d @@ -0,0 +1,33 @@ +#source: relax-3.s +#as: -mno-shared +#objdump: -dwr + +.*: +file format .* + + +Disassembly of section .text: + +0+ <foo>: +[ ]*[a-f0-9]+: eb 1c jmp 1e <local> +[ ]*[a-f0-9]+: eb 16 jmp 1a <hidden_def> +[ ]*[a-f0-9]+: eb 16 jmp 1c <global_def> +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq b <foo\+0xb> 7: R_X86_64_PC32 weak_def-0x4 +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 10 <foo\+0x10> c: R_X86_64_PC32 weak_hidden_undef-0x4 +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 15 <foo\+0x15> 11: R_X86_64_PC32 weak_hidden_def-0x4 +[ ]*[a-f0-9]+: e9 00 00 00 00 jmpq 1a <hidden_def> 16: R_X86_64_PC32 hidden_undef-0x4 + +0+1a <hidden_def>: +[ ]*[a-f0-9]+: c3 retq + +0+1b <weak_hidden_def>: +[ ]*[a-f0-9]+: c3 retq + +0+1c <global_def>: +[ ]*[a-f0-9]+: c3 retq + +0+1d <weak_def>: +[ ]*[a-f0-9]+: c3 retq + +0+1e <local>: +[ ]*[a-f0-9]+: c3 retq +#pass |