[Bug 1115034] New: gnatmake broken when gcc-PIE is installed
http://bugzilla.suse.com/show_bug.cgi?id=1115034 Bug ID: 1115034 Summary: gnatmake broken when gcc-PIE is installed Classification: openSUSE Product: openSUSE Distribution Version: Leap 15.0 Hardware: Other OS: Other Status: NEW Severity: Normal Priority: P5 - None Component: Development Assignee: bnc-team-screening@forge.provo.novell.com Reporter: tdevries@suse.com QA Contact: qa-bugs@suse.de Found By: --- Blocker: --- Consider this test-case: ... $ cat hello.adb with Ada.Text_IO; procedure Hello is begin Ada.Text_IO.Put_Line("Hello, world!"); end Hello; ... We're able to compile this using gnatmake: ... $ rm -f hello.ali hello.o hello ; gnatmake -v hello.adb -largs -v GNATMAKE 8.2.1 20180831 [gcc-8-branch revision 264010] Copyright (C) 1992-2018, Free Software Foundation, Inc. "hello.ali" being checked ... -> "hello.ali" missing. gcc -c hello.adb End of compilation gnatbind -x hello.ali gnatlink hello.ali -v GNATLINK 8.2.1 20180831 [gcc-8-branch revision 264010] Copyright (C) 1995-2018, Free Software Foundation, Inc. gcc -c -gnatA -gnatWb -gnatiw -gnatws /root/b~hello.adb /usr/bin/gcc b~hello.o ./hello.o -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 ... And then run it: ... $ ./hello Hello, world! ... However, when we install gcc-PIE: ... $ sudo zypper install gcc-PIE ... we get a gnatlink error instead: ... $ rm -f hello.ali hello.o hello ; gnatmake -v hello.adb -largs -v GNATMAKE 8.2.1 20180831 [gcc-8-branch revision 264010] Copyright (C) 1992-2018, Free Software Foundation, Inc. "hello.ali" being checked ... -> "hello.ali" missing. gcc -c hello.adb End of compilation gnatbind -x hello.ali gnatlink hello.ali -v GNATLINK 8.2.1 20180831 [gcc-8-branch revision 264010] Copyright (C) 1995-2018, Free Software Foundation, Inc. gcc -c -gnatA -gnatWb -gnatiw -gnatws /root/b~hello.adb /usr/bin/gcc b~hello.o ./hello.o -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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-except.o): relocation R_X86_64_32S against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-finali.o): relocation R_X86_64_32S against symbol `ada__finalization__controlledT' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-ioexce.o): relocation R_X86_64_32 against symbol `ada__io_exceptions__status_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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-stmaco.o): relocation R_X86_64_32S against symbol `ada__strings__maps__constants__A3s' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-stream.o): relocation R_X86_64_32S against symbol `ada__streams__root_stream_typeT' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-string.o): relocation R_X86_64_32 against symbol `ada__strings__length_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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-strmap.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-tags.o): relocation R_X86_64_32S against symbol `ada__tags__external_tag_htable__tableXn' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-textio.o): relocation R_X86_64_32S against symbol `ada__text_io__text_afcbT' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-trasym.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(i-c.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-bitops.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-boustr.o): relocation R_X86_64_32S against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-except.o): relocation R_X86_64_32 against symbol `system__exceptions__foreign_exception' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-exctab.o): relocation R_X86_64_32S against symbol `system__exception_table__htable' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-ficobl.o): relocation R_X86_64_32S against symbol `system__file_control_block__afcbT' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-fileio.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-finroo.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-memory.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-os_lib.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-secsta.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-soflin.o): relocation R_X86_64_32 against symbol `ada__exceptions__null_occurrence' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-valllu.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-valuti.o): relocation R_X86_64_32 against symbol `constraint_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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-wchcon.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-wchjis.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-wchstw.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-objrea.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-dwalin.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-mmap.o): relocation R_X86_64_32S against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-mmosin.o): relocation R_X86_64_32 against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(adadecode.o): relocation R_X86_64_32 against `.rodata.str1.1' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(adaint.o): relocation R_X86_64_32 against `.rodata.str1.1' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(cio.o): relocation R_X86_64_32 against `.rodata.str1.1' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(env.o): relocation R_X86_64_32 against `.rodata.str1.1' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(init.o): relocation R_X86_64_32S against `.rodata' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(sysdep.o): relocation R_X86_64_32 against undefined symbol `cap_get_proc' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(tracebak.o): relocation R_X86_64_32 against `.text' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(raise-gcc.o): relocation R_X86_64_32 against `.rodata.str1.1' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-chahan.o): relocation R_X86_64_32S against symbol `ada__characters__handling__char_map' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(a-elchha.o): relocation R_X86_64_32S against symbol `system__soft_links__task_termination_nt' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-exctra.o): relocation R_X86_64_32 against `.text' 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: /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a(s-addima.o): relocation R_X86_64_32S against `.rodata' 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. $ ... The compilation fails because gnatlink uses /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a instead of /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat_pic.a. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c1
--- Comment #1 from Tom de Vries
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c2
--- Comment #2 from Tom de Vries
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c3
Tom de Vries
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c4
--- Comment #4 from Tom de Vries
The solution for the compilation error with gcc-PIE not installed is to teach gnatlink to include libgnat_pic.a for -pie.
Filed upstream PR87936 - "gnatlink fails with -pie" ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87936 ). -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c5
--- Comment #5 from Tom de Vries
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c6
--- Comment #6 from Tom de Vries
I just realized there's possibly another related problem. With gcc-PIE setting the gcc default to use -fPIE -pie, libgnat is build with -fPIE (and libgnat_pic.a with -fpic).
Hmm, that may not be true. Building the target libraries will probably be done without taking the gcc-PIE setting into account.
Filed PR87938 - libgnat.a not compiled with -fno-PIC ( https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87938 ).
Still, I think this is valid. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c7
--- Comment #7 from Tom de Vries
However, when we install gcc-PIE: ... $ sudo zypper install gcc-PIE ...
we get a gnatlink error instead: ... $ rm -f hello.ali hello.o hello ; gnatmake -v hello.adb -largs -v ... /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 ...
The compilation fails because gnatlink uses /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat.a instead of /usr/lib64/gcc/x86_64-suse-linux/8/adalib/libgnat_pic.a.
I've checked in ubuntu 18.04, which has PIE as default. There we still got libgnat.a and libgnat_pic.a, but libgnat.a was compiled with the default (i.e., -fPIE). So, gnatmake still selects libgnat.a, but that's not a problem. -- You are receiving this mail because: You are on the CC list for the bug.
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c8
--- Comment #8 from Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c12
--- Comment #12 from Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c13
--- Comment #13 from Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c14
--- Comment #14 from Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c15
--- Comment #15 from Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c16
--- Comment #16 from Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
http://bugzilla.suse.com/show_bug.cgi?id=1115034#c17
--- Comment #17 from Swamp Workflow Management
http://bugzilla.suse.com/show_bug.cgi?id=1115034
Swamp Workflow Management
participants (1)
-
bugzilla_noreply@novell.com