bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/30359] New: Create Resource-Only DLL


From: pali at kernel dot org
Subject: [Bug ld/30359] New: Create Resource-Only DLL
Date: Sat, 15 Apr 2023 23:23:27 +0000

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

            Bug ID: 30359
           Summary: Create Resource-Only DLL
           Product: binutils
           Version: 2.39
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: ld
          Assignee: unassigned at sourceware dot org
          Reporter: pali at kernel dot org
  Target Milestone: ---

Resource-Only DLL is windows PE binary of DLL type which does not contain any
code, just resources in .rsrc section. See MS documentation for more details:
https://learn.microsoft.com/en-us/cpp/build/creating-a-resource-only-dll

To create Resource-Only TEST-RSRC.DLL library from text resource file
TEST-RSRC.RC (compiled to intermediate binary TEST-RSRC.RES) it is possible to
use MS tools (as documented in above link):

  RC.EXE TEST-RSRC.RC
  LINK.EXE /DLL /NOENTRY TEST-RSRC.RES

Entrypoint of such library is set to zero.

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.

Test case:

$ cat test-rsrc.rc
1 VERSIONINFO
BEGIN
END

$ 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


Is there some other flag for LD to achieve generation of resource-only DLL
library? Or how to avoid putting (empty) .text and .idata sections into such
DLL library?

-- 
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]