This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] ldlang.c: do not warn/error for linker-created empty orphan sections
- From: Rasmus Villemoes <rasmus dot villemoes at prevas dot dk>
- To: Alan Modra <amodra at gmail dot com>
- Cc: "binutils at sourceware dot org" <binutils at sourceware dot org>, Rasmus Villemoes <Rasmus dot Villemoes at prevas dot se>
- Date: Tue, 18 Dec 2018 06:55:43 +0000
- Subject: Re: [PATCH] ldlang.c: do not warn/error for linker-created empty orphan sections
- References: <20181217224157.28003-1-rasmus.villemoes@prevas.dk> <20181218004508.GI30978@bubble.grove.modra.org>
On 18/12/2018 01.45, Alan Modra wrote:
> On Mon, Dec 17, 2018 at 10:42:07PM +0000, Rasmus Villemoes wrote:
>> --- a/ld/ldlang.c
>> +++ b/ld/ldlang.c
>> @@ -6710,7 +6710,8 @@ ldlang_place_orphan (asection *s)
>> const char *name = s->name;
>> int constraint = 0;
>>
>> - if (config.orphan_handling == orphan_handling_error)
>> + if (config.orphan_handling == orphan_handling_error &&
>> + !((s->flags & SEC_LINKER_CREATED) && s->size == 0))
>> einfo (_("%X%P: error: unplaced orphan section `%pA' from `%pB'\n"),
>> s, s->owner);
>>
>
> I agree with your intent here, namely that you do want to continue
> emitting an error/warning for non-zero sized linker created orphans.
> Unfortunately, this patch doesn't do that, because linker created
> sections typically won't be sized until later in the linking process.
Urgh, sorry about that. OK, that makes it somewhat harder to implement
what I want; I suppose the input sections to each output section would
have to be marked as "placed here by the orphan logic", and then the
warning would have to be postponed until the output phase?
Rasmus