bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/20815] throw errors for invalid load segment


From: ma.jiang at zte dot com.cn
Subject: [Bug ld/20815] throw errors for invalid load segment
Date: Thu, 17 Nov 2016 04:53:02 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=20815

--- Comment #9 from ma.jiang at zte dot com.cn ---
(In reply to Nick Clifton from comment #8)
Hi Nick,
  Thank you for the explanation.It cost you much time I guess :).
  It seems that whether the elf is valid become the most important divergence.
I still insist it's not valid.  
> Now an ELF executable *may* elect to
> make the program header be part of one of these program segments, in which
> case that segment gets the PT_PHDR type and it should be mapped into memory
> when the executable is loaded.  But - the ELF standard does not require that
> the program headers be contained in a program segment. 
  Yes, the elf standard does not require " the program headers be contained in
a program segment". But, now that the generated elf have a PT_PHDR segment, it
must load the program header into memory, as the elf standard said clearly
"Moreover, it may occur *ONLY IF* the program header table is part of the
memory image of the program". The PT_PHDR existed, but the program header table
is not loaded into memory, thus I insist the generated elf is not valid(if
there were no such a PT_PHDR segment, the generated elf is ok).

> Of course I realise that this does not help you with the case you
> encountered - the linker silently producing a non-working binary.  But at
> issue here is that the linker script being used was broken, and if you are
> using linker scripts then you really need to know what you are doing, and to
> expect that you will have to do some deep debugging when things do not work
> out as planned.  I am sorry, but I really think that in this case the linker
> cannot be expected to diagnose the problem for you.
  To tell the truth, it's not hard for me to find what is wrong(LOL). But I'm a
tool-chain maintainer in my company, and there are a lot of normal users who
will get totally confused by such problems. I hope the gnu-ld could give a
warning at least, even if you do think the elf file is valid. Yes, the man who
make mistake should pay the price, but they probably do not know what is
wrong...Men are not saints.Let us make the linker more friendly for such guys.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

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