summaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authoriains <iains>2012-01-03 13:18:46 +0000
committeriains <iains>2012-01-03 13:18:46 +0000
commita4ec1ff0dfe1893f282ee73beea33fe68439774b (patch)
tree8892ffb9e3b90152e8de3df1156c64e088cca29b /gas
parentb329ed8a6a2aef722ed2a017fb99016662177678 (diff)
downloadbinutils-redhat-a4ec1ff0dfe1893f282ee73beea33fe68439774b.tar.gz
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')
-rw-r--r--gas/ChangeLog6
-rw-r--r--gas/config/obj-macho.c42
-rw-r--r--gas/config/obj-macho.h5
3 files changed, 51 insertions, 2 deletions
diff --git a/gas/ChangeLog b/gas/ChangeLog
index 26e4fc5dca..6fecce61dc 100644
--- a/gas/ChangeLog
+++ b/gas/ChangeLog
@@ -1,3 +1,9 @@
+2012-01-03 Iain Sandoe <idsandoe@googlemail.com>
+
+ * config/obj-macho.c (obj_macho_process_stab): New.
+ * config/obj-macho.h (OBJ_PROCESS_STAB): Define.
+ (obj_macho_process_stab): Declare.
+
2011-12-29 Iain Sandoe <idsandoe@googlemail.com>
* as.c (perform_an_assembly_pass): Do not create text, data and bss
diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
index 74fb0c910a..16ceb5eeec 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 d9b0b33026..b2acd17c63 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 */