Comment # 2 on bug 1115034 from
We have a similar problem when gcc-PIE is not installed, and we try to build a
PIE passing -pie -fPIE explicitly:
...
$ rm -f hello.ali hello.o hello ; gnatmake -fPIE -v hello.adb -largs -v -pie 

GNATMAKE 8.2.1 20181025 [gcc-8-branch revision 265488]
Copyright (C) 1992-2018, Free Software Foundation, Inc.
  "hello.ali" being checked ...
  -> "hello.ali" missing.
gcc -c -fPIE hello.adb
End of compilation
gnatbind -x hello.ali
gnatlink hello.ali -fPIE -v -pie

GNATLINK 8.2.1 20181025 [gcc-8-branch revision 265488]
Copyright (C) 1995-2018, Free Software Foundation, Inc.
gcc -c -fPIE -gnatA -gnatWb -gnatiw -gnatws /root/b~hello.adb
/usr/bin/gcc b~hello.o ./hello.o -fPIE -pie -o hello -L./
-L/usr/lib64/gcc/x86_64-suse-linux/8/adalib/
/usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a -ldl -static-libgcc
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld:
/usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-contai.o): relocation
R_X86_64_32 against symbol `ada__containers__capacity_error' can not be used
when making a PIE object; recompile with -fPIC
  ...
/usr/lib64/gcc/x86_64-suse-linux/8/../../../../x86_64-suse-linux/bin/ld: final
link failed: nonrepresentable section on output
collect2: error: ld returned 1 exit status
gnatlink: error when calling /usr/bin/gcc
gnatmake: *** link failed.
$
...

Note that passing -pie as toplevel option to gnatmake seems to work:
...
delia:~ # rm -f hello.ali hello.o hello ; gnatmake -pie -fPIE -v hello.adb
-largs -v

GNATMAKE 8.2.1 20181025 [gcc-8-branch revision 265488]
Copyright (C) 1992-2018, Free Software Foundation, Inc.
  "hello.ali" being checked ...
  -> "hello.ali" missing.
gcc -c -pie -fPIE hello.adb
End of compilation
gnatbind -x hello.ali
gnatlink hello.ali -fPIE -v

GNATLINK 8.2.1 20181025 [gcc-8-branch revision 265488]
Copyright (C) 1995-2018, Free Software Foundation, Inc.
gcc -c -fPIE -gnatA -gnatWb -gnatiw -gnatws /root/b~hello.adb
/usr/bin/gcc b~hello.o ./hello.o -fPIE -o hello -L./
-L/usr/lib64/gcc/x86_64-suse-linux/8/adalib/
/usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a -ldl -static-libgcc
...
but actually the linkeline missing -pie, so we're not actually generating a
PIE.


You are receiving this mail because: