This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -pie option in ARM64 environment


On Fri, 29 Sep 2017, jacob navia wrote:

I am getting this error:

GNU ld (GNU Binutils for Debian) 2.28
/usr/bin/ld: error.o: relocation R_AARCH64_ADR_PREL_PG_HI21 against external symbol `stderr@@GLIBC_2.17' can not be used when making a shared object; recompile with -fPIC

The problem is, I do NOT want to make a shared object! Just a plain executable.

The verbose linker options are as follows:

collect2 version 6.3.0 20170516
/usr/bin/ld -plugin /usr/lib/gcc/aarch64-linux-gnu/6/liblto_plugin.so -plugin-opt=/usr/lib/gcc/aarch64-linux-gnu/6/lto-wrapper -plugin-opt=-fresolution=/tmp/cc9I00ft.res -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s -plugin-opt=-pass-through=-lc -plugin-opt=-pass-through=-lgcc -plugin-opt=-pass-through=-lgcc_s --sysroot=/ --build-id --eh-frame-hdr --hash-style=gnu -dynamic-linker /lib/ld-linux-aarch64.so.1 -X -EL -maarch64linux --fix-cortex-a53-843419 -pie -o lcc /usr/lib/gcc/aarch64-linux-gnu/6/../../../aarch64-linux-gnu/Scrt1.o /usr/lib/gcc/aarch64-linux-gnu/6/../../../aarch64-linux-gnu/crti.o /usr/lib/gcc/aarch64-linux-gnu/6/crtbeginS.o -L/usr/lib/gcc/aarch64-linux-gnu/6 -L/usr/lib/gcc/aarch64-linux-gnu/6/../../../aarch64-linux-gnu -L/usr/lib/gcc/aarch64-linux-gnu/6/../../../../lib -L/lib/aarch64-linux-gnu -L/lib/../lib -L/usr/lib/aarch64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/aarch64-linux-gnu/6/../../.. alloc.o bind.o dag.o decl.o enode.o error.o backend-arm.o intrin.o event.o expr.o gen.o init.o input.o lex.o arm64.o list.o operators.o main.o ncpp.o output.o simp.o msg.o callwin64.o bitmasktable.o table.o stmt.o string.o stab.o sym.o Tree.o types.o analysis.o asm.o inline.o -lm ../lcclib.a ../bfd/libbfd.a ../asm/libopcodes.a -Map=lcc.map -v -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/aarch64-linux-gnu/6/crtendS.o /usr/lib/gcc/aarch64-linux-gnu/6/../../../aarch64-linux-gnu/crtn.o

I think the problems lies in this mysterious "pie" option:

... --fix-cortex-a53-843419 -pie -o lcc...


"PIE" could stand for Position Independent Executable.

How could I get rid of that?

-no-pie probably.

Which text file where is responsible for adding this "pie" option to the ld command line?

I am not so well versed in gcc's internals to figure out without your help.

Does it show when you run "gcc -dumpspecs"? If so you could provide a different specs file. Otherwise, you could check the patches that your distribution applies to gcc, one of them likely has "pie" in its name.

Easiest is likely to build gcc from the official sources, which shouldn't use pie by default.

--
Marc Glisse


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]