[PATCH] D48771: [ELF] Don't create empty output section for unreferenced PROVIDE symbol

George Rimar via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jun 29 08:12:55 PDT 2018


grimar accepted this revision.
grimar added a comment.
This revision is now accepted and ready to land.

LGTM with few nits.



================
Comment at: test/ELF/linkerscript/provide-empty-section.s:5
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %tdefined.o -defsym="foo=42"
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %S/Inputs/provide-empty-section.s -o %treference.o
+
----------------
I would avoid using additional input file and `-defsym` and be more explicit
(Just echoing code to llvm-mc is the common way when there is a little amount of code I believe).

```
# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %tundefined.o
# RUN: echo "foo=42" | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %tdefined.o
# RUN: echo "call foo" | llvm-mc -filetype=obj -triple=x86_64-unknown-linux - -o %treference.o
```


================
Comment at: test/ELF/linkerscript/provide-empty-section.s:11
+# RUN: echo "  }" >> %t.script
+# RUN: echo "}" >> %t.script
+
----------------
Let's do it a single line. That is what we usually try to do if possible and also it avoids multiple echo calls.

`# RUN: echo "SECTIONS { .bar : { PROVIDE(foo = .); } }" > %t.script`


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D48771





More information about the llvm-commits mailing list