bug-binutils
[Top][All Lists]
Advanced

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

[Bug ld/30922] New: gcc -pie generates unwanted PE export table


From: pali at kernel dot org
Subject: [Bug ld/30922] New: gcc -pie generates unwanted PE export table
Date: Sat, 30 Sep 2023 14:17:16 +0000

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

            Bug ID: 30922
           Summary: gcc -pie generates unwanted PE 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: ---
            Target: x86_64-w64-mingw32

Originally reported on: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108851


When gcc is invoked with -pie option then for PE executables it automatically
generates export table, even when executable does not export anything.

Test case:

$ cat test-pie.c
int func(void) {
        return 42;
}

int main() {
        return func();
}

$ x86_64-w64-mingw32-gcc -pie test-pie.c -o test-pie.exe

$ x86_64-w64-mingw32-objdump -p test-pie.exe | grep -A 20 'There is an export
table'
There is an export table in .edata at 0x140008000

The Export Tables (interpreted .edata section contents)

Export Flags                    0
Time/Date stamp                 63f2a29f
Major/Minor                     0/0
Name                            0000000000008028 test-pie.exe
Ordinal Base                    1
Number in:
        Export Address Table            00000000
        [Name Pointer/Ordinal] Table    00000000
Table Addresses
        Export Address Table            0000000000008028
        Name Pointer Table              0000000000008028
        Ordinal Table                   0000000000008028

Export Address Table -- Ordinal Base 1

[Ordinal/Name Pointer] Table

Without gcc's -pie option, executable does not have export table.

Note that similar issue was reported also to LD
https://sourceware.org/bugzilla/show_bug.cgi?id=30004 and proposed LD patch
does not change behavior in this issue.

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