diff options
author | Clément Chigot <clement.chigot@atos.net> | 2021-11-16 14:02:16 +0100 |
---|---|---|
committer | Clément Chigot <clement.chigot@atos.net> | 2022-01-12 09:08:11 +0100 |
commit | add588a8ef53a5f77f2abda08a5de643923c4cce (patch) | |
tree | f5b85c033c265d175ec30c4de2d7568ac9751f8e /gas/testsuite | |
parent | c4f5871457222f2c4a99e662dfa16b7c662f750a (diff) | |
download | gdb-add588a8ef53a5f77f2abda08a5de643923c4cce.zip gdb-add588a8ef53a5f77f2abda08a5de643923c4cce.tar.gz gdb-add588a8ef53a5f77f2abda08a5de643923c4cce.tar.bz2 |
gas: add visibility support for XCOFF
XCOFF assembly defines the visibility using an additional argument
on several pseudo-ops: .globl, .weak, .extern and .comm.
This implies that .globl and .weak syntax is different than the
usual GNU syntax. But we want to provide compatibility with AIX
assembler, especially because GCC is generating the visibility
using this XCOFF syntax.
PR 22085
bfd/ChangeLog:
* coffcode.h (coff_write_object_contents): Change XCOFF header
vstamp field to 2.
* coffgen.c (coff_print_symbol): Increase the size for n_type.
gas/ChangeLog:
* config/tc-ppc.c (ppc_xcoff_get_visibility): New function.
(ppc_globl): New function.
(ppc_weak): New function.
(ppc_comm): Add visibility field support.
(ppc_extern): Likewise.
* testsuite/gas/all/cofftag.d: Adjust to new n_type size
providing by objdump.
* testsuite/gas/ppc/test1xcoff32.d: Likewise.
* testsuite/gas/ppc/aix.exp: Add new tests.
* testsuite/gas/ppc/xcoff-visibility-1-32.d: New test.
* testsuite/gas/ppc/xcoff-visibility-1-64.d: New test.
* testsuite/gas/ppc/xcoff-visibility-1.s: New test.
include/ChangeLog:
* coff/internal.h (SYM_V_INTERNAL, SYM_V_HIDDEN,
SYM_V_PROTECTED, SYM_V_EXPORTED, SYM_V_MASK): New defines.
* coff/xcoff.h (struct xcoff_link_hash_entry): Add visibility
field.
ld/ChangeLog:
* testsuite/ld-pe/pr19803.d: Adjust to new n_type size
providing by objdump.
Diffstat (limited to 'gas/testsuite')
-rw-r--r-- | gas/testsuite/gas/all/cofftag.d | 24 | ||||
-rw-r--r-- | gas/testsuite/gas/ppc/aix.exp | 3 | ||||
-rw-r--r-- | gas/testsuite/gas/ppc/test1xcoff32.d | 40 | ||||
-rw-r--r-- | gas/testsuite/gas/ppc/xcoff-visibility-1-32.d | 70 | ||||
-rw-r--r-- | gas/testsuite/gas/ppc/xcoff-visibility-1-64.d | 70 | ||||
-rw-r--r-- | gas/testsuite/gas/ppc/xcoff-visibility-1.s | 78 |
6 files changed, 253 insertions, 32 deletions
diff --git a/gas/testsuite/gas/all/cofftag.d b/gas/testsuite/gas/all/cofftag.d index 88cf13c..2d2a4cc 100644 --- a/gas/testsuite/gas/all/cofftag.d +++ b/gas/testsuite/gas/all/cofftag.d @@ -4,22 +4,22 @@ .*: file format .* SYMBOL TABLE: -\[ 0\]\(sec -2\)\(fl 0x00\)\(ty 0\)\(scl 103\) \(nx 1\) 0x0+0000 foo.c +\[ 0\]\(sec -2\)\(fl 0x00\)\(ty 0\)\(scl 103\) \(nx 1\) 0x0+0000 foo.c File -\[ 2\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 6\) \(nx 0\) 0x0+0000 gcc2_compiled. -\[ 3\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 6\) \(nx 0\) 0x0+0000 ___gnu_compiled_c -\[ 4\]\(sec -2\)\(fl 0x00\)\(ty a\)\(scl 15\) \(nx 1\) 0x0+0000 _token +\[ 2\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 6\) \(nx 0\) 0x0+0000 gcc2_compiled. +\[ 3\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 6\) \(nx 0\) 0x0+0000 ___gnu_compiled_c +\[ 4\]\(sec -2\)\(fl 0x00\)\(ty a\)\(scl 15\) \(nx 1\) 0x0+0000 _token AUX lnno 0 size 0x4 tagndx 0 endndx 10 -\[ 6\]\(sec -(1|2)\)\(fl 0x00\)\(ty b\)\(scl 16\) \(nx 0\) 0x0+0000 _operator -\[ 7\]\(sec -(1|2)\)\(fl 0x00\)\(ty b\)\(scl 16\) \(nx 0\) 0x0+0001 _flags -\[ 8\]\(sec -(1|2)\)\(fl 0x00\)\(ty 0\)\(scl 102\) \(nx 1\) 0x0+0004 .eos +\[ 6\]\(sec -(1|2)\)\(fl 0x00\)\(ty b\)\(scl 16\) \(nx 0\) 0x0+0000 _operator +\[ 7\]\(sec -(1|2)\)\(fl 0x00\)\(ty b\)\(scl 16\) \(nx 0\) 0x0+0001 _flags +\[ 8\]\(sec -(1|2)\)\(fl 0x00\)\(ty 0\)\(scl 102\) \(nx 1\) 0x0+0004 .eos AUX lnno 0 size 0x4 tagndx 4 -\[ 10\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 1\) 0x[0-9a-f]+ .text +\[ 10\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 1\) 0x[0-9a-f]+ .text AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0 -\[ 12\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 1\) 0x[0-9a-f]+ .data +\[ 12\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 1\) 0x[0-9a-f]+ .data AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0 -\[ 14\]\(sec 3\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 1\) 0x[0-9a-f]+ .bss +\[ 14\]\(sec 3\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 1\) 0x[0-9a-f]+ .bss AUX scnlen 0x[0-9a-f]+ nreloc 0 nlnno 0 -\[ 16\]\(sec 2\)\(fl 0x00\)\(ty 2\)\(scl 2\) \(nx 0\) 0x0+0000 _token -\[ 17\]\(sec 2\)\(fl 0x00\)\(ty a\)\(scl 2\) \(nx 1\) 0x[0-9a-f]+ _what +\[ 16\]\(sec 2\)\(fl 0x00\)\(ty 2\)\(scl 2\) \(nx 0\) 0x0+0000 _token +\[ 17\]\(sec 2\)\(fl 0x00\)\(ty a\)\(scl 2\) \(nx 1\) 0x[0-9a-f]+ _what AUX lnno 0 size 0x4 tagndx 4 diff --git a/gas/testsuite/gas/ppc/aix.exp b/gas/testsuite/gas/ppc/aix.exp index 78f29f0..d74d5e8 100644 --- a/gas/testsuite/gas/ppc/aix.exp +++ b/gas/testsuite/gas/ppc/aix.exp @@ -87,4 +87,7 @@ if { [istarget "powerpc*-*-aix*"] || [istarget "rs6000-*-aix*"] } then { run_dump_test "xcoff-file-32" run_dump_test "xcoff-file-64" + + run_dump_test "xcoff-visibility-1-32" + run_dump_test "xcoff-visibility-1-64" } diff --git a/gas/testsuite/gas/ppc/test1xcoff32.d b/gas/testsuite/gas/ppc/test1xcoff32.d index 2f8f502..a0e48de 100644 --- a/gas/testsuite/gas/ppc/test1xcoff32.d +++ b/gas/testsuite/gas/ppc/test1xcoff32.d @@ -17,45 +17,45 @@ Idx Name +Size +VMA +LMA +File off +Algn 2 \.bss +00000000 0+0090 0+0090 00000000 2\*\*3 +ALLOC SYMBOL TABLE: -\[ 0\]\(sec -2\)\(fl 0x00\)\(ty 0\)\(scl 103\) \(nx 1\) 0x00000000 fake +\[ 0\]\(sec -2\)\(fl 0x00\)\(ty 0\)\(scl 103\) \(nx 1\) 0x00000000 fake File -\[ 2\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000000 \.crazy_table +\[ 2\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000000 \.crazy_table AUX val 8 prmhsh 0 snhsh 0 typ 1 algn 2 clss 1 stb 0 snstb 0 -\[ 4\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000008 +\[ 4\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000008 AUX val 96 prmhsh 0 snhsh 0 typ 1 algn 2 clss 0 stb 0 snstb 0 -\[ 6\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000008 reference_csect_relative_symbols +\[ 6\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000008 reference_csect_relative_symbols AUX indx 4 prmhsh 0 snhsh 0 typ 2 algn 0 clss 0 stb 0 snstb 0 -\[ 8\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000018 dubious_references_to_default_RW_csect +\[ 8\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000018 dubious_references_to_default_RW_csect AUX indx 4 prmhsh 0 snhsh 0 typ 2 algn 0 clss 0 stb 0 snstb 0 -\[ 10\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000028 reference_via_toc +\[ 10\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000028 reference_via_toc AUX indx 4 prmhsh 0 snhsh 0 typ 2 algn 0 clss 0 stb 0 snstb 0 -\[ 12\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000040 subtract_symbols +\[ 12\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000040 subtract_symbols AUX indx 4 prmhsh 0 snhsh 0 typ 2 algn 0 clss 0 stb 0 snstb 0 -\[ 14\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x0000005c load_addresses +\[ 14\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x0000005c load_addresses AUX indx 4 prmhsh 0 snhsh 0 typ 2 algn 0 clss 0 stb 0 snstb 0 -\[ 16\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000068 +\[ 16\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000068 AUX val 12 prmhsh 0 snhsh 0 typ 1 algn 2 clss 5 stb 0 snstb 0 -\[ 18\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000074 TOC +\[ 18\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000074 TOC AUX val 0 prmhsh 0 snhsh 0 typ 1 algn 2 clss 15 stb 0 snstb 0 -\[ 20\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000074 ignored0 +\[ 20\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000074 ignored0 AUX val 4 prmhsh 0 snhsh 0 typ 1 algn 2 clss 3 stb 0 snstb 0 -\[ 22\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000078 ignored1 +\[ 22\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000078 ignored1 AUX val 4 prmhsh 0 snhsh 0 typ 1 algn 2 clss 3 stb 0 snstb 0 -\[ 24\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x0000007c ignored2 +\[ 24\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x0000007c ignored2 AUX val 4 prmhsh 0 snhsh 0 typ 1 algn 2 clss 3 stb 0 snstb 0 -\[ 26\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000080 ignored3 +\[ 26\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000080 ignored3 AUX val 4 prmhsh 0 snhsh 0 typ 1 algn 2 clss 3 stb 0 snstb 0 -\[ 28\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000084 ignored4 +\[ 28\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000084 ignored4 AUX val 4 prmhsh 0 snhsh 0 typ 1 algn 2 clss 3 stb 0 snstb 0 -\[ 30\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000088 ignored5 +\[ 30\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x00000088 ignored5 AUX val 4 prmhsh 0 snhsh 0 typ 1 algn 2 clss 3 stb 0 snstb 0 -\[ 32\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x0000008c ignored6 +\[ 32\]\(sec 2\)\(fl 0x00\)\(ty 0\)\(scl 107\) \(nx 1\) 0x0000008c ignored6 AUX val 4 prmhsh 0 snhsh 0 typ 1 algn 2 clss 3 stb 0 snstb 0 -\[ 34\]\(sec 0\)\(fl 0x00\)\(ty 0\)\(scl 2\) \(nx 1\) 0x00000000 esym0 +\[ 34\]\(sec 0\)\(fl 0x00\)\(ty 0\)\(scl 2\) \(nx 1\) 0x00000000 esym0 AUX val 0 prmhsh 0 snhsh 0 typ 0 algn 0 clss 0 stb 0 snstb 0 -\[ 36\]\(sec 0\)\(fl 0x00\)\(ty 0\)\(scl 2\) \(nx 1\) 0x00000000 esym1 +\[ 36\]\(sec 0\)\(fl 0x00\)\(ty 0\)\(scl 2\) \(nx 1\) 0x00000000 esym1 AUX val 0 prmhsh 0 snhsh 0 typ 0 algn 0 clss 0 stb 0 snstb 0 -\[ 38\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 1\) 0x00000000 \.text +\[ 38\]\(sec 1\)\(fl 0x00\)\(ty 0\)\(scl 3\) \(nx 1\) 0x00000000 \.text AUX scnlen 0x68 nreloc 7 nlnno 0 diff --git a/gas/testsuite/gas/ppc/xcoff-visibility-1-32.d b/gas/testsuite/gas/ppc/xcoff-visibility-1-32.d new file mode 100644 index 0000000..f3d00eb --- /dev/null +++ b/gas/testsuite/gas/ppc/xcoff-visibility-1-32.d @@ -0,0 +1,70 @@ +#as: -a32 +#source: xcoff-visibility-1.s +#objdump: -t +#name: XCOFF Visibility 1 (32 bit) + +.* + +SYMBOL TABLE: +.* +.* +.* +.* +\[ 4\].*\(ty 0\).*l_novisibility +.* +\[ 6\].*\(ty 1000\).*l_internal +.* +\[ 8\].*\(ty 2000\).*l_hidden +.* +\[ 10\].*\(ty 3000\).*l_protected +.* +\[ 12\].*\(ty 4000\).*l_exported +.* +\[ 14\].*\(ty 1000\).*l_dual +.* +\[ 16\].*\(ty 0\).*globl_novisibility +.* +\[ 18\].*\(ty 1000\).*globl_internal +.* +\[ 20\].*\(ty 2000\).*globl_hidden +.* +\[ 22\].*\(ty 3000\).*globl_protected +.* +\[ 24\].*\(ty 4000\).*globl_exported +.* +\[ 26\].*\(ty 1000\).*globl_dual +.* +\[ 28\].*\(ty 0\).*weak_novisibility +.* +\[ 30\].*\(ty 1000\).*weak_internal +.* +\[ 32\].*\(ty 2000\).*weak_hidden +.* +\[ 34\].*\(ty 3000\).*weak_protected +.* +\[ 36\].*\(ty 4000\).*weak_exported +.* +\[ 38\].*\(ty 1000\).*weak_dual +.* +\[ 40\].*\(ty 0\).*comm_novisibility +.* +\[ 42\].*\(ty 1000\).*comm_internal +.* +\[ 44\].*\(ty 2000\).*comm_hidden +.* +\[ 46\].*\(ty 3000\).*comm_protected +.* +\[ 48\].*\(ty 4000\).*comm_exported +.* +\[ 50\].*\(ty 0\).*extern_novisibility +.* +\[ 52\].*\(ty 1000\).*extern_internal +.* +\[ 54\].*\(ty 2000\).*extern_hidden +.* +\[ 56\].*\(ty 3000\).*extern_protected +.* +\[ 58\].*\(ty 4000\).*extern_exported +.* +\[ 60\].*\(ty 1000\).*extern_dual +.* diff --git a/gas/testsuite/gas/ppc/xcoff-visibility-1-64.d b/gas/testsuite/gas/ppc/xcoff-visibility-1-64.d new file mode 100644 index 0000000..fd686e1 --- /dev/null +++ b/gas/testsuite/gas/ppc/xcoff-visibility-1-64.d @@ -0,0 +1,70 @@ +#as: -a64 +#source: xcoff-visibility-1.s +#objdump: -t +#name: XCOFF Visibility 1 (64 bit) + +.* + +SYMBOL TABLE: +.* +.* +.* +.* +\[ 4\].*\(ty 0\).*l_novisibility +.* +\[ 6\].*\(ty 1000\).*l_internal +.* +\[ 8\].*\(ty 2000\).*l_hidden +.* +\[ 10\].*\(ty 3000\).*l_protected +.* +\[ 12\].*\(ty 4000\).*l_exported +.* +\[ 14\].*\(ty 1000\).*l_dual +.* +\[ 16\].*\(ty 0\).*globl_novisibility +.* +\[ 18\].*\(ty 1000\).*globl_internal +.* +\[ 20\].*\(ty 2000\).*globl_hidden +.* +\[ 22\].*\(ty 3000\).*globl_protected +.* +\[ 24\].*\(ty 4000\).*globl_exported +.* +\[ 26\].*\(ty 1000\).*globl_dual +.* +\[ 28\].*\(ty 0\).*weak_novisibility +.* +\[ 30\].*\(ty 1000\).*weak_internal +.* +\[ 32\].*\(ty 2000\).*weak_hidden +.* +\[ 34\].*\(ty 3000\).*weak_protected +.* +\[ 36\].*\(ty 4000\).*weak_exported +.* +\[ 38\].*\(ty 1000\).*weak_dual +.* +\[ 40\].*\(ty 0\).*comm_novisibility +.* +\[ 42\].*\(ty 1000\).*comm_internal +.* +\[ 44\].*\(ty 2000\).*comm_hidden +.* +\[ 46\].*\(ty 3000\).*comm_protected +.* +\[ 48\].*\(ty 4000\).*comm_exported +.* +\[ 50\].*\(ty 0\).*extern_novisibility +.* +\[ 52\].*\(ty 1000\).*extern_internal +.* +\[ 54\].*\(ty 2000\).*extern_hidden +.* +\[ 56\].*\(ty 3000\).*extern_protected +.* +\[ 58\].*\(ty 4000\).*extern_exported +.* +\[ 60\].*\(ty 1000\).*extern_dual +.* diff --git a/gas/testsuite/gas/ppc/xcoff-visibility-1.s b/gas/testsuite/gas/ppc/xcoff-visibility-1.s new file mode 100644 index 0000000..995c5e5 --- /dev/null +++ b/gas/testsuite/gas/ppc/xcoff-visibility-1.s @@ -0,0 +1,78 @@ +# Tests every possible visibility using XCOFF format. +# Ensure that the visibility field is left empty if no +# visibility is provided. +# Ensure that only the last visibility is taken into +# account when several are provided. + +# Csect visibility + .globl globl_novisibility[RW] + .csect globl_novisibility[RW] + .globl globl_internal[RW], internal + .csect globl_internal[RW] + .globl globl_hidden[RW], hidden + .csect globl_hidden[RW] + .globl globl_protected[RW], protected + .csect globl_protected[RW] + .globl globl_exported[RW], exported + .csect globl_exported[RW] + .globl globl_dual[RW], exported + .globl globl_dual[RW], internal + .csect globl_dual[RW] + +# Weak csect visibility + .weak weak_novisibility[RW] + .csect weak_novisibility[RW] + .weak weak_internal[RW], internal + .csect weak_internal[RW] + .weak weak_hidden[RW], hidden + .csect weak_hidden[RW] + .weak weak_protected[RW], protected + .csect weak_protected[RW] + .weak weak_exported[RW], exported + .csect weak_exported[RW] + .weak weak_dual[RW], exported + .weak weak_dual[RW], internal + .csect weak_dual[RW] + +# Comm visibility + .comm comm_novisibility[RW], 8, 4 + .comm comm_internal[RW], 8, 4, internal + .comm comm_hidden[RW], 8, 4, hidden + .comm comm_protected[RW], 8, 4, protected + .comm comm_exported[RW], 8, 4, exported + +# Extern visibility + .extern extern_novisibility[RW] + .extern extern_internal[RW], internal + .extern extern_hidden[RW], hidden + .extern extern_protected[RW], protected + .extern extern_exported[RW], exported + .extern extern_dual[RW], exported + .extern extern_dual[RW], internal + +# Label visibility + .csect .text[PR] + .globl l_novisibility +l_novisibility: + blr + + .globl l_internal, internal +l_internal: + blr + + .globl l_hidden, hidden +l_hidden: + blr + + .globl l_protected, protected +l_protected: + blr + + .globl l_exported, exported +l_exported: + blr + + .globl l_dual, exported + .globl l_dual, internal +l_dual: + blr |