bug-binutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug ld/30359] Create Resource-Only DLL


From: nickc at redhat dot com
Subject: [Bug ld/30359] Create Resource-Only DLL
Date: Tue, 18 Apr 2023 10:31:08 +0000

https://sourceware.org/bugzilla/show_bug.cgi?id=30359

Nick Clifton <nickc at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |nickc at redhat dot com

--- Comment #1 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Pali Rohár from comment #0)
Hi Pali,

> I'm trying to achieve same thing via binutils, but even with stripped debug
> symbols and zero entry point, LD somehow always puts .idata and .text
> sections with empty import table and something in code .text sections.

*sigh* Yes this is a "feature" of the linker.  It might be possible to hack
the linker to change the behaviour, but I think that there is a simpler 
solution:

> $ i686-w64-mingw32-windres --input-format=rc --output-format=coff
> --input=test-rsrc.rc --output=test-rsrc.o
> 
> $ i686-w64-mingw32-ld -dll --subsystem windows -e 0 -s test-rsrc.o -o
> test-rsrc.dll
> 
> $ i686-w64-mingw32-objdump -h test-rsrc.dll
> 
> test-rsrc.dll:     file format pei-i386
> 
> Sections:
> Idx Name          Size      VMA       LMA       File off  Algn
>   0 .text         00000010  10001000  10001000  00000400  2**2
>                   CONTENTS, ALLOC, LOAD, READONLY, CODE
>   1 .idata        00000014  10002000  10002000  00000600  2**2
>                   CONTENTS, ALLOC, LOAD, DATA
>   2 .rsrc         000000b8  10003000  10003000  00000800  2**2
>                   CONTENTS, ALLOC, LOAD, DATA

But if you add....

  $ i686-w64-mingw32-objcopy --remove-section .text --remove-section .idata
test-rsrc.dll test-rsrc-2.dll

then...

  $ i686-w64-mingw32-objdump -h test-rsrc-2.dll

test-rsrc-2.dll:     file format pei-i386

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .rsrc         000000b8  10003000  10003000  00000200  2**2
                  CONTENTS, ALLOC, LOAD, DATA

I realise that this means adding another step to the process, but it also
means that the workaround will work with the current tools, no need for any
updates.

-- 
You are receiving this mail because:
You are on the CC list for the bug.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]