[llvm-dev] Why -pie option force LLD to output shared obj file type, not executable? (original) (raw)
Shi, Steven via llvm-dev llvm-dev at lists.llvm.org
Wed Jan 23 07:47:15 PST 2019
- Previous message: [llvm-dev] (in x86, ) Use ebp or esp to access local variable? what's different?
- Next message: [llvm-dev] Why -pie option force LLD to output shared obj file type, not executable?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hello Rui, I'm enabling the LLD in the Uefi firmware edk2 build. I meet a problem about the -pie option and cannot output the executable type obj file correctly. I need your advice. The Uefi firmware executable binary is the position independent + small code mode in 64bits. So we always add the options "-Wl,-pie -mcmodel=small" in our clang build toolchain. These options work well with binutils LD, but cannot work with LLD. I see the LLD uses the below code to force the output obj file as shared obj type if link with -pie. Is there any way to let LLD output executable type obj with -pie option? I'm OK if I have to link twice, first output DYN and then covert to EXEC in some way. Could you give some link command examples on it?
lld\ELF\Writer.cpp static uint16_t getELFType() { if (Config->Pic) return ET_DYN; if (Config->Relocatable) return ET_REL; return ET_EXEC; }
Thanks Steven
-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20190123/3d35f540/attachment.html>
- Previous message: [llvm-dev] (in x86, ) Use ebp or esp to access local variable? what's different?
- Next message: [llvm-dev] Why -pie option force LLD to output shared obj file type, not executable?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]