relative position of text and data loaded from bFLT executable
(too old to reply)
Max Filippov
2018-11-05 07:47:31 UTC

I was trying to run gcc testsuite for xtensa-uclinux-uclibc target with
bFLT executables and found that C++ exception handling doesn't work.

The FDE structure that associates a range of code addresses with
LSDA structure that describes how C++ exception thrown from that
range should be handled is located in .eh_frame section that ends up
with data in the bFLT image, but it contains an offset of the beginning
of the code range relatively to itself. The issue occurs because the
relative position of text and data loaded from the bFLT image doesn't
match their relative position in the ELF image, which breaks relative
references from data to code.

I looked at the bFLT loader code in the linux kernel and it appears that
this is always the case: the relative position of the text and data is
never preserved by the loader, as it reserves space for data segment
pointers for libraries between them.

I also looked at how relocations are applied and my understanding
is that only absolute address references may be relocated, there's
no way to relocate a field that represents offset from data to code.

Given that I've got a couple of questions:
- the only way that I see to fix that without changing bFLT loader
is to build everything as non-PIC. Is that correct?
- why couldn't relative position of the text and data loaded from bFLT
executable be preserved?

-- Max
uClinux-dev mailing list
This message was resent by uclinux-***@uclinux.org
To unsubscribe see: