This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
[Patch, mach-o/gas] correct a case where stub size is not filled in by GAS.
- From: Iain Sandoe <developer at sandoe-acoustics dot co dot uk>
- To: binutils Development <binutils at sourceware dot org>
- Cc: Tristan Gingold <gingold at adacore dot com>
- Date: Thu, 9 Feb 2012 14:28:21 +0000
- Subject: [Patch, mach-o/gas] correct a case where stub size is not filled in by GAS.
the stub size for well-known-stub sections is not filled in from the
BFD section translation table, but the other flags *are* when the
section type is recognized.
This leads to a failure to fill in the stub-size when someone
specifies a well-known stub section by a hand-written section command.
(e.g. darwin.S in libffi).
fixed thus:
gas:
* config/obj-macho.c (obj_mach_o_make_or_get_sect): Always fill in
stub size
when provided. (obj_mach_o_section): Flag that stub-size has been
provided.
diff --git a/gas/config/obj-macho.c b/gas/config/obj-macho.c
index ba09780..17a21e6 100644
--- a/gas/config/obj-macho.c
+++ b/gas/config/obj-macho.c
@@ -168,6 +168,7 @@ obj_mach_o_get_section_names (char *seg, char *sec,
#define SECT_TYPE_SPECIFIED 0x0001
#define SECT_ATTR_SPECIFIED 0x0002
#define SECT_ALGN_SPECIFIED 0x0004
+#define SECT_STUB_SPECIFIED 0x0008
static segT
obj_mach_o_make_or_get_sect (char * segname, char * sectname,
@@ -267,7 +268,6 @@ obj_mach_o_make_or_get_sect (char * segname, char
* sectname,
msect->align = secalign;
msect->flags = sectype | secattr;
- msect->reserved2 = stub_size;
if (sectype == BFD_MACH_O_S_ZEROFILL
|| sectype == BFD_MACH_O_S_GB_ZEROFILL)
@@ -280,6 +280,10 @@ obj_mach_o_make_or_get_sect (char * segname, char
* sectname,
as_warn (_("Ignoring changed section attributes for %s"), name);
}
+ if (specified_mask & SECT_STUB_SPECIFIED)
+ /* At present, the stub size is not supplied from the BFD
tables. */
+ msect->reserved2 = stub_size;
+
return sec;
}
@@ -413,6 +417,7 @@ obj_mach_o_section (int ignore ATTRIBUTE_UNUSED)
input_line_pointer++;
sizeof_stub = get_absolute_expression ();
+ specified_mask |= SECT_STUB_SPECIFIED;
}
else if ((specified_mask & SECT_ATTR_SPECIFIED)
&& sectype == BFD_MACH_O_S_SYMBOL_STUBS)