This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [Patch, mach-o/gas] correct a case where stub size is not filled in by GAS.
- From: Tristan Gingold <gingold at adacore dot com>
- To: Iain Sandoe <developer at sandoe-acoustics dot co dot uk>
- Cc: binutils Development <binutils at sourceware dot org>
- Date: Thu, 9 Feb 2012 16:17:42 +0100
- Subject: Re: [Patch, mach-o/gas] correct a case where stub size is not filled in by GAS.
- References: <ABECA02F-8AC5-430C-80FA-D0FD08F75C19@sandoe-acoustics.co.uk>
On Feb 9, 2012, at 3:28 PM, Iain Sandoe wrote:
> 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).
Sorry, but I still do not understand the patch. Maybe you should quote the line in darwin.S if this is not this one:
.section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5
Currently, stub_size is always extracted from the .section (but default to 0). So currently it was set to 5. What your patch changes on darwin.S ?
Also, I don't understand why stub_size is handled differently from alignment.
(Maybe I am too slow today)
Tristan.
>
> 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)
>