aboutsummaryrefslogtreecommitdiff
path: root/gas/testsuite
diff options
context:
space:
mode:
authorIain Sandoe <iain@codesourcery.com>2012-01-09 10:47:50 +0000
committerIain Sandoe <iain@codesourcery.com>2012-01-09 10:47:50 +0000
commitb22161d698a0541ddede4074f85dad037d72af05 (patch)
tree53cf2020927eaf6eb69edecb085e14ae1ed33713 /gas/testsuite
parent9f2f828a179a3c726c880ab151ffd297c3c966aa (diff)
downloadgdb-b22161d698a0541ddede4074f85dad037d72af05.zip
gdb-b22161d698a0541ddede4074f85dad037d72af05.tar.gz
gdb-b22161d698a0541ddede4074f85dad037d72af05.tar.bz2
add symbol qualifiers for mach-o to bfd/gas
bfd: * mach-o.c (bfd_mach_o_bfd_copy_private_symbol_data): Implement. (bfd_mach_o_write_symtab): Remove handling for indirect syms. (bfd_mach_o_primary_symbol_sort_key): Likewise. (bfd_mach_o_cf_symbols): Likewise. (bfd_mach_o_sort_symbol_table): Remove. (bfd_mach_o_mangle_symbols): Adjust arguments, remove handling for indirect and dysymtab counts. Do the symbol sorting here. (bfd_mach_o_build_dysymtab_command): Count the symbol types here. Make the indirect symbols a TODO. (bfd_mach_o_build_commands): Adjust call to bfd_mach_o_mangle_symbols. (bfd_mach_o_make_empty_symbol): Specifically flag unset symbols with a non-zero value. (bfd_mach_o_read_symtab_symbol): Record the symbol index. (bfd_mach_o_read_symtab_symbol): Adjust recording of global status. * mach-o.h (mach_o_data_struct): Remove indirect and dysymtab entries. (IS_MACHO_INDIRECT): Remove. (SYM_MACHO_FIELDS_UNSET, SYM_MACHO_FIELDS_NOT_VALIDATED): New. gas: * config/obj-macho.c (obj_mach_o_weak): Remove. (obj_mach_o_common_parse): Set symbol qualifiers. (LAZY, REFE): New macros. (obj_mach_o_symbol_type): New enum. (obj_mach_o_set_symbol_qualifier): New. (obj_mach_o_sym_qual): New. (mach_o_pseudo_table): Add symbol qualifiers, set indirect_symbol to a dummy function. (obj_mach_o_type_for_symbol): New. (obj_macho_frob_label): New. (obj_macho_frob_symbol): New. * config/obj-macho.h (S_SET_ALIGN): Amend temorary var name. (obj_frob_label, obj_macho_frob_label): Declare. (obj_frob_symbol, obj_macho_frob_symbol): Declare. 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/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.
Diffstat (limited to 'gas/testsuite')
-rw-r--r--gas/testsuite/ChangeLog12
-rw-r--r--gas/testsuite/gas/mach-o/err-syms-1.s12
-rw-r--r--gas/testsuite/gas/mach-o/err-syms-2.s15
-rw-r--r--gas/testsuite/gas/mach-o/err-syms-3.s10
-rw-r--r--gas/testsuite/gas/mach-o/symbols-2.d7
-rw-r--r--gas/testsuite/gas/mach-o/symbols-2.s9
-rw-r--r--gas/testsuite/gas/mach-o/symbols-3.s111
-rw-r--r--gas/testsuite/gas/mach-o/symbols-4.s65
-rw-r--r--gas/testsuite/gas/mach-o/symbols-5.d11
-rw-r--r--gas/testsuite/gas/mach-o/symbols-5.s17
10 files changed, 269 insertions, 0 deletions
diff --git a/gas/testsuite/ChangeLog b/gas/testsuite/ChangeLog
index c638cdc..3176c0c 100644
--- a/gas/testsuite/ChangeLog
+++ b/gas/testsuite/ChangeLog
@@ -1,3 +1,15 @@
+2012-01-09 Iain Sandoe <idsandoe@googlemail.com>
+
+ * 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/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.
+
2012-01-08 Richard Sandiford <rdsandiford@googlemail.com>
* gas/mips/tls-relw.s, gas/mips/tls-relw.d: New test.
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/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