Support PIE on Solaris 12

Rainer Orth ro@CeBiTec.Uni-Bielefeld.DE
Thu Sep 3 08:58:00 GMT 2015


"H.J. Lu" <hjl.tools@gmail.com> writes:

> On Wed, Sep 2, 2015 at 4:38 AM, Rainer Orth <ro@cebitec.uni-bielefeld.de> wrote:
>> "H.J. Lu" <hjl.tools@gmail.com> writes:
>>
>>>> 2015-08-25  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
>>>>
>>>>         ld:
>>>>         * emulparams/solaris2.sh (GENERATE_PIE_SCRIPT): Set to yes.
>>>>
>>>>         * emultempl/elf32.em (ld_${EMULATION_NAME}_emulation): Allow
>>>>         overriding gld${EMULATION_NAME}_handle_option.
>>>>         * emultempl/solaris2.em: Include ldlex.h.
>>>>         (gld${EMULATION_NAME}_handle_option): Declare.
>>>>         (elf_solaris2_handle_option): New function.
>>>>         (LDEMUL_HANDLE_OPTION): Uset it.
>>>>
>>>>         include/elf:
>>>>         * common.h (DF_1_STUB, DF_1_PIE): Define.
>>>>
>>>>         binutils:
>>>>         * readelf.c (process_dynamic_section): Handle DF_1_STUB, DF_1_PIE.
>>>
>>> Should we set DF_1_PIE for Linux?
>>
>> That's nothing I can decide ;-)  It's mostly informational on Solaris,
>> so I guess there's no harm doing it on Linux, too.
>>
>>         Rainer
>
> We should.

That certainly massively simplifies that patch ;-)  The following
(resending only the ld part for now) has been very lightly tested by
checking that DF_1_PIE is set in a Solaris 12 gcc build with gas/gld
configured with --enable-default-pie.

	Rainer


2015-09-03  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>

	ld:
	* emulparams/solaris2.sh (GENERATE_PIE_SCRIPT): Set to yes.

	* emultempl/elf32.em: Include ldlex.h.
	(gld${EMULATION_NAME}_handle_option) [GENERATE_PIE_SCRIPT]
	<OPTION_PIE>: Set DF_1_PIE.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: sol12-pie-ld.patch
Type: text/x-patch
Size: 874 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20150903/867dc0ee/attachment.bin>
-------------- next part --------------

-- 
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University


More information about the Binutils mailing list