[PATCH] Subclass DynamicTable for each targets to factor out handling of target dependent part of a dynamic table

Simon Atanasyan simon at atanasyan.com
Tue Jan 28 23:31:12 PST 2014


  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`.

  Thoughts?

http://llvm-reviews.chandlerc.com/D2643



More information about the llvm-commits mailing list