Error while linking x86_64 assembly file

3 years ago by prettydarknwild to c/programming

I was trying to assemble and link this file, but when i try to link it with the following command:

gcc x64_hello.o -o x64_hello.elf -nostdlib

gcc throws the following error:

/usr/bin/ld: x64_hello.o: relocation R_X86_64_32S against '.data' can not be used when making a PIE object; recompile with -fPIE /usr/bin/ld: Failed to set dynamic section sizes: bad value collect2: error: ld returned exit status 1

orclev 2 points 3 years ago

Seems like the error is telling you how to fix it. There seems to be a mismatch between something that wants PIE enabled and something that doesn't have it enabled. Without a better understanding of what you're doing I can't provide much more help other than to say maybe try disabling or enabling PIE at various points.

path: 0 6868077, hotness: undefined, score: 2, children: 2
prettydarknwild 1 point 3 years ago
path: 0 6868077 6869693, hotness: undefined, score: 1, children: 0
prettydarknwild 1 point 3 years ago path: 0 6868077 6874099, hotness: undefined, score: 1, children: 0
programming
programming

@beehaw.org

login for more options
3347
186
1

All things programming and coding related. Subcommunity of Technology.


This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.

go to feed...