bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/30004] New: LD --exclude-all-symbols generates export table


From: pali at kernel dot org
Subject: [Bug ld/30004] New: LD --exclude-all-symbols generates export table
Date: Sun, 15 Jan 2023 14:45:31 +0000

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

            Bug ID: 30004
           Summary: LD --exclude-all-symbols generates export table
           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: ---

LD --exclude-all-symbols has issues for Native PE executables. It causes
generation of empty export table and puts name of the output executable/driver
(-o) as name of the export library. PE executables which are in shared address
space (e.g. NT driver executables) should really do not be treated as libraries
with library name (unless explicitly asked for such thing).

Test case on Debian Sid:

$ x86_64-w64-mingw32-ld -v
GNU ld (GNU Binutils) 2.39.90.20230110
$
$ x86_64-w64-mingw32-gcc -v
Using built-in specs.
COLLECT_GCC=x86_64-w64-mingw32-gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-w64-mingw32/12-win32/lto-wrapper
Target: x86_64-w64-mingw32
Configured with: ../../src/configure --build=x86_64-linux-gnu --prefix=/usr
--includedir='/usr/include' --mandir='/usr/share/man'
--infodir='/usr/share/info' --sysconfdir=/etc --localstatedir=/var
--disable-option-checking --disable-silent-rules
--libdir='/usr/lib/x86_64-linux-gnu' --libexecdir='/usr/lib/x86_64-linux-gnu'
--disable-maintainer-mode --disable-dependency-tracking --prefix=/usr
--enable-shared --enable-static --disable-multilib --with-system-zlib
--libexecdir=/usr/lib --without-included-gettext --libdir=/usr/lib
--enable-libstdcxx-time=yes --with-tune=generic --with-headers
--enable-version-specific-runtime-libs --enable-fully-dynamic-string
--enable-libgomp --enable-languages=c,c++,fortran,objc,obj-c++,ada --enable-lto
--enable-threads=win32 --program-suffix=-win32
--program-prefix=x86_64-w64-mingw32- --target=x86_64-w64-mingw32
--with-as=/usr/bin/x86_64-w64-mingw32-as
--with-ld=/usr/bin/x86_64-w64-mingw32-ld --enable-libatomic
--enable-libstdcxx-filesystem-ts=yes --enable-dependency-tracking SED=/bin/sed
Thread model: win32
Supported LTO compression algorithms: zlib
gcc version 12-win32 (GCC)
$
$ cat test-exclude-all-symbols.c
int empty(void) { return 0; }
$
$ x86_64-w64-mingw32-gcc test-exclude-all-symbols.c -pie -nostdlib -e empty
-Wl,--subsystem,native -Wl,--exclude-all-symbols -o
test-exclude-all-symbols.sys
$
$ x86_64-w64-mingw32-objdump -p test-exclude-all-symbols.sys | grep -A 20
'There is an export table'
There is an export table in .edata at 0x140005000

The Export Tables (interpreted .edata section contents)

Export Flags                    0
Time/Date stamp                 63c4107f
Major/Minor                     0/0
Name                            0000000000005028 test-exclude-all-symbols.sys
Ordinal Base                    1
Number in:
        Export Address Table            00000000
        [Name Pointer/Ordinal] Table    00000000
Table Addresses
        Export Address Table            0000000000005028
        Name Pointer Table              0000000000005028
        Ordinal Table                   0000000000005028

Export Address Table -- Ordinal Base 1

[Ordinal/Name Pointer] Table

$

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