[lld] r359137 - [COFF] Don't emit .gfids sections when CFG is off
Reid Kleckner via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 24 13:38:38 PDT 2019
Author: rnk
Date: Wed Apr 24 13:38:37 2019
New Revision: 359137
URL: http://llvm.org/viewvc/llvm-project?rev=359137&view=rev
Log:
[COFF] Don't emit .gfids sections when CFG is off
Put them on the list of GuardFidChunks instead of the main Chunks list,
even with CFG is off. It will be ignored if CFG is disabled.
Modified:
lld/trunk/COFF/InputFiles.cpp
lld/trunk/test/COFF/gfids-icf.s
Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=359137&r1=359136&r2=359137&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Wed Apr 24 13:38:37 2019
@@ -208,9 +208,9 @@ SectionChunk *ObjFile::readSection(uint3
// linked in the regular manner.
if (C->isCodeView())
DebugChunks.push_back(C);
- else if (Config->GuardCF != GuardCFLevel::Off && Name == ".gfids$y")
+ else if (Name == ".gfids$y")
GuardFidChunks.push_back(C);
- else if (Config->GuardCF != GuardCFLevel::Off && Name == ".gljmp$y")
+ else if (Name == ".gljmp$y")
GuardLJmpChunks.push_back(C);
else if (Name == ".sxdata")
SXDataChunks.push_back(C);
Modified: lld/trunk/test/COFF/gfids-icf.s
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/test/COFF/gfids-icf.s?rev=359137&r1=359136&r2=359137&view=diff
==============================================================================
--- lld/trunk/test/COFF/gfids-icf.s (original)
+++ lld/trunk/test/COFF/gfids-icf.s Wed Apr 24 13:38:37 2019
@@ -35,6 +35,16 @@
# CHECK-NEXT: 0x14000{{.*}}
# CHECK-NEXT: ]
+# There should be no .gfids section in the output exectuable when we link with
+# -guard:cf or with no -guard:cf/nolongjmp flag.
+# RUN: llvm-readobj -sections %t.exe | FileCheck %s --check-prefix NOGFIDSEC
+# RUN: lld-link %t.obj -out:%t.exe -opt:icf -entry:main
+# RUN: llvm-readobj -sections %t.exe | FileCheck %s --check-prefix NOGFIDSEC
+
+# NOGFIDSEC: Sections [
+# NOGFIDSEC: Section {
+# NOGFIDSEC: Name: .text
+# NOGFIDSEC-NOT: Name: .gfids
# Indicate that gfids are present.
.def @feat.00; .scl 3; .type 0; .endef
More information about the llvm-commits
mailing list