[PATCH] [lld][LinkerScript] Add matching of output sections to segments

Denis Protivensky dprotivensky at accesssoftek.com
Thu Jun 11 23:43:34 PDT 2015


================
Comment at: include/lld/ReaderWriter/LinkerScript.h:1448
@@ +1447,3 @@
+  bool _parsedPHDRS;
+  llvm::StringMap<ErrorOr<std::vector<const PHDR *>>> _sectionToPHDR;
+
----------------
Bigcheese wrote:
> Why are you storing the error here? It should be emitted when the error is encountered. Also, I think that SmallVector<..., 2> would be better here.
Good, will change to throw an error upon encountered and replace the vector.

================
Comment at: test/elf/linkerscript/phdrs-invalid.test:10-35
@@ +9,28 @@
+
+(command line clang -c simple.S -o simple.o)
+
+      .text
+      main:
+        mov $1, %eax
+        movq $1, %rdi
+        movq $msg, %rsi
+        movq $14, %rdx
+        syscall
+        ret
+
+        .globl _start
+      _start:
+        call  main
+        mov $60, %eax
+        syscall
+        ret
+
+      .data
+      msg: .asciz "Hello, World!\n"
+*/
+
+/*
+Prepare the object file to test on.
+
+RUN: yaml2obj -format=elf %p/Inputs/simple.o.yaml -o=%t.o
+*/
----------------
silvas wrote:
> silvas wrote:
> > denis-protivensky wrote:
> > > silvas wrote:
> > > > You can directly use llvm-mc instead of yaml2obj.
> > > Good point, but I'd prefer to use yaml2obj for consistency with other tests in lld, and because we already have the corresponding yaml file, so there's no need to add another one with assembly code.
> > There's been discussion about this recently on the mailing lists. Whichever tool is most convenient should be used (in this case, llvm-mc is clearly the most convenient). Generally speaking, yaml2obj has been overused in LLD.
> Actually now that I think about it (and discuss with Bigcheese), what this is testing is completely independent of the actual section content, so it doesn't make sense to have an assembly input (or an input generated from assembly). I think that yaml2obj is the right tool here, and that the test case can be significantly reduced from one generated from the one you would get from the assembly.
Yeah, that's right. I'm intrested in sections as the input, not the assembly code.

http://reviews.llvm.org/D10359

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






More information about the llvm-commits mailing list