[lld] r283229 - Add a comment.

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 4 09:47:49 PDT 2016


Author: ruiu
Date: Tue Oct  4 11:47:49 2016
New Revision: 283229

URL: http://llvm.org/viewvc/llvm-project?rev=283229&view=rev
Log:
Add a comment.

Modified:
    lld/trunk/ELF/InputFiles.cpp

Modified: lld/trunk/ELF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=283229&r1=283228&r2=283229&view=diff
==============================================================================
--- lld/trunk/ELF/InputFiles.cpp (original)
+++ lld/trunk/ELF/InputFiles.cpp Tue Oct  4 11:47:49 2016
@@ -226,7 +226,10 @@ void elf::ObjectFile<ELFT>::initializeSe
     if (Sections[I] == &InputSection<ELFT>::Discarded)
       continue;
 
-    if (!Config->Relocatable && (Sec.sh_flags & SHF_EXCLUDE)) {
+    // SHF_EXCLUDE'ed sections are discarded by the linker. However,
+    // if -r is given, we'll let the final link discard such sections.
+    // This is compatible with GNU.
+    if ((Sec.sh_flags & SHF_EXCLUDE) && !Config->Relocatable) {
       Sections[I] = &InputSection<ELFT>::Discarded;
       continue;
     }




More information about the llvm-commits mailing list