[PATCH] D40967: [LLD][ELF] Remove Duplicate .ARM.exidx sections

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 11 21:53:01 PST 2017


ruiu added inline comments.


================
Comment at: ELF/Driver.cpp:627
   Config->NoGnuUnique = Args.hasArg(OPT_no_gnu_unique);
+  Config->NoMergeArmExidx = Args.hasArg(OPT_no_merge_exidx_entries);
   Config->NoUndefinedVersion = Args.hasArg(OPT_no_undefined_version);
----------------
Can you also add -merge-exidx-entries as well and make it the primary option (i.e. add Config->MergeArmExidx instead of NoMergeArmExidx).


================
Comment at: ELF/Writer.cpp:1162
 
+// The .ARM.exidx section is of the form:
+// | PREL31 offset to function | Unwind instructions for function |
----------------
Please mention that this is for --merge-exidx-entries and this is ARM only.


================
Comment at: ELF/Writer.cpp:1200
+    // Exidx sentinel section has implicit EXIDX_CANTUNWIND;
+    return (PrevEntry.Unwind == 0x1);
+
----------------
nit: remove () after return.


================
Comment at: ELF/Writer.cpp:1205
+      Cur->getSize() / sizeof(ExidxEntry));
+  for (const ExidxEntry Entry : Entries) {
+    if (IsExtabRef(Entry.Unwind) || Entry.Unwind != PrevEntry.Unwind)
----------------
nit: you can remove {}


================
Comment at: ELF/Writer.cpp:1241-1251
+      int Cur = 1;
+      int Prev = 0;
+      int N = Sections.size();
+      while (Cur < N) {
+        if (isDuplicateArmExidxSec(Sections[Prev], Sections[Cur])) {
+          Sections[Cur] = nullptr;
+          RemoveSections = true;
----------------
I wonder if you can use std::unique to remove consecutive duplicate list elements.


https://reviews.llvm.org/D40967





More information about the llvm-commits mailing list