On 10.06.2025 23:36, Sertonix wrote:
On Tue Jun 10, 2025 at 10:32 PM CEST, Michael Tokarev wrote:
On 10.06.2025 20:58, Sertonix wrote:

Adding -pie to LDFLAGS caused s390-ccw.img to become dynamically linked.

Why do you think -pie causes it to become dynamically linked?

/mjt

The documentation (at least for gcc) states that the -pie option produces
a *dynamically* linked position independent executable. (And I verified
that the patch changes the resulting binary from dynamically linked to
statically linked).

Ok.

Why I asked is because -pie by its own does not change "dynaminess" of
an executable.

-pie has been introduced for s390-ccw in commit d884c86dcd "s390/bios:
Make the s390-ccw.img relocatable" (9 Mar 2015).  Before this commit,
s390x-ccw.img has been dynamically linked too.  Now with current
master (commit bc98ffdc75), removing -Wl,-fpie from LDFLAGS does not
change the fact that the image is linked dynamically.

I don't know when s390-ccw.img has become a dynamic executable, maybe
it always has been - I haven't looked at earlier commits.  With this,
I've no idea how it works either, as a dynamic executable with an
interpreter etc.  But it's definitely not -pie added to LDFLAGS which
made it dynamically linked.

On the other hand, people sometimes confuse the result of -static-pie
as a dynamic executable, especially with older file(1) utility which
reported it as dynamically linked.

So my question was badly worded: what I wanted to ask is what makes
you think that adding -pie to the link line makes the resulting
executable to be linked dynamically.

With all the above in mind, I think the commit message is misleading
a bit.  But it'd be interesting to clarify how this image, being
a dynamic executable, worked all these years, and why it has to be
changed now.  I'm definitely not opposing to the change, I just am
curious about this aspect and want a correct commit message.

Thanks,

/mjt

Reply via email to