Liad Mordekoviz via llvm-dev
2017-Dec-14 10:36 UTC
[llvm-dev] Help adding entries to .symtab
Hi everyone, I am fairly new to LLVM, I'm working on a new backend. I am trying to add information to a specific instruction using the .symtab in the ELF format. I've been searching through the LLVM source code trying to find a way to do such a thing. Can anyone help me with some directions or point me to some documents in the matter. Thanks, Liad. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171214/efdb64b4/attachment.html>
Robinson, Paul via llvm-dev
2017-Dec-14 19:03 UTC
[llvm-dev] Help adding entries to .symtab
The .symtab has symbols; you could define a label for the instruction, and store something in the symbol table entry for the label. This kind of thing would be done in the MC layer. This would be one way to provide annotations that aren't needed for execution. If you need to change the instruction itself, for example to have the instruction refer to memory somewhere, then you need to modify the instruction itself. --paulr From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Liad Mordekoviz via llvm-dev Sent: Thursday, December 14, 2017 2:37 AM To: llvm-dev Subject: [llvm-dev] Help adding entries to .symtab Hi everyone, I am fairly new to LLVM, I'm working on a new backend. I am trying to add information to a specific instruction using the .symtab in the ELF format. I've been searching through the LLVM source code trying to find a way to do such a thing. Can anyone help me with some directions or point me to some documents in the matter. Thanks, Liad. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171214/8b86e019/attachment.html>
Liad Mordekoviz via llvm-dev
2017-Dec-14 20:59 UTC
[llvm-dev] Help adding entries to .symtab
Hey Paul, first of all thank you for taking the time to answer me, if I understand you correctly, I need to modify the instruction it self so one of it's operands is a symbol, and then at MC layer handle that symbol and add an entry to the symtab for that label? What kind of symbol should I use doing such thing? external symbol or MCSymbol? I was trying to find where in the code during the MC layer I add entries to the symtab, I'd really appreciate some directions in the area. Let me give an example so my questions might be a bit more clearer: BB#0 ...some opcodes... mov r1, BB#1 BB#1 ...some opcodes... I'd like to put a place holder instead of the BB#1 in the mov opcode, and create a symbol named "BB#1" that points to that opcode, so during link time I can replace that placeholder with the actual address of BB#1. Again thank you for your time and answer, Liad. On Thu, Dec 14, 2017 at 9:03 PM, Robinson, Paul <paul.robinson at sony.com> wrote:> The .symtab has symbols; you could define a label for the instruction, and > store something in the symbol table entry for the label. This kind of > thing would be done in the MC layer. > > This would be one way to provide annotations that aren't needed for > execution. If you need to change the instruction itself, for example to > have the instruction refer to memory somewhere, then you need to modify the > instruction itself. > > --paulr > > > > *From:* llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] *On Behalf Of *Liad > Mordekoviz via llvm-dev > *Sent:* Thursday, December 14, 2017 2:37 AM > *To:* llvm-dev > *Subject:* [llvm-dev] Help adding entries to .symtab > > > > Hi everyone, > > > > I am fairly new to LLVM, I'm working on a new backend. > > I am trying to add information to a specific instruction using the .symtab > in the ELF format. > > I've been searching through the LLVM source code trying to find a way to > do such a thing. > > Can anyone help me with some directions or point me to some documents in > the matter. > > > > Thanks, Liad. >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171214/ceb301d1/attachment.html>