Sample Header Ad - 728x90

Linking with GCC doesn't detect -fPIC flag

2 votes
1 answer
2175 views
I am trying to link some files. Here is my command: gcc -T linker.ld -o Stack\ Berry.bin -ffreestanding -O2 -nostlib kernel.o boot.o -fPIC -lgcc How ever, I get this error: /usr/bin/ld: boot.o: relocation R_X86_64_32 against `.multiboot' can not be used when making a PIE object; recompile with -fPIC /usr/bin/ld: final link failed: Nonrepresentable section on output I have included the -fPIC argument, have I just put it in the wrong place? I haven't been able to find any thing for the syntax for this flag. Thanks!
Asked by Milo Banks (21 rep)
Nov 13, 2018, 12:46 AM
Last activity: Aug 5, 2025, 07:11 AM