bug-binutils
[Top][All Lists]
Advanced

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

Re: ld blocking patch


From: Peter S. Mazinger
Subject: Re: ld blocking patch
Date: Fri, 26 Nov 2004 10:20:56 +0100 (CET)

On Sun, 21 Nov 2004, Peter S. Mazinger wrote:

The attached patch is a correction of the earlier sent patch and blocks 
only -shared -static (link_info.shared is also set if link_info.pie is 
used, so no need to block -pie -static, -r -pie and it is not possible to 
block -pie -shared)

The rationals of the patch are (and problems unsolved with it):
someone wants to build everything as ET_DYN/PIE executable on the system 
so he will add LDFLAGS="-pie" to his build environment
This will fail currenty if the Makefile wants to build a static exec, 
because running ld -pie -static will always run the -pie -z combreloc 
internal ld script. This patch will block -shared -static and -pie -static 
combinations.

What is not solved by the patch, would require rewriting the logic in ld:
LDFLAGS+="-pie"

Currently ld -pie sets link_info.pie and link_info.shared, ld -shared sets 
only link_info.shared
I have tried w/ the earlier sent patch to block these, but it catches also 
the case
ld -fpic -pie, or ld -fpie -pie (so ld interprets -fpic|-fpie as -shared)
now running ld -pie -shared pie will always win (running the -pie -z 
combreloc script) and this will for sure kill the shared lib (-shared is 
provided by the Makefile, -pie by user default setting, wishing to have 
PIE execs)

Proper logic for all the above would be:
accept ld -shared first and create a shared lib, ld -static next and 
create a static exec, ld -pie after that building everything else as PIE.

w/ the attached patch we solve all the combinations w/ -static, but does 
not solve -shared -pie (here the logic has to be reverted, creating 
shared lib, not a PIE exec)

Looking at the sources the problem lies in the fact that -pie enables also 
link_info.shared, so a check "if (link_info.shared) && (link_info.pie)" is 
useless.
Is there a possibility to check for the command line itself (not the 
internal flags set)?

Thanks reading so far, Peter

Please CC to me.

> Hello!
> 
> Proposal to block some interfering combinations of ld flags, like -shared 
> w/ -static, -shared w/ -pie, -static w/ -pie
> 
> Currently -r w/ -shared is blocked.
> Would this also apply to -r w/ -pie, or -r w/ -static?
> 
> The attached patch adds -r w/ -pie, remove if faulty.
> 
> Please CC to me, I am not on ml.
> 
> Thanks, Peter
> 
> 

-- 
Peter S. Mazinger <ps dot m at gmx dot net>           ID: 0xA5F059F2
Key fingerprint = 92A4 31E1 56BC 3D5A 2D08  BB6E C389 975E A5F0 59F2

Attachment: binutils-2.15.94.0.1-ld-blocking.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]