public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/108851] New: gcc -pie generates unwanted PE export table
@ 2023-02-19 22:34 pali at kernel dot org
  2023-02-21  7:34 ` [Bug target/108851] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: pali at kernel dot org @ 2023-02-19 22:34 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 108851
           Summary: gcc -pie generates unwanted PE export table
           Product: gcc
           Version: 12.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: pali at kernel dot org
  Target Milestone: ---

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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/108851] gcc -pie generates unwanted PE export table
  2023-02-19 22:34 [Bug c/108851] New: gcc -pie generates unwanted PE export table pali at kernel dot org
@ 2023-02-21  7:34 ` pinskia at gcc dot gnu.org
  2023-04-07 18:24 ` pali at kernel dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: pinskia at gcc dot gnu.org @ 2023-02-21  7:34 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
I doubt GCC has control over this. I suspect the issue is in the binutils side
...

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/108851] gcc -pie generates unwanted PE export table
  2023-02-19 22:34 [Bug c/108851] New: gcc -pie generates unwanted PE export table pali at kernel dot org
  2023-02-21  7:34 ` [Bug target/108851] " pinskia at gcc dot gnu.org
@ 2023-04-07 18:24 ` pali at kernel dot org
  2023-04-25 20:09 ` pali at kernel dot org
  2023-09-30 14:18 ` pali at kernel dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pali at kernel dot org @ 2023-04-07 18:24 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from Pali Rohár <pali at kernel dot org> ---
So should I report this issue to binutils bugtracker then?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/108851] gcc -pie generates unwanted PE export table
  2023-02-19 22:34 [Bug c/108851] New: gcc -pie generates unwanted PE export table pali at kernel dot org
  2023-02-21  7:34 ` [Bug target/108851] " pinskia at gcc dot gnu.org
  2023-04-07 18:24 ` pali at kernel dot org
@ 2023-04-25 20:09 ` pali at kernel dot org
  2023-09-30 14:18 ` pali at kernel dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pali at kernel dot org @ 2023-04-25 20:09 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from Pali Rohár <pali at kernel dot org> ---
Or do you have any other suggestions?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [Bug target/108851] gcc -pie generates unwanted PE export table
  2023-02-19 22:34 [Bug c/108851] New: gcc -pie generates unwanted PE export table pali at kernel dot org
                   ` (2 preceding siblings ...)
  2023-04-25 20:09 ` pali at kernel dot org
@ 2023-09-30 14:18 ` pali at kernel dot org
  3 siblings, 0 replies; 5+ messages in thread
From: pali at kernel dot org @ 2023-09-30 14:18 UTC (permalink / raw)
  To: gcc-bugs

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

Pali Rohár <pali at kernel dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           See Also|https://sourceware.org/bugz |https://sourceware.org/bugz
                   |illa/show_bug.cgi?id=30004  |illa/show_bug.cgi?id=30922

--- Comment #4 from Pali Rohár <pali at kernel dot org> ---
No response here, so I reported it to binutils bugtracker:
https://sourceware.org/bugzilla/show_bug.cgi?id=30922

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-09-30 14:18 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-19 22:34 [Bug c/108851] New: gcc -pie generates unwanted PE export table pali at kernel dot org
2023-02-21  7:34 ` [Bug target/108851] " pinskia at gcc dot gnu.org
2023-04-07 18:24 ` pali at kernel dot org
2023-04-25 20:09 ` pali at kernel dot org
2023-09-30 14:18 ` pali at kernel dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).