Mail Archives: cygwin/1997/07/07/14:42:28
Jon Thackray writes:
>
> I am still having problem using ld to produce working dlls. I have
> converted the .lib files I wish to link against into .a files using
> dlltool (and using nm to create the .def file). However, when I try to
> link to produce another dll, I find the dll I get is missing its
> .rdata, .idata and .reloc sections. It also doesn't seem to work very
> well. I append the linker script and ld command line I used. Here's
> what objdump thinks of the result, which was produced without error by
> ld.
Further to this, I have changed the approach as I suspect I'm not
doing the right thing with the link command. I have removed the -r and
added -dy and -shared. After this, I got a load of undefined symbol
references for the __imp symbols. It appears that dlltool generates
these as ___imp, whereas the compiler generating my object files
generates these as __imp. This all works using link. Is there a
version of dlltool about that doesn't prepend this extra _ (it's being
done because it think that is the right thing to do on a 386,
according to the source of dlltool).
> C:\dyl>objdump --headers threads.dll
>
> threads.dll: file format pei-i386
>
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 00000200 00401000 000000fd 000002b8 2**2
> CONTENTS, ALLOC, LOAD, RELOC, CODE
> 1 .dyvar 00000200 00402000 00000004 000004b8 2**2
> CONTENTS, ALLOC, LOAD, DATA
> 2 .dyfix 00000200 00403000 0000000b 000006b8 2**2
> CONTENTS, ALLOC, LOAD, RELOC, DATA
>
> And here's what I think objdump should have produced, or something
> like it (this was produced by link).
>
> C:\dyl>objdump --headers j:/releases\pentium-kan/install\x86-win32\bin\threads.dll
>
> j:/releases\pentium-kan/install\x86-win32\bin\threads.dll: file format pei-i386
>
> Sections:
> Idx Name Size VMA LMA File off Algn
> 0 .text 00000200 10001000 00000154 00000400 2**2
> CONTENTS, ALLOC, LOAD, CODE
> 1 .rdata 00000200 10002000 00000126 00000600 2**2
> CONTENTS, ALLOC, LOAD, DATA
> 2 .idata 00000400 10003000 000002c8 00000800 2**2
> CONTENTS, ALLOC, LOAD, DATA
> 3 .dyvar 00000200 10004000 00000004 00000c00 2**2
> CONTENTS, ALLOC, LOAD, DATA
> 4 .dyfix 00000200 10005000 0000000b 00000e00 2**2
> CONTENTS, ALLOC, LOAD, DATA
> 5 .reloc 00000200 10006000 00000074 00001000 2**2
> CONTENTS, ALLOC, LOAD, DATA
>
> Finally, here's the link command and script.
>
>
> ld -T i386pe.scr -r -E -e _DylanDllEntry AT 12 -o threads.dll --traditional-format -L. -ldylan j:/releases/pentium-kan/build/x86-win32/threads/_glue.obj j:/releases/pentium-kan/build/x86-win32/threads/threads-library.obj j:/releases/pentium-kan/lib/pentium-run-time/dylan-support.obj
>
> OUTPUT_FORMAT(pei-i386)
> TARGET(pe-i386)
> SECTIONS
> {
> .text __image_base__ + __section_alignment__ :
> {
> *(.init)
> *(.text)
> ___CTOR_LIST__ = .; __CTOR_LIST__ = . ;
> LONG (-1); *(.ctors); *(.ctor); LONG (0);
> ___DTOR_LIST__ = .; __DTOR_LIST__ = . ;
> LONG (-1); *(.dtors); *(.dtor); LONG (0);
> *(.fini)
> /* ??? Why is .gcc_exc here? */
> *(.gcc_exc)
> etext = .;
> /* Grouped section support currently must be explicitly provided for
> in the linker script. */
> *(.text$)
> }
> .bss BLOCK(__section_alignment__) :
> {
> __bss_start__ = . ;
> *(.bss)
> *(COMMON)
> __bss_end__ = . ;
> }
> .data BLOCK(__section_alignment__) :
> {
> __data_start__ = . ;
> *(.data)
> *(.data2)
> __data_end__ = . ;
> /* Grouped section support currently must be explicitly provided for
> in the linker script. */
> *(.data$)
> }
> .rdata BLOCK(__section_alignment__) :
> {
> *(.rdata)
> /* Grouped section support currently must be explicitly provided for
> in the linker script. */
> *(.rdata$)
> }
> .edata BLOCK(__section_alignment__) :
> {
> *(.edata)
> }
> .dydat BLOCK(0x1000) :
> {
> *(.dydat$a)
> *(.dydat$m)
> *(.dydat$z)
> }
> .dyobj BLOCK(0x1000) :
> {
> *(.dyobj$a)
> *(.dyobj$m)
> *(.dyobj$z)
> }
> .dyvar BLOCK(0x1000) :
> {
> *(.dyvar$a)
> *(.dyvar$m)
> *(.dyvar$z)
> }
> .dyfix BLOCK(0x1000) :
> {
> *(.dyfix$a)
> *(.dyfix$m)
> *(.dyfix$z)
> }
> /DISCARD/ :
> {
> *(.debug$S)
> *(.debug$T)
> *(.debug$F)
> *(.drectve)
> }
> .idata BLOCK(__section_alignment__) :
> {
> /* This cannot currently be handled with grouped sections.
> See pe.em:sort_sections. */
> *(.idata$2)
> *(.idata$3)
> *(.idata$4)
> *(.idata$5)
> *(.idata$6)
> *(.idata$7)
> }
> .CRT BLOCK(__section_alignment__) :
> {
> /* Grouped sections are used to handle .CRT$foo. */
> *(.CRT$)
> }
> .tls BLOCK(__section_alignment__) :
> {
> *(.tls$)
> ;
> }
> .rsrc BLOCK(__section_alignment__) :
> {
> /* Grouped sections are used to handle .rsrc$0[12]. */
> *(.rsrc$)
> }
> .endjunk BLOCK(__section_alignment__) :
> {
> /* end is deprecated, don't use it */
> end = .;
> __end__ = .;
> }
> .stab BLOCK(__section_alignment__) (NOLOAD) :
> {
> [ .stab ]
> }
> .stabstr BLOCK(__section_alignment__) (NOLOAD) :
> {
> [ .stabstr ]
> }
> .reloc BLOCK(__section_alignment__) :
> {
> *(.reloc)
> }
> }
> ------- end -------
> -
> For help on using this list (especially unsubscribing), send a message to
> "gnu-win32-request AT cygnus DOT com" with one line of text: "help".
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -