[PATCH] D22738: [ELF/LinkerScript] Support PROVIDE/PROVIDE_HIDDEN inside output sections description.

Davide Italiano via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 24 16:21:30 PDT 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL276579: [ELF] Support PROVIDE/PROVIDE_HIDDEN inside output sections description. (authored by davide).

Changed prior to commit:
  https://reviews.llvm.org/D22738?vs=65279&id=65280#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D22738

Files:
  lld/trunk/ELF/LinkerScript.cpp
  lld/trunk/test/ELF/linkerscript-provide-in-section.s

Index: lld/trunk/test/ELF/linkerscript-provide-in-section.s
===================================================================
--- lld/trunk/test/ELF/linkerscript-provide-in-section.s
+++ lld/trunk/test/ELF/linkerscript-provide-in-section.s
@@ -0,0 +1,20 @@
+# REQUIRES: x86
+# RUN: llvm-mc -filetype=obj -triple=x86_64-unknown-linux %s -o %t
+# RUN: echo \
+# RUN: "SECTIONS { . = 1000; .blah : { PROVIDE(foo = .); } }" \
+# RUN:   > %t.script
+# RUN: ld.lld -o %t1 --script %t.script %t -shared
+# RUN: llvm-objdump -t %t1 | FileCheck %s
+# CHECK: 00000000000003e8         *ABS*           00000000 foo
+
+# RUN: echo \
+# RUN: "SECTIONS { . = 1000; .blah : { PROVIDE_HIDDEN(foo = .); } }" \
+# RUN:   > %t2.script
+# RUN: ld.lld -o %t2 --script %t2.script %t -shared
+# RUN: llvm-objdump -t %t2 | FileCheck %s --check-prefix=HIDDEN
+# HIDDEN: 00000000000003e8         *ABS*           00000000 .hidden foo
+
+.section blah
+.globl patatino
+patatino:
+  movl $foo, %edx
Index: lld/trunk/ELF/LinkerScript.cpp
===================================================================
--- lld/trunk/ELF/LinkerScript.cpp
+++ lld/trunk/ELF/LinkerScript.cpp
@@ -676,6 +676,10 @@
         InCmd->Patterns.push_back(next());
       }
       expect(")");
+    } else if (Tok == "PROVIDE") {
+      readProvide(false);
+    } else if (Tok == "PROVIDE_HIDDEN") {
+      readProvide(true);
     } else {
       setError("unknown command " + Tok);
     }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22738.65280.patch
Type: text/x-patch
Size: 1438 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160724/bd861219/attachment.bin>


More information about the llvm-commits mailing list