This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ELF phdrs in .debug files


Hi Roland,

Roland McGrath wrote:
I think that's a sign of a fundamentally flawed implementation

> Alan Modra wrote:
Well, that's what we do. We take the old program headers, calculate a
segment map from that, then build a new set of program headers. Yes,
that's broken if your criterion is that objcopy not change program
headers, but I'm not convinced that keeping the program headers
unchanged is generally a good idea. Recalculating the program header
is very nice if you can cure a bad program header simply by passing a
file through objcopy. ("Bad" can be lots of things. eg. PR3535 where
apparently the Solaris linker doesn't set p_memsz of some headers.)

I agree with Alan here. I think that recomputing the program headers is a good feature, and a necessary one in situations where the output file is significantly different from the input one.


What we appear to have with --only-keep-debug is a special case where we want to preserve the program headers of the input file, even though strictly speaking they no longer apply to the output file. So it sounds like we need to add code to the BFD library to preserve (as best we can) the program headers in this particular circumstance. Do you agree ?

Cheers
  Nick


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]