Bug 6446 - Handling of EF_FRV_PIC
Summary: Handling of EF_FRV_PIC
Status: RESOLVED WONTFIX
Alias: None
Product: binutils
Classification: Unclassified
Component: ld (show other bugs)
Version: 2.19
: P2 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks: 6747
  Show dependency treegraph
 
Reported: 2008-04-22 18:46 UTC by Daniel Jacobowitz
Modified: 2022-08-25 00:32 UTC (History)
2 users (show)

See Also:
Host:
Target: frv-uclinux
Build:
Last reconfirmed:


Attachments
Set EF_FRV_PIC by default (for FDPIC). Clear it if any inter-segment relocations are found (584 bytes, patch)
2008-05-21 10:32 UTC, Nick Clifton
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Jacobowitz 2008-04-22 18:46:56 UTC
Another bug found by inspection.  The ABI says:

The linker should warn and clear EF_FRV_PIC when linking
FDPIC binaries if it finds any inter-segment relocation, and set it
otherwise.

But in fact the linker sets EF_FRV_PIC if it sees any inter-segment relocations.
 There's hardcoded checks for files named "crt0.o" directly above that, too.
Comment 1 Nick Clifton 2008-05-21 10:32:04 UTC
Created attachment 2748 [details]
Set EF_FRV_PIC by default (for FDPIC).  Clear it if any inter-segment relocations are found
Comment 2 Nick Clifton 2008-05-21 10:34:13 UTC
Subject: Re:  New: Handling of EF_FRV_PIC

Hi Guys,

> Another bug found by inspection.  The ABI says:
> 
> The linker should warn and clear EF_FRV_PIC when linking
> FDPIC binaries if it finds any inter-segment relocation, and set it
> otherwise.
> 
> But in fact the linker sets EF_FRV_PIC if it sees any inter-segment relocations.

I have uploaded a patch to this PR which I think might correct the 
linker's behaviour, but I am not familiar with FDPIC on the FRV so I may 
well have made a mistake.  Would you guys care to take a look at it ?

> There's hardcoded checks for files named "crt0.o" directly above that, too.

I am not sure about whether this is important or not, so I have the 
special case code in.

Cheers
   Nick

Comment 3 Daniel Jacobowitz 2008-05-30 16:03:09 UTC
Subject: Re:  Handling of EF_FRV_PIC

On Wed, May 21, 2008 at 10:34:13AM -0000, nickc at redhat dot com wrote:
> I have uploaded a patch to this PR which I think might correct the 
> linker's behaviour, but I am not familiar with FDPIC on the FRV so I may 
> well have made a mistake.  Would you guys care to take a look at it ?

I think it looks right, but I am not familiar with FRV at all; I only
noticed this while working on SH.

Could the flag go in the link info instead of static, on general principles?

Comment 4 Alexandre Oliva 2008-06-03 04:35:38 UTC
The patch does indeed appear to get the code to patch the spec (thanks, Nick!),
but I'm concerned that, at this point, it might be wiser to change the spec to
match the code, for a couple of kernels and libcs might be relying on the
current bug :-(
Comment 5 Nick Clifton 2008-06-04 09:28:47 UTC
Subject: Re:  Handling of EF_FRV_PIC

Hi Alex, Hi Daniel,

> The patch does indeed appear to get the code to patch the spec (thanks, Nick!),
> but I'm concerned that, at this point, it might be wiser to change the spec to
> match the code, for a couple of kernels and libcs might be relying on the
> current bug :-(

Can we do that ?  I would be much happier to leave the code alone and 
change the documentation ... :-)

Cheers
   Nick


Comment 6 H.J. Lu 2008-07-15 18:52:12 UTC
(In reply to comment #1)
> Created an attachment (id=2748)
> Set EF_FRV_PIC by default (for FDPIC).	Clear it if any inter-segment
> relocations are found
> 

This patch caused PR 6747.
Comment 7 Alan Modra 2022-08-25 00:32:14 UTC
Proven to destabilise the linker