This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


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

Linux Elf question


I realise that this is not precisely the correct forum for this
question, so if anyone can suggest a better one, please let me know.
However, I am hoping someobody at cygnus can help. The question
concerns the requirements placed on an elf file in order for it to be
an executable. My problem is that I need to add a section to an
executable elf file and produce another executable. Whereas my program
would normally read some data from disc, I wish instead to place the
data within the elf file, thus avoiding the need for two separate
files. Under Solaris, using libelf, I can do this simply by copying
all the sections, adding my extra section and adding its name to the
string table. Everything is fine. Under linux, the same procedure
does not work. The file I get goes SEGV (inside XSetFocus in my case).
The problem appears to be the .rodata section (section 11 typically)
which, although it specifies an alignment of 4, appears actually to
require an alignment of 8. Modifying the data buffer size of this
section to round it up to a multiple of 8 before adding it do the elf
output solves the problem. Irix has similar but worse problems. So, my
question to the clever folks at cygnus is:- Why is this extra
alignment required, and how do I find out a specification of what's
really required, over and above what's enforced by libelf? At present,
I typically have to deduce what's going on by making dumps of working
and failed elf files and seeing where the differences are, which isn't
very satisfactory. A specification (probably of what the loader
requires) would be much more helpful. Alternatively, a specification
of what ld thinks is going on would help, since ld obviously gets this
stuff right.
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


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