[llvm-dev] Prevent Instruction Fixup from using relocations

Zhang via llvm-dev llvm-dev at lists.llvm.org
Thu Mar 11 17:05:45 PST 2021


Hi:
Thanks for the reply. I'm aware of this however I'd assume it's still possible to emit internal references if two functions are in the same translation unit?


Zhang
 
 
------------------ Original ------------------
From:  "llvm-dev"<llvm-dev at lists.llvm.org>;
Date:  Thu, Mar 11, 2021 10:59 PM
To:  "llvm-dev"<llvm-dev at lists.llvm.org>; 

Subject:  Re: [llvm-dev] Prevent Instruction Fixup from using relocations

 

On Thu, Mar 11, 2021 at 06:43:16PM +0800, Zhang via llvm-dev wrote:
> I'm trying to build a toy backend that produces code without
> relocation for my toy ELF loader.

The MC layer is not meant to produce ELF executables, but to produce ELF
relocatable object files. You are still supposed to run a linker on
them. As such, the MC layer will emit relocations for things like symbol
references (e.g. the name of a function) as it is the job of the linker
to resolve those. There are some complications like turning symbol
references into section references, but the same idea applies to those.

Joerg
_______________________________________________
LLVM Developers mailing list
llvm-dev at lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210312/5e271a63/attachment.html>


More information about the llvm-dev mailing list