[Bug 1635706] Re: gcc 6 outputs a shared object by default instead of an executable

Hadrien launchpad at psydk.org
Sat Oct 22 14:15:33 UTC 2016


I tried with a two steps generation: first a call to "gcc" to generate a
.o file, then a call to "ld" to generate an executable.

I attached a minimal example program that does not need the libc or
standard crt.o. I used a slightly modified version of that program :

https://gist.github.com/lunixbochs/462ee21c3353c56b910f

in order to get the smallest "ld" command line possible. This is it:

ld -dynamic-linker /lib64/ld-linux-x86-64.so.2 -pie -o exe plop.o

I found that when the "-pie" option is removed, the ELF header Type
field changes from DYN to EXEC.

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to gcc-defaults in Ubuntu.
https://bugs.launchpad.net/bugs/1635706

Title:
  gcc 6 outputs a shared object by default instead of an executable

Status in build-essential package in Ubuntu:
  New
Status in gcc-defaults package in Ubuntu:
  New

Bug description:
  Ubuntu 16.10 with gcc version 6.2.0 20161005 (Ubuntu 6.2.0-5ubuntu12)

  * Install gcc: sudo apt install build-essential
  * Build any program with gcc.
      Minimal example: printf "int main() { return 1; }" | gcc -x c -
  * Read the output file header: readelf -h a.out

  Expected result: the ELF header Type shows: EXEC
  Actual result: the ELF header Type shows: DYN

  The side effect is that we cannot run any program built with gcc 6
  from Nautilus. Nautilus opens an error message saying it does not know
  how to handle a shared library.

  Everything was fine with the gcc release in Ubuntu 16.04

  ProblemType: Bug
  DistroRelease: Ubuntu 16.10
  Package: gcc 4:6.1.1-1ubuntu2
  ProcVersionSignature: Ubuntu 4.8.0-22.24-generic 4.8.0
  Uname: Linux 4.8.0-22-generic x86_64
  ApportVersion: 2.20.3-0ubuntu8
  Architecture: amd64
  CurrentDesktop: Unity
  Date: Fri Oct 21 21:11:46 2016
  EcryptfsInUse: Yes
  InstallationDate: Installed on 2016-10-14 (6 days ago)
  InstallationMedia: Ubuntu 16.10 "Yakkety Yak" - Release amd64 (20161012.2)
  SourcePackage: gcc-defaults
  UpgradeStatus: No upgrade log present (probably fresh install)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/build-essential/+bug/1635706/+subscriptions



More information about the foundations-bugs mailing list