diff options
author | Reid Kleckner <rnk@google.com> | 2019-04-24 20:38:37 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2019-04-24 20:38:37 +0000 |
commit | 54c8182a3f619e272cd9a07e706752af8e62da99 (patch) | |
tree | 9d60e435769dca2621ed0e036103bbd6a931018c | |
parent | ef3c1884ecd41305714e1ac4b0887d886c7a2b88 (diff) | |
download | bcm5719-llvm-54c8182a3f619e272cd9a07e706752af8e62da99.tar.gz bcm5719-llvm-54c8182a3f619e272cd9a07e706752af8e62da99.zip |
[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.
llvm-svn: 359137
-rw-r--r-- | lld/COFF/InputFiles.cpp | 4 | ||||
-rw-r--r-- | lld/test/COFF/gfids-icf.s | 10 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index 2fa2f03fc47..7de4c255a14 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -208,9 +208,9 @@ SectionChunk *ObjFile::readSection(uint32_t SectionNumber, // 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); diff --git a/lld/test/COFF/gfids-icf.s b/lld/test/COFF/gfids-icf.s index b0b4d7019fc..5edbbc76ea3 100644 --- a/lld/test/COFF/gfids-icf.s +++ b/lld/test/COFF/gfids-icf.s @@ -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 |