[PATCH] D22683: [ELF] Symbol assignment within input section list

Rafael Espíndola via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 4 13:47:42 PDT 2016


On 4 August 2016 at 16:21, Eugene Leviant <evgeny.leviant at gmail.com> wrote:
>> Fedora x86_64, no optimizations build with clang
>
> Interesting, after brief look, the only major difference I see in your patch
> is in "Add" lambda function made by Rui in r277653.
> What is the reason of test failure?


The diff that fixed the problem is attached.

I confess that I didn't debug it. I just compared your patch with
mine, move this change over and the test passed.

Cheers,
Rafael
-------------- next part --------------
commit 415368a51e8495cd8c72e0a0e02721847df571c7
Author: Rafael Ávila de Espíndola <rafael.espindola at gmail.com>
Date:   Thu Aug 4 15:55:02 2016 -0400

    bar

diff --git a/ELF/LinkerScript.cpp b/ELF/LinkerScript.cpp
index fc3af62..cfe66ad 100644
--- a/ELF/LinkerScript.cpp
+++ b/ELF/LinkerScript.cpp
@@ -202,11 +202,12 @@ void LinkerScript<ELFT>::createSections(
 
   auto Add = [&](StringRef OutputName, const InputSectionDescription *Cmd) {
     std::vector<InputSectionBase<ELFT> *> Sections = getInputSections(Cmd);
-    for (InputSectionBase<ELFT> *S : Sections) {
-      if (OutputName == "/DISCARD/") {
+    if (OutputName == "/DISCARD/") {
+      for (InputSectionBase<ELFT> *S : Sections) {
         S->Live = false;
         reportDiscarded(S);
       }
+      return;
     }
     if (Cmd->Sort != SortKind::None)
       std::stable_sort(Sections.begin(), Sections.end(),


More information about the llvm-commits mailing list