[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, 25 Apr 2023 13:58:50 +0000 |
https://sourceware.org/bugzilla/show_bug.cgi?id=30359
--- Comment #5 from Nick Clifton <nickc at redhat dot com> ---
(In reply to Pali Rohár from comment #4)
> > These markers are used by the execution startup code to help find the two
> > tables.
>
> I see... But in this case there is nothing in .text section, just those
> markers. Does not linker script language support conditions to put markers
> only when at least one of those input sections is non-empty?
Sadly, no.
But of course it is possible to create a copy of the linker script that does
not contain these directives and then use that when creating the dll. I think
that this could also solve the other problem...
> But still this --only-section does not remove .idata completelly. There is
> still reference to (now removed) import table and objdump prints warning
> about it. Visible also in readpe.
Except - when I tried to create a simple test to verify this I ran into a
problem. The dll linked OK with my test linker script:
$ i686-w64-mingw32-ld -dll --subsystem windows -e 0 -s test-rsrc.o -o
test-rsrc.dll -T test-rsrc.ld
and it only has the .rsrc section:
$ i686-w64-mingw32-objdump -h test-rsrc.2.dll
test-rsrc.dll: file format pei-i386
Sections:
Idx Name Size VMA LMA File off Algn
0 .rsrc 000000b8 00000000 00000000 00000200 2**2
but, when I checked it with objdump, it complains about the .rsrc section being
corrupt:
$ i686-w64-mingw32-objdump -p test-rsrc.2.dll
test-rsrc.2.dll: file format pei-i386
[...]
The .rsrc Resource Directory section:
000 Type Table: Char: 0, Time: 00000000, Ver: 0/0, Num Names: 0, IDs: 1
010 Entry: ID: 0x000010, Value: 0x80000018
018 Name Table: Char: 0, Time: 00000000, Ver: 0/0, Num Names: 0, IDs: 1
028 Entry: ID: 0x000001, Value: 0x80000030
030 Language Table: Char: 0, Time: 00000000, Ver: 0/0, Num Names: 0,
IDs: 1
040 Entry: ID: 0x000409, Value: 0x000048
048 Leaf: Addr: 0x000058, Size: 0x00005c, Codepage: 0
Corrupt .rsrc section detected!
I think that this might be due to missing padding at the end of the section,
but I am not sure. Given that you are a windows expert, perhaps you can find
out more ?
The linker script that I am using looks like this:
$ cat test-rsrc.ld
/* Copyright (C) 2014-2021 Free Software Foundation, Inc.
Copying and distribution of this script, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. */
OUTPUT_FORMAT(pei-i386)
SECTIONS
{
.rsrc __image_base__ : SUBALIGN(4)
{
KEEP (*(.rsrc))
KEEP (*(.rsrc$*))
}
/DISCARD/ : { *(*) }
}
--
You are receiving this mail because:
You are on the CC list for the bug.
- [Bug ld/30359] New: Create Resource-Only DLL, pali at kernel dot org, 2023/04/15
- [Bug ld/30359] Create Resource-Only DLL, nickc at redhat dot com, 2023/04/18
- [Bug ld/30359] Create Resource-Only DLL, pali at kernel dot org, 2023/04/18
- [Bug ld/30359] Create Resource-Only DLL, nickc at redhat dot com, 2023/04/19
- [Bug ld/30359] Create Resource-Only DLL, pali at kernel dot org, 2023/04/21
- [Bug ld/30359] Create Resource-Only DLL,
nickc at redhat dot com <=
- [Bug ld/30359] Create Resource-Only DLL, pali at kernel dot org, 2023/04/25
- [Bug ld/30359] Create Resource-Only DLL, pali at kernel dot org, 2023/04/25
- [Bug ld/30359] Create Resource-Only DLL, nickc at redhat dot com, 2023/04/26
- [Bug ld/30359] Create Resource-Only DLL, pali at kernel dot org, 2023/04/26