[PATCH] D112643: [lld/mac] Don't crash on undefined symbols with --icf=all

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 27 13:26:08 PDT 2021


This revision was automatically updated to reflect the committed changes.
Closed by commit rG7f369304dfe9: [lld/mac] Don't crash on undefined symbols with --icf=all (authored by thakis).
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112643/new/

https://reviews.llvm.org/D112643

Files:
  lld/MachO/ICF.cpp
  lld/test/MachO/invalid/undefined-symbol.s


Index: lld/test/MachO/invalid/undefined-symbol.s
===================================================================
--- lld/test/MachO/invalid/undefined-symbol.s
+++ lld/test/MachO/invalid/undefined-symbol.s
@@ -3,7 +3,7 @@
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/main.s -o %t/main.o
 # RUN: llvm-mc -filetype=obj -triple=x86_64-apple-darwin %t/foo.s -o %t/foo.o
 # RUN: llvm-ar crs %t/foo.a %t/foo.o
-# RUN: not %lld -o /dev/null %t/main.o 2>&1 | \
+# RUN: not %lld --icf=all -o /dev/null %t/main.o 2>&1 | \
 # RUN:     FileCheck %s -DSYM=_foo -DFILENAME=%t/main.o
 # RUN: not %lld -o /dev/null %t/main.o %t/foo.a 2>&1 | \
 # RUN:     FileCheck %s -DSYM=_bar -DFILENAME='%t/foo.a(foo.o)'
Index: lld/MachO/ICF.cpp
===================================================================
--- lld/MachO/ICF.cpp
+++ lld/MachO/ICF.cpp
@@ -246,7 +246,7 @@
             } else {
               hash += defined->value;
             }
-          } else
+          } else if (!isa<Undefined>(sym))
             llvm_unreachable("foldIdenticalSections symbol kind");
         }
       }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D112643.382767.patch
Type: text/x-patch
Size: 1094 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211027/faa4d43a/attachment.bin>


More information about the llvm-commits mailing list