Hi Serge,
Thanks for all your help - I will follow you instructions and try to
determine the problem.
How did you get so deeply into shared libraries?
Thanks
Jens
“Serge Yuschenko” <> serge.yuschenko@rogers.com> > wrote in message
news:atoosr$3b8$> 1@inn.qnx.com> …
Hi Jens,
Now you need to get rid of those sections. Unfortunately I don’t know
easy
way to find out what caused their appearance. What I can offer you is
kind
a
roundabout way, but if you desperate you can try it. I think, before
starting doing this it would be helpful to take a look at the ELF
specification:
http://x86.ddj.com/ftp/manuals/tools/elf.pdf
Here is the step by step instruction how to figure out what causes
.rel.rodata section appearance.
-
You already have found the section offset in your dll. According the
listing you’ve got, it is 00003afa0. The same information you can get
from
map file.
-
Now you need to take a look at content of this section. You can do it
with objdump -s command. According to your listing it
contains
250 entries
(section size: 7D0 / sizeof(Elf32_Rel)) representing Elf32_Rel
structures.
First 4 bytes of the structure is offset of the object inside your dll
to
be
relocated. Let’s say you found that first 4 bytes of the section are 20
BC
07 00.
-
Now you need to find out what symbol inside the dll this address
belongs
to. You can get a good map of the dll with the objdump -DS . You
don’t
actually
need all that disassembled stuff. What you really need is a symbol name
corresponding to 0007BC20 address or “covering” this address.
-
Let’s imagine, again, you found the address we’re looking for inside
of
abc.25> data structure, located at 0007BC0A. You can see that the
problem
with
the relocation was caused by some field inside of the abc structure at
0xA
offset (0007BC20 - 0007BC0A).
It is up to you how to fix it. Most likely the place we localized is a
pointer to a function or static data structure. As I said before this
sort
of problem
can happen if your abc structure is declared as const, and, I believe
this
is not only reason.
If you found out that this address doesn’t belong to any of your data,
but
some other library, most likely this library shouldn’t be linked with a
dll.
To figure out where did the .rel.text come from take a look at the LOAD
lines in the map file. I believe those lines shouldn’t contain any
static
libraries
except libgcc.a and libcS.a. Put also -v in the cc command line to make
sure
that everything is compiled with the -fPIC option.
Phew…
I think it is enough for a start > > .
Good luck,
Serge
P.S. I don’t challenge a first place in the dll troubleshooting. It
would
be
really interesting to see other approaches.
“Jens H Jorgensen” <> jhj@remove-nospam-videk.com> > wrote in message
news:atkt49$i6k$> 1@inn.qnx.com> …
This is the output from objdump -h dll-file - for one of the .so which
cause
a segv when being dlopen()'ed.
libcppeditor.so: file format elf32-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 .hash 000041f4 000000b4 000000b4 000000b4 22
CONTENTS, ALLOC, LOAD, READONLY, DATA
1 .dynsym 00008760 000042a8 000042a8 000042a8 22
CONTENTS, ALLOC, LOAD, READONLY, DATA
2 .dynstr 00011d46 0000ca08 0000ca08 0000ca08 20
CONTENTS, ALLOC, LOAD, READONLY, DATA
3 .rel.text 0000a5e0 0001e750 0001e750 0001e750 22
CONTENTS, ALLOC, LOAD, READONLY, DATA
4 .rel.gcc_except_table 0000bcd0 00028d30 00028d30 00028d30 22
CONTENTS, ALLOC, LOAD, READONLY, DATA
5 .rel.eh_frame 000065a0 00034a00 00034a00 00034a00 22
CONTENTS, ALLOC, LOAD, READONLY, DATA
6 .rel.rodata 000007d0 0003afa0 0003afa0 0003afa0 22
CONTENTS, ALLOC, LOAD, READONLY, DATA
7 .rel.data 000047c8 0003b770 0003b770 0003b770 22
CONTENTS, ALLOC, LOAD, READONLY, DATA
8 .rel.ctors 00000070 0003ff38 0003ff38 0003ff38 22
CONTENTS, ALLOC, LOAD, READONLY, DATA
9 .rel.dtors 00000070 0003ffa8 0003ffa8 0003ffa8 22
CONTENTS, ALLOC, LOAD, READONLY, DATA
10 .rel.got 00000300 00040018 00040018 00040018 22
CONTENTS, ALLOC, LOAD, READONLY, DATA
11 .rel.plt 00002928 00040318 00040318 00040318 22
CONTENTS, ALLOC, LOAD, READONLY, DATA
12 .init 00000008 00042c40 00042c40 00042c40 20
CONTENTS, ALLOC, LOAD, READONLY, CODE
13 .plt 00005260 00042c48 00042c48 00042c48 22
CONTENTS, ALLOC, LOAD, READONLY, CODE
14 .text 00033b7c 00047ea8 00047ea8 00047ea8 22
CONTENTS, ALLOC, LOAD, READONLY, CODE
15 .fini 00000008 0007ba24 0007ba24 0007ba24 20
CONTENTS, ALLOC, LOAD, READONLY, CODE
16 .rodata 000043ca 0007ba40 0007ba40 0007ba40 25
CONTENTS, ALLOC, LOAD, READONLY, DATA
17 .note0 00000000 0007fe0a 0007fe0a 0007fe0a 20
CONTENTS, ALLOC, LOAD, READONLY, DATA
18 .data 00004708 00080e20 00080e20 0007fe20 25
CONTENTS, ALLOC, LOAD, DATA
19 .eh_frame 0001c1bc 00085528 00085528 00084528 22
CONTENTS, ALLOC, LOAD, DATA
20 .gcc_except_table 00005f90 000a16e4 000a16e4 000a06e4 22
CONTENTS, ALLOC, LOAD, DATA
21 .ctors 00000040 000a7674 000a7674 000a6674 22
CONTENTS, ALLOC, LOAD, DATA
22 .dtors 00000040 000a76b4 000a76b4 000a66b4 22
CONTENTS, ALLOC, LOAD, DATA
23 .got 00001620 000a76f4 000a76f4 000a66f4 22
CONTENTS, ALLOC, LOAD, DATA
24 .dynamic 000000c8 000a8d14 000a8d14 000a7d14 22
CONTENTS, ALLOC, LOAD, DATA
25 .bss 0000023c 000a8ddc 000a8ddc 000a7ddc 22
ALLOC
26 .comment 000005ca 00000000 00000000 000a7ddc 20
CONTENTS, READONLY
27 .note 0000030c 00000000 00000000 000a83a6 20
CONTENTS, READONLY
I see .rel.rodata and .rel.text - what does that mean?
Thanks
Jens
\