[PATCH] ldlang.c: do not warn/error for linker-created empty orphan sections

Alan Modra amodra@gmail.com
Tue Dec 18 00:45:00 GMT 2018


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.

-- 
Alan Modra
Australia Development Lab, IBM



More information about the Binutils mailing list