[PATCH] Subclass DynamicTable for each targets to factor out	handling of target dependent part of a dynamic table
    Shankar Easwaran 
    shankare at codeaurora.org
       
    Thu Jan 30 10:18:13 PST 2014
    
    
  
On 1/29/2014 1:31 AM, Simon Atanasyan wrote:
>    I thought about the code duplication problem but could not figure out an elegant solution.
>
>    Sure I can create a new class say `DefaultDynamicTable` subclassed from the `DynamicTable` and override the `createDefaultEntries` method. Then create `DefaultDynamicTable` for every targets except MIPS. But I do not like the word **Default** in the `DefaultDynamicTable` because using `DT_PLTGOT` for `.got.plt` section referencing is not default behavior but is just one of possible cases.
>
>    Another solution is to add a new virtual function `DynamicTable::getPLTGOTTag()`. By default it returns `DT_PLTGOT`, in case of MIPS it returns `DT_MIPS_PLTGOT`.
This is one way that I want to go about :-
DefaultDynamicTable
    - addTag
    - setTag
GnuLDDynamicTable : DefaultDynamicTable
    - add tags that is needed to duplicate default GnuLD behavior for 
all architectures.
    - add mappings that translate from one tag to another (to permit 
architectures to override).
MipsDynamicTable : GnuLDDynamicTable
     - override specific tags
Thanks
Shankar Easwaran
-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation
    
    
More information about the llvm-commits
mailing list