From: Casper H. <ch...@cs...> - 2005-05-05 19:57:21
|
Hi. I have a problem with creating a DLL with GCC. Using -mdll: gcc -c cdrom.c -o cdrom.o gcc -mdll -o cdrom.sys cdrom.o Objdump reports that relocations are stripped from the image. Using -shared: gcc -c cdrom.c -o cdrom.o gcc -shared -o cdrom.sys cdrom.o Relocations are not stripped which is how it should be. Using -shared, however, I need to specify exports in a .def file in order to avoid exporting every symbol. Is there a way to avoid that? A switch that will turn off the "automatic" exports perhaps? Casper |
From: Danny S. <dan...@cl...> - 2005-05-06 05:34:32
|
Casper Hornstrup wrote: > Hi. > > I have a problem with creating a DLL with GCC. Using -mdll: > gcc -c cdrom.c -o cdrom.o > gcc -mdll -o cdrom.sys cdrom.o > > Objdump reports that relocations are stripped from the image. > Historically, -mdll didn't create a reloc section in the first place. All it did was send -dll swith to the linker and tell it to use the dllcrt startup object. And all -dll did was set the preferred base address to that of a dll From ld --help: --dll Set image base to the default for DLLs So you got a non-relocatable dll. IIRC, the behaviour of pe-dll,c changed a few years ago so that -dll acted liked -shared for awhile , but I may be thinking of something else.. That change, if it did occur, was accidental and is not documented. Perhaps the old behaviour has since been accidentally restored. > Using -shared: > gcc -c cdrom.c -o cdrom.o > gcc -shared -o cdrom.sys cdrom.o > > Relocations are not stripped which is how it should be. > > Using -shared, however, I need to specify exports in a .def > file in order to avoid exporting every symbol. Is there a > way to avoid that? A switch that will turn off the "automatic" > exports perhaps? A switch would be nice. > > Casper > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. > Get your fingers limbered up and give it your best shot. 4 great events, 4 > opportunities to win big! Highest score wins.NEC IT Guy Games. Play to > win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 > _______________________________________________ > MinGW-dvlpr mailing list > Min...@li... > https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr |
From: Earnie B. <ea...@us...> - 2005-05-06 10:33:34
|
On 5:31:48 am 2005-05-06 Danny Smith <dan...@cl...> wrote: > Casper Hornstrup wrote: > > > Using -shared: > > gcc -c cdrom.c -o cdrom.o > > gcc -shared -o cdrom.sys cdrom.o > > > > Relocations are not stripped which is how it should be. > > > > Using -shared, however, I need to specify exports in a .def > > file in order to avoid exporting every symbol. Is there a > > way to avoid that? A switch that will turn off the "automatic" > > exports perhaps? > > A switch would be nice. > We have --export-all-symbols which is on by default if used through gcc. If --export-all-symbols isn't added to the ld command should that help? Earnie |
From: Danny S. <dan...@cl...> - 2005-05-06 06:51:38
|
Danny Smith wrote: > Casper Hornstrup wrote: >> Hi. >> >> I have a problem with creating a DLL with GCC. Using -mdll: >> gcc -c cdrom.c -o cdrom.o >> gcc -mdll -o cdrom.sys cdrom.o >> >> Objdump reports that relocations are stripped from the image. >> > > Historically, -mdll didn't create a reloc section in the first place. All it > did was send -dll swith to the linker and tell it to use the dllcrt startup > object. And all -dll did was set the preferred base address to that of a dll > From ld --help: > > --dll Set image base to the default for DLLs > > So you got a non-relocatable dll. > > IIRC, the behaviour of pe-dll,c changed a few years ago so that -dll acted > liked -shared for awhile , but I may be thinking of something else.. That > change, if it did occur, was accidental and is not documented. Perhaps the > old behaviour has since been accidentally restored. > >> Using -shared: >> gcc -c cdrom.c -o cdrom.o >> gcc -shared -o cdrom.sys cdrom.o >> >> Relocations are not stripped which is how it should be. >> >> Using -shared, however, I need to specify exports in a .def >> file in order to avoid exporting every symbol. Is there a >> way to avoid that? A switch that will turn off the "automatic" >> exports perhaps? > > A switch would be nice. It sonds like you want a dll that doesn't export anything, but could do all its work in DllMain on call to LoadLibrary In other words, a position-independent executable Try this; gcc -mdll -Wl,--pie -ofoo.dll foo.c Danny > >> >> Casper >> >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by: NEC IT Guy Games. >> Get your fingers limbered up and give it your best shot. 4 great events, 4 >> opportunities to win big! Highest score wins.NEC IT Guy Games. Play to >> win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 >> _______________________________________________ >> MinGW-dvlpr mailing list >> Min...@li... >> https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: NEC IT Guy Games. > Get your fingers limbered up and give it your best shot. 4 great events, 4 > opportunities to win big! Highest score wins.NEC IT Guy Games. Play to > win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 > _______________________________________________ > MinGW-dvlpr mailing list > Min...@li... > https://lists.sourceforge.net/lists/listinfo/mingw-dvlpr |
From: Casper H. <ch...@cs...> - 2005-05-06 07:06:11
|
> -----Original Message----- > From: min...@li... [mailto:min...@li...] On > Behalf Of Danny Smith > Sent: 6. maj 2005 08:49 > To: min...@li... > Subject: Re[2]: [MinGW-dvlpr] Relocations stripped > > Danny Smith wrote: > > Casper Hornstrup wrote: > >> Hi. > >> > >> I have a problem with creating a DLL with GCC. Using -mdll: > >> gcc -c cdrom.c -o cdrom.o > >> gcc -mdll -o cdrom.sys cdrom.o > >> > >> Objdump reports that relocations are stripped from the image. > >> > > > > Historically, -mdll didn't create a reloc section in the first place. All it > > did was send -dll swith to the linker and tell it to use the dllcrt startup > > object. And all -dll did was set the preferred base address to that of a dll > > From ld --help: > > > > --dll Set image base to the default for DLLs > > > > So you got a non-relocatable dll. Hi Danny. It seems all I forgot was to use gcc -mdll --dll. Thanks for your help. Casper |