aboutsummaryrefslogtreecommitdiff
path: root/gas/config/obj-macho.c
diff options
context:
space:
mode:
authorTristan Gingold <gingold@adacore.com>2011-12-15 10:56:48 +0000
committerTristan Gingold <gingold@adacore.com>2011-12-15 10:56:48 +0000
commit0c9ef0f001e727226aae6a0dd3963dd81998e2e8 (patch)
tree4a4b58070fbe66330f9a0aeecab7c1d9a5c6fda1 /gas/config/obj-macho.c
parent5011093dd0015bc0eaff522b4e0a18250725d4b4 (diff)
downloadgdb-0c9ef0f001e727226aae6a0dd3963dd81998e2e8.zip
gdb-0c9ef0f001e727226aae6a0dd3963dd81998e2e8.tar.gz
gdb-0c9ef0f001e727226aae6a0dd3963dd81998e2e8.tar.bz2
bfd/
2011-12-15 Iain Sandoe <iains@gcc.gnu.org> * mach-o-target.c (bfd_mach_o_bfd_set_private_flags): Use bfd_mach_o_bfd_set_private_flags. * mach-o.c (bfd_mach_o_bfd_set_private_flags): New. * mach-o.h (bfd_mach_o_bfd_set_private_flags): Declare. gas/ 2011-12-15 Iain Sandoe <iains@gcc.gnu.org> * config/obj-macho.c (obj_mach_o_subsections_by_symbols): New global. (obj_mach_o_file_properties): New enum. (obj_mach_o_subsections_via_symbols): Generalize name to... ... (obj_mach_o_fileprop) and use to set subsections_via_symbols. gas/testsuite/ 2011-12-15 Iain Sandoe <iains@gcc.gnu.org> * gas/mach-o/subsect-via-symbols-0.d: New. * gas/mach-o/subsect-via-symbols-1.d: New. * gas/mach-o/subsect-via-symbols.s: New.
Diffstat (limited to 'gas/config/obj-macho.c')
-rw-r--r--gas/config/obj-macho.c37
1 files changed, 32 insertions, 5 deletions
diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
index 018f653..7f147e3 100644
--- a/gas/config/obj-macho.c
+++ b/gas/config/obj-macho.c
@@ -53,6 +53,10 @@ static int obj_mach_o_is_static;
static int seen_objc_section;
+/* Remember the subsections_by_symbols state in case we need to reset
+ the file flags. */
+static int obj_mach_o_subsections_by_symbols;
+
static void
obj_mach_o_weak (int ignore ATTRIBUTE_UNUSED)
{
@@ -674,11 +678,33 @@ obj_mach_o_comm (int is_local)
s_comm_internal (is_local, obj_mach_o_common_parse);
}
-static void
-obj_mach_o_subsections_via_symbols (int arg ATTRIBUTE_UNUSED)
+/* Set properties that apply to the whole file. At present, the only
+ one defined, is subsections_via_symbols. */
+
+typedef enum obj_mach_o_file_properties {
+ OBJ_MACH_O_FILE_PROP_NONE = 0,
+ OBJ_MACH_O_FILE_PROP_SUBSECTS_VIA_SYMS,
+ OBJ_MACH_O_FILE_PROP_MAX
+} obj_mach_o_file_properties;
+
+static void
+obj_mach_o_fileprop (int prop)
{
- /* Currently ignore it. */
- demand_empty_rest_of_line ();
+ if (prop < 0 || prop >= OBJ_MACH_O_FILE_PROP_MAX)
+ as_fatal (_("internal error: bad file property ID %d"), prop);
+
+ switch ((obj_mach_o_file_properties) prop)
+ {
+ case OBJ_MACH_O_FILE_PROP_SUBSECTS_VIA_SYMS:
+ subsections_by_symbols = 1;
+ if (!bfd_set_private_flags (stdoutput,
+ BFD_MACH_O_MH_SUBSECTIONS_VIA_SYMBOLS))
+ as_bad (_("failed to set subsections by symbols"));
+ demand_empty_rest_of_line ();
+ break;
+ default:
+ break;
+ }
}
/* Dummy function to allow test-code to work while we are working
@@ -776,7 +802,8 @@ const pseudo_typeS mach_o_pseudo_table[] =
{ "weak", obj_mach_o_weak, 0}, /* extension */
/* File flags. */
- { "subsections_via_symbols", obj_mach_o_subsections_via_symbols, 0 },
+ { "subsections_via_symbols", obj_mach_o_fileprop,
+ OBJ_MACH_O_FILE_PROP_SUBSECTS_VIA_SYMS},
{NULL, NULL, 0}
};