aboutsummaryrefslogtreecommitdiff
path: root/gas/config
diff options
context:
space:
mode:
authorIain Sandoe <iain@codesourcery.com>2012-01-03 13:18:48 +0000
committerIain Sandoe <iain@codesourcery.com>2012-01-03 13:18:48 +0000
commit68588f95404f3301816c765ecd617a585ad50bac (patch)
tree0355ffbe588e48dcc701ba4c02613c91a8586546 /gas/config
parentf2b324f1f929d4d72dcb7b390e56ac58d82e3b27 (diff)
downloadgdb-68588f95404f3301816c765ecd617a585ad50bac.zip
gdb-68588f95404f3301816c765ecd617a585ad50bac.tar.gz
gdb-68588f95404f3301816c765ecd617a585ad50bac.tar.bz2
support stabs on mach-o GAS.
bfd: * mach-o.c (bfd_mach_o_mangle_symbols): Put in the section index for stabd symbols. (bfd_mach_o_primary_symbol_sort_key): Adjust for stabs. (bfd_mach_o_cf_symbols): Likewise. gas: * config/obj-macho.c (obj_macho_process_stab): New. * config/obj-macho.h (OBJ_PROCESS_STAB): Define. (obj_macho_process_stab): Declare.
Diffstat (limited to 'gas/config')
-rw-r--r--gas/config/obj-macho.c42
-rw-r--r--gas/config/obj-macho.h5
2 files changed, 45 insertions, 2 deletions
diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
index 74fb0c9..16ceb5e 100644
--- a/gas/config/obj-macho.c
+++ b/gas/config/obj-macho.c
@@ -1,5 +1,5 @@
/* Mach-O object file format
- Copyright 2009, 2011 Free Software Foundation, Inc.
+ Copyright 2009, 2011, 2012 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -850,3 +850,43 @@ const pseudo_typeS mach_o_pseudo_table[] =
{NULL, NULL, 0}
};
+
+/* Support stabs for mach-o. */
+
+void
+obj_mach_o_process_stab (int what, const char *string,
+ int type, int other, int desc)
+{
+ symbolS *symbolP;
+ bfd_mach_o_asymbol *s;
+
+ switch (what)
+ {
+ case 'd':
+ symbolP = symbol_new ("", now_seg, frag_now_fix (), frag_now);
+ /* Special stabd NULL name indicator. */
+ S_SET_NAME (symbolP, NULL);
+ break;
+
+ case 'n':
+ case 's':
+ symbolP = symbol_new (string, undefined_section, (valueT) 0,
+ &zero_address_frag);
+ pseudo_set (symbolP);
+ break;
+
+ default:
+ as_bad(_("unrecognized stab type '%c'"), (char)what);
+ abort ();
+ break;
+ }
+
+ s = (bfd_mach_o_asymbol *) symbol_get_bfdsym (symbolP);
+ s->n_type = type;
+ s->n_desc = desc;
+ /* For stabd, this will eventually get overwritten by the section number. */
+ s->n_sect = other;
+
+ /* It's a debug symbol. */
+ s->symbol.flags |= BSF_DEBUGGING;
+}
diff --git a/gas/config/obj-macho.h b/gas/config/obj-macho.h
index d9b0b33..b2acd17 100644
--- a/gas/config/obj-macho.h
+++ b/gas/config/obj-macho.h
@@ -1,5 +1,5 @@
/* Mach-O object file format for gas, the assembler.
- Copyright 2009, 2011 Free Software Foundation, Inc.
+ Copyright 2009, 2011, 2012 Free Software Foundation, Inc.
This file is part of GAS, the GNU Assembler.
@@ -58,4 +58,7 @@ extern const pseudo_typeS mach_o_pseudo_table[];
#define EMIT_SECTION_SYMBOLS 0
+#define OBJ_PROCESS_STAB(SEG,W,S,T,O,D) obj_mach_o_process_stab(W,S,T,O,D)
+extern void obj_mach_o_process_stab (int, const char *,int, int, int);
+
#endif /* _OBJ_MACH_O_H */