Simon Atanasyan
2013-Oct-08 19:42 UTC
[LLVMdev] [lld] Add target-specific entries to the dynamic table
Hi, I'm going to add MIPS target linking support to LLD. One of the things I bumped into is the dynamic table. MIPS ABI declares many additional mandatory dynamic table entries like DT_MIPS_LOCAL_GOTNO, DT_MIPS_SYMTABNO etc. Some of these entries can be allocated and initialized at once, other entries should be allocated in the beginning and initialized at the end. For example we need to know the number of GOT entries related to local symbols to set the DT_MIPS_LOCAL_GOTNO value. Current DynamicTable external interface is rather solid and allows only combined allocation/initialization using DynamicTable::addEntry() method. So my question - what is the correct/best way to improve DynamicTable interface and allow to add target-specific entries to the dynamic table? My current idea is to declare abstract base class TargetDynTableHandler and factor out the dynamic table's entries allocation/initialization to the successors of that class. Is it a good way? Maybe it's over complicated. Regards, Simon
Shankar Easwaran
2013-Oct-08 19:51 UTC
[LLVMdev] [lld] Add target-specific entries to the dynamic table
You can add a member function in the TargetHandler to override the dynamic table that the target wants to create. Thanks Shankar Easwaran On 10/8/2013 2:42 PM, Simon Atanasyan wrote:> Hi, > > I'm going to add MIPS target linking support to LLD. One of the things > I bumped into is the dynamic table. MIPS ABI declares many additional > mandatory dynamic table entries like DT_MIPS_LOCAL_GOTNO, > DT_MIPS_SYMTABNO etc. Some of these entries can be allocated and > initialized at once, other entries should be allocated in the > beginning and initialized at the end. For example we need to know the > number of GOT entries related to local symbols to set the > DT_MIPS_LOCAL_GOTNO value. > > Current DynamicTable external interface is rather solid and allows > only combined allocation/initialization using DynamicTable::addEntry() > method. > > So my question - what is the correct/best way to improve DynamicTable > interface and allow to add target-specific entries to the dynamic > table? > > My current idea is to declare abstract base class > TargetDynTableHandler and factor out the dynamic table's entries > allocation/initialization to the successors of that class. Is it a > good way? Maybe it's over complicated. > > Regards, > Simon > _______________________________________________ > LLVM Developers mailing list > LLVMdev at cs.uiuc.edu http://llvm.cs.uiuc.edu > http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev > >-- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation
Simon Atanasyan
2013-Oct-10 11:29 UTC
[LLVMdev] [lld] Add target-specific entries to the dynamic table
On Tue, Oct 8, 2013 at 11:51 PM, Shankar Easwaran <shankare at codeaurora.org> wrote:> You can add a member function in the TargetHandler to override the dynamic > table that the target wants to create.Thanks for the advice. I will use this approach. Regards, Simon