[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] x86/build32: Discard all orphaned sections



On 12.05.2020 21:11, Andrew Cooper wrote:
> @@ -47,6 +47,14 @@ SECTIONS
>           *
>           * Please check build32.mk for more details.
>           */
> -        /* *(.got.plt) */
> +        *(.got.plt)
> +  }
> +
> +  /DISCARD/ : {
> +        /*
> +         * Discard everything else, to prevent linkers from putting
> +         * orphaned sections ahead of .text, which needs to be first.
> +         */
> +        *(*)
>    }
>  }

To be honest I'm not sure if this isn't going too far. Much
depends on what would happen if a new real section appeared
that needs retaining. Granted the linker may then once again
put it at the beginning of the image, and we'll be screwed
again, just like we'll be screwed if a section gets discarded
by mistake. But it would be really nice if we had a way to
flag the need to play with the linker script. Hence perhaps
on new enough tool chains we indeed may want to make use of
--orphan-handling= ? And then discard just .note and .note.*
here?

Jan



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.