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

            Bug ID: 85564
           Summary: Option "-static" affects the type of generated program
           Product: gcc
           Version: 7.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alinshans at gmail dot com
  Target Milestone: ---

System: Ubuntu 16.04
GCC version: 7.3.0

For example:

  // main.c
  int main() { return 0; }

Runs the following commands:

  $ gcc main.c -fPIC -pie -nostdlib -emain -static
  $ readelf -h a.out

In the "TYPE" field, GCC 7.3 is "DYN" while GCC 7.1/7.2 is "EXEC". After
removing the option "-static", all of them are "DYN". Does the option "-static"
affect the type of generated program?

Reply via email to