Bug 71072 - GNAT doesn't respect --enable-default-pie
Summary: GNAT doesn't respect --enable-default-pie
Status: WAITING
Alias: None
Product: gcc
Classification: Unclassified
Component: ada (show other bugs)
Version: 6.1.1
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-05-11 19:33 UTC by Matthias Klose
Modified: 2016-05-14 11:02 UTC (History)
5 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2016-05-11 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthias Klose 2016-05-11 19:33:20 UTC
GCC 6 introduces the --enable-default-pie option, however it looks like gnat doesn't respect this option.

Seen while running the examples/matrix test in gprbuild on x86_64-linux-gnu (gnatgcc here is just a symlink to the gcc driver matching the gnat version):

make[1]: Entering directory '/tmp/adt-run.SU7baW/adttmp/examples/matrix'
gprconfig --batch --config Ada  --config C --config Fortran -o default.cgpr
Creating configuration file: default.cgpr
gprbuild
using project file matrix.gpr
gnatgcc -c -gnat05 main.adb
gfortran -c multmat.f
gcc -c initmat.c
gprbind main.bexch
gnatbind main.ali
gnatgcc -c b__main.adb
ar cr libmatrix.a ...
ranlib libmatrix.a
gfortran main.o -o main
/usr/bin/ld: main.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
main.o: error adding symbols: Bad value
Makefile:2: recipe for target 'all' failed
make[1]: Leaving directory '/tmp/adt-run.SU7baW/adttmp/examples/matrix'
Makefile:5: recipe for target 'all' failed
collect2: error: ld returned 1 exit status
gprbuild: link of main.adb failed
make[1]: *** [all] Error 4
Comment 1 Eric Botcazou 2016-05-11 20:11:23 UTC
There is not enough information.  Please provide a testcase and a GCC command line (no, a GPRbuild invocation doesn't qualify).
Comment 2 nicolas.boulenguez 2016-05-14 11:02:58 UTC
Does examples/first_steps/ada_main.gpr trigger the failure?
And the same project with the C library removed?
Once you have a minimal reproducer, you may get the exact compiler invokations
with "gprbuild -v" (normal output is misleading).