This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [Patch mach-o/GAS 2/3] support mach-o symbol qualifiers (tests 1).
- From: Tristan Gingold <gingold at adacore dot com>
- To: Iain Sandoe <developer at sandoe-acoustics dot co dot uk>
- Cc: binutils Development <binutils at sourceware dot org>
- Date: Thu, 5 Jan 2012 09:49:59 +0100
- Subject: Re: [Patch mach-o/GAS 2/3] support mach-o symbol qualifiers (tests 1).
- References: <AC8E10D0-F336-4BF6-9BDF-813A4D122128@sandoe-acoustics.co.uk>
On Dec 30, 2011, at 9:24 PM, Iain Sandoe wrote:
> this patch provides tests for the mach-o symbol qualifiers (.weak_reference, .private_extern &c.).
> this is less implications associated with .indirect_symbols (part 3).
>
> OK?
Ok for the non indirect_symbols one.
Tristan.
> Iain
>
> gas/testsuite:
>
> * gas/mach-o/err-syms-1.s: New.
> * gas/mach-o/err-syms-2.s: New.
> * gas/mach-o/err-syms-3.s: New.
> * gas/mach-o/err-syms-4.s: New.
> * gas/mach-o/err-syms-5.s: New.
> * gas/mach-o/err-syms-6.s: New.
> * gas/mach-o/symbols-2.d: New.
> * gas/mach-o/symbols-2.s: New.
> * gas/mach-o/symbols-3.s: New.
> * gas/mach-o/symbols-4.s: New.
> * gas/mach-o/symbols-5.d: New.
> * gas/mach-o/symbols-5.s: New.
>
> (only needed if the indirect symbols support tests are not yet applied)
>
> * gas/mach-o/symbols-base-64.s
> * gas/mach-o/symbols-base.s
>
> gas/testsuite/gas/mach-o/err-syms-1.s | 12 +++
> gas/testsuite/gas/mach-o/err-syms-2.s | 15 ++++
> gas/testsuite/gas/mach-o/err-syms-3.s | 10 +++
> gas/testsuite/gas/mach-o/err-syms-4.s | 6 ++
> gas/testsuite/gas/mach-o/err-syms-5.s | 19 +++++
> gas/testsuite/gas/mach-o/err-syms-6.s | 20 +++++
> gas/testsuite/gas/mach-o/symbols-2.d | 7 ++
> gas/testsuite/gas/mach-o/symbols-2.s | 9 ++
> gas/testsuite/gas/mach-o/symbols-3.s | 111 ++++++++++++++++++++++++++
> gas/testsuite/gas/mach-o/symbols-4.s | 65 ++++++++++++++++
> gas/testsuite/gas/mach-o/symbols-5.d | 11 +++
> gas/testsuite/gas/mach-o/symbols-5.s | 17 ++++
> gas/testsuite/gas/mach-o/symbols-base-64.s | 97 +++++++++++++++++++++++
> gas/testsuite/gas/mach-o/symbols-base.s | 97 +++++++++++++++++++++++
>
> diff --git a/gas/testsuite/gas/mach-o/err-syms-1.s b/gas/testsuite/gas/mach-o/err-syms-1.s
> new file mode 100644
> index 0000000..84146c7
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/err-syms-1.s
> @@ -0,0 +1,12 @@
> +# { dg-do assemble }
> +
> + .globl a
> +a: .space 1
> + .local a
> +
> + .private_extern b
> +b: .space 1
> + .local b
> +
> +# { dg-error ".a. previously declared as .global." "" { target *-*-darwin*} 5 }
> +# { dg-error ".b. previously declared as .private extern." "" { target *-*-darwin*} 9 }
> diff --git a/gas/testsuite/gas/mach-o/err-syms-2.s b/gas/testsuite/gas/mach-o/err-syms-2.s
> new file mode 100644
> index 0000000..ad4a692
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/err-syms-2.s
> @@ -0,0 +1,15 @@
> +# { dg-do assemble }
> +
> + .section __weak, __weak, coalesced
> +
> +a: .space 1
> + .weak_definition a
> +
> + .weak_definition b
> +b: .space 1
> +
> + .weak_definition c
> +
> +# { dg-error "Non-global symbol: .a. can.t be a weak_definition." "" { target *-*-darwin*} 0 }
> +# { dg-error "Non-global symbol: .b. can.t be a weak_definition." "" { target *-*-darwin*} 0 }
> +# { dg-error ".c. can.t be a weak_definition .since it is undefined." "" { target *-*-darwin*} 0 }
> diff --git a/gas/testsuite/gas/mach-o/err-syms-3.s b/gas/testsuite/gas/mach-o/err-syms-3.s
> new file mode 100644
> index 0000000..8315d86
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/err-syms-3.s
> @@ -0,0 +1,10 @@
> +# { dg-do assemble }
> +
> + .weak_definition a
> +a: .space 1
> +
> +b: .space 1
> + .weak_definition b
> +
> +# { dg-error ".a. can.t be a weak_definition .currently only supported in sections of type coalesced." "" { target *-*-darwin*} 4 }
> +# { dg-error ".b. can.t be a weak_definition .currently only supported in sections of type coalesced." "" { target *-*-darwin*} 7 }
> diff --git a/gas/testsuite/gas/mach-o/err-syms-4.s b/gas/testsuite/gas/mach-o/err-syms-4.s
> new file mode 100644
> index 0000000..0bb55e9
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/err-syms-4.s
> @@ -0,0 +1,6 @@
> +# { dg-do assemble }
> +
> + .indirect_symbol a
> +
> +# { dg-error " an .indirect_symbol must be in a symbol pointer or stub section." "" { target *-*-darwin*} 3 }
> +
> diff --git a/gas/testsuite/gas/mach-o/err-syms-5.s b/gas/testsuite/gas/mach-o/err-syms-5.s
> new file mode 100644
> index 0000000..81e38ea
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/err-syms-5.s
> @@ -0,0 +1,19 @@
> +# { dg-do assemble { target i?86-*-darwin* powerpc*-*-darwin* } }
> +
> + .section __dummy, __dummy, symbol_stubs,strip_static_syms,4
> +
> + .indirect_symbol a
> +
> + .section __dummy, __dummy1,lazy_symbol_pointers
> +
> + .indirect_symbol b
> +
> + .section __dummy, __dummy2,non_lazy_symbol_pointers
> +
> + .indirect_symbol c
> +
> +# TODO: we should be checking that the number of symbols agrees with the section
> +# size.
> +# { dg-error "missing indirect symbols for section .__dummy,__dummy." "" { xfail *-*-darwin*} 3 }
> +# { dg-error "missing indirect symbols for section .__dummy,__dummy1." "" { xfail *-*-darwin*} 3 }
> +# { dg-error "missing indirect symbols for section .__dummy,__dummy1." "" { xfail *-*-darwin*} 3 }
> diff --git a/gas/testsuite/gas/mach-o/err-syms-6.s b/gas/testsuite/gas/mach-o/err-syms-6.s
> new file mode 100644
> index 0000000..95db793
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/err-syms-6.s
> @@ -0,0 +1,20 @@
> +# { dg-do assemble { target x86_64-*-darwin* } }
> +
> + .section __dummy, __dummy, symbol_stubs,strip_static_syms,4
> +
> + .indirect_symbol a
> +
> + .section __dummy, __dummy1,lazy_symbol_pointers
> +
> + .indirect_symbol b
> +
> + .section __dummy, __dummy2,non_lazy_symbol_pointers
> +
> + .indirect_symbol c
> +
> +# { dg-error "unknown or invalid section type .symbol_stubs." "" { target x86_64-*-darwin* } 3 }
> +# { dg-error "an .indirect_symbol must be in a symbol pointer or stub section" "" { target x86_64-*-darwin* } 5 }
> +# { dg-error "unknown or invalid section type .lazy_symbol_pointers." "" { target x86_64-*-darwin* } 7 }
> +# { dg-error "an .indirect_symbol must be in a symbol pointer or stub section" "" { target x86_64-*-darwin* } 9 }
> +# { dg-error "unknown or invalid section type .non_lazy_symbol_pointers." "" { target x86_64-*-darwin* } 11 }
> +# { dg-error "an .indirect_symbol must be in a symbol pointer or stub section" "" { target x86_64-*-darwin* } 13 }
> diff --git a/gas/testsuite/gas/mach-o/symbols-2.d b/gas/testsuite/gas/mach-o/symbols-2.d
> new file mode 100644
> index 0000000..c4bfcbd
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/symbols-2.d
> @@ -0,0 +1,7 @@
> +#objdump: -t
> +# weak_definitions.
> +.*: +file format mach-o.*
> +#...
> +SYMBOL TABLE:
> +(00000000)?00000000 g.*1f SECT.*02 0080 \[__weak.__weak\] a
> +(00000000)?00000001 g.*0f SECT.*02 0080 \[__weak.__weak\] b
> diff --git a/gas/testsuite/gas/mach-o/symbols-2.s b/gas/testsuite/gas/mach-o/symbols-2.s
> new file mode 100644
> index 0000000..2ba36d1
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/symbols-2.s
> @@ -0,0 +1,9 @@
> + .section __weak, __weak, coalesced
> +
> + .private_extern a
> + .weak_definition a
> +a: .space 1
> +
> + .globl b
> + .weak_definition b
> +b: .space 1
> diff --git a/gas/testsuite/gas/mach-o/symbols-3.s b/gas/testsuite/gas/mach-o/symbols-3.s
> new file mode 100644
> index 0000000..054fdf6
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/symbols-3.s
> @@ -0,0 +1,111 @@
> +# indirect references, stubs and {non,}_lazy_symbol_pointer sections.
> +# not applicable to x86_64 mach-o.
> +
> + .text
> + .globl c
> + .globl c1
> + .globl c2
> +c: nop
> +c1: nop
> +c2: nop
> +
> +e: nop
> +e1: nop
> +e2: nop
> +
> + .data
> +d: .space 8
> +d1: .space 8
> +d2: .space 8
> +
> + .private_extern f
> + .private_extern f1
> + .private_extern f2
> +f: .space 8
> +f1: .space 8
> +f2: .space 8
> +
> + .section __dummy, __dummy, symbol_stubs,strip_static_syms,8
> +
> + .indirect_symbol a
> +La: .space 8
> +
> + .indirect_symbol b
> +Lb: .space 8
> +
> + .indirect_symbol c
> +Lc: .space 8
> +
> + .indirect_symbol d
> +Ld: .space 8
> +
> + .indirect_symbol e
> +Le: .space 8
> +
> + .indirect_symbol f
> +Lf: .space 8
> +
> + .private_extern g
> + .indirect_symbol g
> +Lg: .space 8
> +
> + .lazy_symbol_pointer
> +
> + .indirect_symbol a1
> +La1: .space 4
> +
> + .indirect_symbol b1
> +Lb1: .space 4
> +
> + .indirect_symbol c1
> +Lc1: .space 4
> +
> + .indirect_symbol d1
> +Ld1: .space 4
> +
> + .indirect_symbol e1
> +Le1: .space 4
> +
> + .indirect_symbol f1
> +Lf1: .space 4
> +
> + .private_extern g1
> + .indirect_symbol g1
> +Lg1: .space 4
> +
> + .non_lazy_symbol_pointer
> +
> + .indirect_symbol a2
> +La2: .space 4
> +
> + .indirect_symbol b2
> +Lb2: .space 4
> +
> + .indirect_symbol c2
> +Lc2: .space 4
> +
> + .indirect_symbol d2
> +Ld2: .space 4
> +
> + .indirect_symbol e2
> +Le2: .space 4
> +
> + .indirect_symbol f2
> +Lf2: .space 4
> +
> + .private_extern g2
> + .indirect_symbol g2
> +Lg2: .space 4
> +
> + .indirect_symbol f1
> +Lf11: .space 4
> +
> + .private_extern g1
> + .indirect_symbol g1
> +Lg11: .space 4
> +
> + .indirect_symbol a2
> +La12: .space 4
> +
> + .indirect_symbol b2
> +Lb12: .space 4
> diff --git a/gas/testsuite/gas/mach-o/symbols-4.s b/gas/testsuite/gas/mach-o/symbols-4.s
> new file mode 100644
> index 0000000..8800806
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/symbols-4.s
> @@ -0,0 +1,65 @@
> +# Reference & dead strip permutations.
> +
> + .text
> +
> + .reference ua
> + .lazy_reference ub
> +
> + .reference ua1
> + .private_extern ua1
> +
> + .private_extern ub1
> + .lazy_reference ub1
> +
> +c: .space 1
> + .reference c
> +
> +d: .space 1
> + .lazy_reference d
> +
> + .reference c1
> +c1: .space 1
> +
> + .lazy_reference d1
> +d1: .space 1
> +
> + .private_extern e
> + .reference e
> +
> + .private_extern f
> + .lazy_reference f
> +
> +g: .space 1
> + .private_extern g
> + .reference g
> +
> +h: .space 1
> + .private_extern h
> + .lazy_reference h
> +
> + .private_extern g1
> + .reference g1
> +g1: .space 1
> +
> + .private_extern h1
> + .lazy_reference h1
> +h1: .space 1
> +
> + .no_dead_strip n
> +
> + .globl m
> + .no_dead_strip m
> +
> + .private_extern p
> + .no_dead_strip p
> +
> +n1: .space 1
> + .no_dead_strip n1
> +
> +m1: .space 1
> + .globl m1
> + .no_dead_strip m1
> +
> +p1: .space 1
> + .private_extern p1
> + .no_dead_strip p1
> diff --git a/gas/testsuite/gas/mach-o/symbols-5.d b/gas/testsuite/gas/mach-o/symbols-5.d
> new file mode 100644
> index 0000000..7f87e74
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/symbols-5.d
> @@ -0,0 +1,11 @@
> +#objdump: -t
> +# globals and private_externs
> +.*: +file format mach-o.*
> +#...
> +SYMBOL TABLE:
> +(00000000)?00000000 g.*1f SECT.*01 0000 \[.text\] a
> +(00000000)?00000001 g.*0f SECT.*01 0000 \[.text\] b
> +(00000000)?00000002 g.*1f SECT.*01 0000 \[.text\] c
> +(00000000)?00000000 g.*11 UND.*00 0000 d
> +(00000000)?00000000 g.*01 UND.*00 0000 e
> +(00000000)?00000000 g.*11 UND.*00 0000 f
> diff --git a/gas/testsuite/gas/mach-o/symbols-5.s b/gas/testsuite/gas/mach-o/symbols-5.s
> new file mode 100644
> index 0000000..a43266d
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/symbols-5.s
> @@ -0,0 +1,17 @@
> +
> + .private_extern a
> +a: .space 1
> +
> + .globl b
> +b: .space 1
> +
> + .private_extern c
> + .globl c
> +c: .space 1
> +
> + .private_extern d
> +
> + .globl e
> +
> + .globl f
> + .private_extern f
> diff --git a/gas/testsuite/gas/mach-o/symbols-base-64.s b/gas/testsuite/gas/mach-o/symbols-base-64.s
> new file mode 100644
> index 0000000..604501c
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/symbols-base-64.s
> @@ -0,0 +1,97 @@
> +# baseline symbols in sections.
> +Lzt0: .space 1
> + .globl ztg0
> +ztg0: .space 1
> +Lmt0: .space 1
> + .globl mtg0
> +mtg0: .space 1
> +Lat0: .space 1
> + .globl atg0
> +atg0: .space 1
> +
> + .quad _zut0
> + .quad _mut0
> + .quad _aut0
> +
> + .comm zcommon0, 10, 3
> + .comm mcommon0, 10, 3
> + .comm acommon0, 10, 3
> +
> + .data
> +Lzd0: .space 1
> + .globl zdg0
> +zdg0: .space 1
> +Lmd0: .space 1
> + .globl mdg0
> +mdg0: .space 1
> +adg0: .space 1
> + .globl adg0
> +Lad0: .space 1
> +
> + .quad _zud0
> + .quad _mud0
> + .quad _aud0
> +
> + .lcomm zlcomm0, 5, 1
> + .lcomm mlcomm0, 5, 1
> + .lcomm alcomm0, 5, 1
> +
> + .section __HERE,__there
> +Lzs0: .space 1
> + .globl zsg0
> +zsg0: .space 1
> +Lms0: .space 1
> + .globl msg0
> +msg0: .space 1
> +Las0: .space 1
> +asg0: .space 1
> + .globl asg0
> +
> + .quad _zus0
> + .quad _mus0
> + .quad _aus0
> +
> + .text
> +Lzt1: .space 1
> + .globl ztg1
> +ztg1: .space 1
> + .globl mtg1
> +mtg1: .space 1
> +Lmt1: .space 1
> +atg1: .space 1
> + .globl atg1
> +Lat1: .space 1
> +
> + .comm zcommon1, 10, 3
> + .comm mcommon1, 10, 3
> + .comm acommon1, 10, 3
> +
> + .data
> +Lzd1: .space 1
> + .globl zdg1, mdg1, adg1
> +zdg1: .space 1
> +Lmd1: .space 1
> +mdg1: .space 1
> +adg1: .space 1
> +Lad1: .space 1
> +
> + .quad _zud1
> + .quad _mud1
> + .quad _aud1
> +
> + .lcomm zlcomm1, 5, 1
> + .lcomm mlcomm1, 5, 1
> + .lcomm alcomm1, 5, 1
> +
> + .section __HERE,__there
> + .quad _zus1
> +Lzs1: .space 1
> +zsg1: .space 1
> + .quad _mus1
> +msg1: .space 1
> +asg1: .space 1
> + .globl zsg1, msg1, asg1
> +Lms1: .space 1
> +Las1: .space 1
> +
> + .quad _aus1
> diff --git a/gas/testsuite/gas/mach-o/symbols-base.s b/gas/testsuite/gas/mach-o/symbols-base.s
> new file mode 100644
> index 0000000..a7b8e75
> --- /dev/null
> +++ b/gas/testsuite/gas/mach-o/symbols-base.s
> @@ -0,0 +1,97 @@
> +# baseline symbols in sections.
> +Lzt0: .space 1
> + .globl ztg0
> +ztg0: .space 1
> +Lmt0: .space 1
> + .globl mtg0
> +mtg0: .space 1
> +Lat0: .space 1
> + .globl atg0
> +atg0: .space 1
> +
> + .long _zut0
> + .long _mut0
> + .long _aut0
> +
> + .comm zcommon0, 10, 3
> + .comm mcommon0, 10, 3
> + .comm acommon0, 10, 3
> +
> + .data
> +Lzd0: .space 1
> + .globl zdg0
> +zdg0: .space 1
> +Lmd0: .space 1
> + .globl mdg0
> +mdg0: .space 1
> +adg0: .space 1
> + .globl adg0
> +Lad0: .space 1
> +
> + .long _zud0
> + .long _mud0
> + .long _aud0
> +
> + .lcomm zlcomm0, 5, 1
> + .lcomm mlcomm0, 5, 1
> + .lcomm alcomm0, 5, 1
> +
> + .section __HERE,__there
> +Lzs0: .space 1
> + .globl zsg0
> +zsg0: .space 1
> +Lms0: .space 1
> + .globl msg0
> +msg0: .space 1
> +Las0: .space 1
> +asg0: .space 1
> + .globl asg0
> +
> + .long _zus0
> + .long _mus0
> + .long _aus0
> +
> + .text
> +Lzt1: .space 1
> + .globl ztg1
> +ztg1: .space 1
> + .globl mtg1
> +mtg1: .space 1
> +Lmt1: .space 1
> +atg1: .space 1
> + .globl atg1
> +Lat1: .space 1
> +
> + .comm zcommon1, 10, 3
> + .comm mcommon1, 10, 3
> + .comm acommon1, 10, 3
> +
> + .data
> +Lzd1: .space 1
> + .globl zdg1, mdg1, adg1
> +zdg1: .space 1
> +Lmd1: .space 1
> +mdg1: .space 1
> +adg1: .space 1
> +Lad1: .space 1
> +
> + .long _zud1
> + .long _mud1
> + .long _aud1
> +
> + .lcomm zlcomm1, 5, 1
> + .lcomm mlcomm1, 5, 1
> + .lcomm alcomm1, 5, 1
> +
> + .section __HERE,__there
> + .long _zus1
> +Lzs1: .space 1
> +zsg1: .space 1
> + .long _mus1
> +msg1: .space 1
> +asg1: .space 1
> + .globl zsg1, msg1, asg1
> +Lms1: .space 1
> +Las1: .space 1
> +
> + .long _aus1
>