[PATCH] [lld] [LinkerScript] Implement semantics for simple sections mappings

Rafael Auler rafaelauler at gmail.com
Thu Mar 12 12:50:09 PDT 2015


================
Comment at: include/lld/ReaderWriter/LinkerScript.h:1186
@@ +1185,3 @@
+  /// to the same set of expressions because of wildcards rules.
+  std::vector<const SymbolAssignment *> getExprs(const SectionKey &key);
+
----------------
shankarke wrote:
> rafaelauler wrote:
> > shankarke wrote:
> > > Could we evaluate as and when the input section is appended to the output section ?
> > Woudn't this be equivalent to evaluating once we append to segments? I mean, the algorithm I have in mind is exactly the same. Before adding a section to the output section, we gather all expressions and put it there. This is exactly the same as putting expressions once we attach an input section to a segment.
> You cannot get all the expressions and evaluate them for a simple case like this :-
>  
> SECTIONS {
>  
> .text : {
> __start_text_val = .;
> . = . + 1000;
> __end_text_val = .;
> *(.text)
> }
>  
> }
Thanks for detecting this unhandled corner case. To fix this, we need to return all expressions in "getExprs()" in the original order of the linker script. Currently, we return it in the reverse order, so "end_text_val = ." is evaluated before others.  I'll reverse the order and I'll add this test as a new test case.

http://reviews.llvm.org/D8157

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list