This is the mail archive of the binutils@sourceware.org mailing list for the binutils 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] |
On Thu, 2009-07-30 at 20:56 +0100, Dave Korn wrote: > Danny Backx wrote: > > > The Import Tables (interpreted .idata section contents) > > vma: Hint Time Forward DLL First > > Table Stamp Chain Name Thunk > > > 00004014 000040c4 00000000 00000000 000042b0 00004130 > > > > DLL Name: libstdc++-6.dll > > vma: Hint/Ord Member-Name Bound-To > > 41e4 2744 _ZNSt8ios_base4InitC1Ev > > 4200 2746 _ZNSt8ios_base4InitD1Ev > > 421c 2984 _ZSt4cout > > 4228 3060 > > _ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc > > > 00004050 000040e8 00000000 00000000 000042b0 0000109a > > > > DLL Name: libstdc++-6.dll > > vma: Hint/Ord Member-Name Bound-To > > 41e4 2744 _ZNSt8ios_base4InitC1Ev > > That confirms my theory. The call at 0x00401099 should go to > _imp___ZNSt8ios_base4InitC1Ev at 0x404130, but then the auto-import fixup > relocation goes and gets applied to it. The resulting address should be the sum > of the real address and the import stub address, so > > 0x423517be = _ZNSt8ios_base4InitC1Ev + 0x404130 > > or in other words, _ZNSt8ios_base4InitC1Ev = 0x41F4D68E, which is inside the > DLL's address range as it should be. > > Your mission then is to figure out why LD is generating an auto-import fixup > entry, when this is not a data reference. Take a look at pe_find_data_imports() > in ld/emultempl/pe.em, that's where they all get generated. Maybe you can help me understand what's going on, I lack knowledge. I am including three pieces of information : 1. diffs I applied to emultempl/pe.em to be more verbose 2. output of that from the ill-behaving i386-mingw32ce-ld 3. output of that from arm-mingw32ce-ld which does work Commands used : arm-mingw32ce-g++ -c -o hello2arm.o hello.C i386-mingw32ce-g++ -c -o hello2.o hello.C /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/build-x86-mingw32ce/binutils/ld/ld-new \ --enable-extra-pe-debug \ -Bdynamic -o hello2.exe \ /opt/x86mingw32ce/i386-mingw32ce/lib/crt3.o \ -L/opt/x86mingw32ce/lib/gcc/i386-mingw32ce/4.4.0 \ -L/opt/x86mingw32ce/i386-mingw32ce/lib --enable-auto-import hello2.o \ -lstdc++ -lmingw32 -lgcc_s -lgcc -lceoldname -lmingwex -lcoredll \ -lmingw32 -lgcc_s -lgcc -lceoldname -lmingwex \ /opt/x86mingw32ce/lib/gcc/i386-mingw32ce/4.4.0/crtend.o \ >&ld.out.i386 /home/danny/src/cegcc/svn.sf.net/cegcc/trunk/cegcc/src/build-mingw32ce/binutils/ld/ld-new \ --enable-extra-pe-debug \ -Bdynamic -o hello2arm.exe \ /opt/mingw32ce/arm-mingw32ce/lib/crt3.o \ -L/opt/mingw32ce/lib/gcc/arm-mingw32ce/4.4.0 \ -L/opt/mingw32ce/arm-mingw32ce/lib --enable-auto-import hello2arm.o \ -lstdc++ -lmingw32 -lgcc_s -lgcc -lceoldname -lmingwex -lcoredll \ -lmingw32 -lgcc_s -lgcc -lceoldname -lmingwex \ /opt/mingw32ce/lib/gcc/arm-mingw32ce/4.4.0/crtend.o \ >&ld.out.arm What confuses me is that the ld output files appear to indicate different input, see the first couple of lines in the output (before gld_arm_wince_pe_after_open and gld_i386pe_after_open). This appears to indicate different input symbol lists. The difference contains one of the symbols we're chasing : __ZNSt8ios_base4InitC1Ev . Is this meaningful, or is another part of the output key to the answer ? Danny -- Danny Backx ; danny.backx - at - scarlet.be ; http://danny.backx.info
Attachment:
ld.out.arm
Description: Text document
Attachment:
ld.out.i386
Description: Text document
Index: emultempl/pe.em =================================================================== --- emultempl/pe.em (revision 1225) +++ emultempl/pe.em (working copy) @@ -931,16 +931,28 @@ return 1; } +#define BFD_TP(x) \ + (x == bfd_link_hash_new) ? "new" : \ + (x == bfd_link_hash_undefined) ? "undefined" : \ + (x == bfd_link_hash_undefweak) ? "undefweak" : \ + (x == bfd_link_hash_defined) ? "defined" : \ + (x == bfd_link_hash_defweak) ? "defweak" : \ + (x == bfd_link_hash_common) ? "common" : \ + (x == bfd_link_hash_indirect) ? "indirect" : \ + (x == bfd_link_hash_warning) ? "warning" : "??" + static void pe_find_data_imports (void) { struct bfd_link_hash_entry *undef, *sym; + fprintf(stderr, "Yow (pe_find_data_imports) link_info.pei386_auto_import %d\n", link_info.pei386_auto_import); if (link_info.pei386_auto_import == 0) return; for (undef = link_info.hash->undefs; undef; undef=undef->u.undef.next) { + fprintf(stderr, "Yow sym {%s} undef->type %d (%s)\n", undef->root.string, undef->type, BFD_TP(undef->type)); if (undef->type == bfd_link_hash_undefined) { /* C++ symbols are *long*. */ @@ -959,6 +971,7 @@ asymbol **symbols; int nsyms, i; + fprintf(stderr, "Yow sym {%s} link_info.pei386_auto_import %d\n", undef->root.string, link_info.pei386_auto_import); if (link_info.pei386_auto_import == -1) { static bfd_boolean warned = FALSE;
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |