[lld] r277687 - Remove buggy PROVIDE-in-output-description command.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 3 19:03:29 PDT 2016


Author: ruiu
Date: Wed Aug  3 21:03:29 2016
New Revision: 277687

URL: http://llvm.org/viewvc/llvm-project?rev=277687&view=rev
Log:
Remove buggy PROVIDE-in-output-description command.

With the previous change, it is now obvious that readProvide in
this context appended new commands to a wrong command list.
It was mistakenly adding new commands to the top level.
Thus, all commands inside output section descriptions were
interpreted as they were written on top level.

PROVIDE command naturally requires symbol assignment support
in the output section description. We don't have that one yet.
I removed the implementation because there's no way to fix it now.
We can resurrect the test once we support the symbol assignment
(with a modification to detect errors that we failed to find as
described.)

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

Modified: lld/trunk/ELF/LinkerScript.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/LinkerScript.cpp?rev=277687&r1=277686&r2=277687&view=diff
==============================================================================
--- lld/trunk/ELF/LinkerScript.cpp (original)
+++ lld/trunk/ELF/LinkerScript.cpp Wed Aug  3 21:03:29 2016
@@ -822,17 +822,11 @@ ScriptParser::readOutputSectionDescripti
       Cmd->Commands.emplace_back(readInputSectionDescription());
       continue;
     }
-
-    StringRef Tok = next();
-    if (Tok == "PROVIDE") {
-      Opt.Commands.emplace_back(readProvide(false));
-    } else if (Tok == "PROVIDE_HIDDEN") {
-      Opt.Commands.emplace_back(readProvide(true));
-    } else if (Tok == "SORT") {
+    if (skip("SORT")) {
       readSort();
-    } else {
-      setError("unknown command " + Tok);
+      continue;
     }
+    setError("unknown command " + peek());
   }
   Cmd->Phdrs = readOutputSectionPhdrs();
   Cmd->Filler = readOutputSectionFiller();

Removed: lld/trunk/test/ELF/linkerscript/linkerscript-provide-in-section.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/linkerscript/linkerscript-provide-in-section.s?rev=277686&view=auto
==============================================================================
--- lld/trunk/test/ELF/linkerscript/linkerscript-provide-in-section.s (original)
+++ lld/trunk/test/ELF/linkerscript/linkerscript-provide-in-section.s (removed)
@@ -1,20 +0,0 @@
-# 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




More information about the llvm-commits mailing list