This is the mail archive of the cygwin 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] |
| Other format: | [Raw text] | |
Hello,
I found this one while playing with Cygwin's code which takes care of
seamless loading of dll functions (autoload.cc). It seems that when a
symbol in a section marked .linkonce is referenced, wrong relocation info
is generated for that symbol.
For example if you have several symbols - symbol1, symbol2 and symbol3,
- which are placed like this:
offset name
0 symbol1
3 symbol2
15 symbol3
References to this symbols will be generated like this:
symbol1 -> 0
symbol2 -> 6
symbol3 -> 30
I am attaching a testcase. linkonce.cc is the code which demonstrates the
problem. linkonce1.cc is the same code but with .linkonce directives
removed and doesn't suffer from the problem. Here is also the output of
`objdump -r' on both object files.
$ g++ -o linkonce.o -c linkonce.cc
$ objdump -r linkonce.o
linkonce.o: file format pe-i386
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
00000015 DISP32 __alloca
0000001a DISP32 ___main
RELOCATION RECORDS FOR [.some_section1_text]:
OFFSET TYPE VALUE
00000001 dir32 .some_section1_text
00000007 dir32 _label_1
RELOCATION RECORDS FOR [.some_section2_text]:
OFFSET TYPE VALUE
00000001 dir32 .some_section2_text
00000007 dir32 _label_2+0xffffffee
RELOCATION RECORDS FOR [.some_section3_text]:
OFFSET TYPE VALUE
00000001 dir32 .some_section3_text
00000007 dir32 _label_3+0xffffffe3
$ g++ -o linkonce1.o -c linkonce1.cc
$ objdump -r linkonce1.o
linkonce1.o: file format pe-i386
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
00000015 DISP32 __alloca
0000001a DISP32 ___main
RELOCATION RECORDS FOR [.some_section1_text]:
OFFSET TYPE VALUE
00000001 dir32 .some_section1_text
00000007 dir32 .some_section
RELOCATION RECORDS FOR [.some_section2_text]:
OFFSET TYPE VALUE
00000001 dir32 .some_section2_text
00000007 dir32 .some_section
RELOCATION RECORDS FOR [.some_section3_text]:
OFFSET TYPE VALUE
00000001 dir32 .some_section3_text
00000007 dir32 .some_sectionAttachment:
linkonce1.cc
Description: Text document
Attachment:
linkonce.cc
Description: Text document
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |