Skip to content

Commit 9583f8c

Browse files
committed
Formatting fixes
1 parent e9dcda9 commit 9583f8c

File tree

3 files changed

+34
-23
lines changed

3 files changed

+34
-23
lines changed

lld/ELF/Driver.cpp

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@
6060
#include "llvm/Option/ArgList.h"
6161
#include "llvm/Remarks/HotnessThresholdParser.h"
6262
#include "llvm/Support/CommandLine.h"
63-
#include "llvm/Support/SaveAndRestore.h"
6463
#include "llvm/Support/Compression.h"
6564
#include "llvm/Support/FileSystem.h"
6665
#include "llvm/Support/GlobPattern.h"
6766
#include "llvm/Support/LEB128.h"
6867
#include "llvm/Support/Parallel.h"
6968
#include "llvm/Support/Path.h"
69+
#include "llvm/Support/SaveAndRestore.h"
7070
#include "llvm/Support/TarWriter.h"
7171
#include "llvm/Support/TargetSelect.h"
7272
#include "llvm/Support/TimeProfiler.h"
@@ -407,7 +407,7 @@ static void checkOptions(Ctx &ctx) {
407407
ErrAlways(ctx) << "-z pauth-report only supported on AArch64";
408408
if (ctx.arg.zGcsReport != GcsReportPolicy::None)
409409
ErrAlways(ctx) << "-z gcs-report only supported on AArch64";
410-
if(ctx.arg.zGcsReportDynamic != GcsReportPolicy::None)
410+
if (ctx.arg.zGcsReportDynamic != GcsReportPolicy::None)
411411
ErrAlways(ctx) << "-z gcs-report-dynamic only supported on AArch64";
412412
if (ctx.arg.zGcs != GcsPolicy::Implicit)
413413
ErrAlways(ctx) << "-z gcs only supported on AArch64";
@@ -623,9 +623,10 @@ static GcsReportPolicy getZGcsReportDynamic(Ctx &ctx, opt::InputArgList &args) {
623623
}
624624
// If the user has not defined a value for gcs-report-dynamic, but has for
625625
// gcs-report, we want to inherit that value for gcs-report-dynamic. This is
626-
// capped at a warning to ensure a users module can still build, while providing
627-
// information relating to if a dynamic object supports GCS.
628-
if (kv.first == "gcs-report" && (kv.second == "warning" || kv.second == "error"))
626+
// capped at a warning to ensure a users module can still build, while
627+
// providing information relating to if a dynamic object supports GCS.
628+
if (kv.first == "gcs-report" &&
629+
(kv.second == "warning" || kv.second == "error"))
629630
ret = GcsReportPolicy::Warning;
630631
}
631632

@@ -2890,11 +2891,12 @@ static void readSecurityNotes(Ctx &ctx) {
28902891
return {ctx, DiagLevel::None};
28912892
return report(config);
28922893
};
2893-
auto reportGcsPolicy = [&](GcsReportPolicy config, bool cond) -> ELFSyncStream {
2894+
auto reportGcsPolicy = [&](GcsReportPolicy config,
2895+
bool cond) -> ELFSyncStream {
28942896
if (cond)
28952897
return {ctx, DiagLevel::None};
28962898
StringRef configString = "none";
2897-
if(config == GcsReportPolicy::Warning)
2899+
if (config == GcsReportPolicy::Warning)
28982900
configString = "warning";
28992901
else if (config == GcsReportPolicy::Error)
29002902
configString = "error";
@@ -2910,7 +2912,7 @@ static void readSecurityNotes(Ctx &ctx) {
29102912
"GNU_PROPERTY_AARCH64_FEATURE_1_BTI property";
29112913

29122914
reportGcsPolicy(ctx.arg.zGcsReport,
2913-
features & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)
2915+
features & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)
29142916
<< f
29152917
<< ": -z gcs-report: file does not have "
29162918
"GNU_PROPERTY_AARCH64_FEATURE_1_GCS property";
@@ -2980,15 +2982,21 @@ static void readSecurityNotes(Ctx &ctx) {
29802982
else if (ctx.arg.zGcs == GcsPolicy::Never)
29812983
ctx.arg.andFeatures &= ~GNU_PROPERTY_AARCH64_FEATURE_1_GCS;
29822984

2983-
// If we are utilising GCS at any stage, the sharedFiles should be checked to ensure they also support this feature.
2984-
// The gcs-report-dynamic option is used to indicate if the user wants information relating to this, and will be set
2985-
// depending on the user's input, or warning if gcs-report is set to either `warning` or `error`.
2986-
if(ctx.arg.andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)
2985+
// If we are utilising GCS at any stage, the sharedFiles should be checked to
2986+
// ensure they also support this feature. The gcs-report-dynamic option is
2987+
// used to indicate if the user wants information relating to this, and will
2988+
// be set depending on the user's input, or warning if gcs-report is set to
2989+
// either `warning` or `error`.
2990+
if (ctx.arg.andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)
29872991
for (SharedFile *f : ctx.sharedFiles)
2988-
reportGcsPolicy(ctx.arg.zGcsReportDynamic, f->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_GCS) << f
2989-
<< ": GCS is required by -z gcs, but this shared library lacks the necessary property note. The "
2990-
<< "dynamic loader might not enable GCS or refuse to load the program unless all shared library "
2991-
<< "dependancies have the GCS marking.";
2992+
reportGcsPolicy(ctx.arg.zGcsReportDynamic,
2993+
f->andFeatures & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)
2994+
<< f
2995+
<< ": GCS is required by -z gcs, but this shared library lacks the "
2996+
"necessary property note. The "
2997+
<< "dynamic loader might not enable GCS or refuse to load the "
2998+
"program unless all shared library "
2999+
<< "dependancies have the GCS marking.";
29923000
}
29933001

29943002
static void initSectionsAndLocalSyms(ELFFileBase *file, bool ignoreComdats) {

lld/ELF/InputFiles.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,16 +1425,19 @@ std::vector<uint32_t> SharedFile::parseVerneed(const ELFFile<ELFT> &obj,
14251425
return verneeds;
14261426
}
14271427

1428-
// To determine if a shared file can support the AArch64 GCS extension, the program headers for the object
1429-
// need to be read. This ensures when input options are read, appropriate warning/error messages can be
1430-
// emitted depending on the user's command line options.
1428+
// To determine if a shared file can support the AArch64 GCS extension, the
1429+
// program headers for the object need to be read. This ensures when input
1430+
// options are read, appropriate warning/error messages can be emitted depending
1431+
// on the user's command line options.
14311432
template <typename ELFT>
1432-
uint64_t SharedFile::parseGnuAttributes(const typename ELFT::PhdrRange headers) {
1433-
if(numElfPhdrs == 0)
1433+
uint64_t
1434+
SharedFile::parseGnuAttributes(const typename ELFT::PhdrRange headers) {
1435+
if (numElfPhdrs == 0)
14341436
return 0;
14351437
uint64_t attributes = 0;
14361438
for (unsigned i = 0; i < numElfPhdrs; i++)
1437-
if(headers[i].p_type == PT_GNU_PROPERTY && headers[i].p_flags & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)
1439+
if (headers[i].p_type == PT_GNU_PROPERTY &&
1440+
headers[i].p_flags & GNU_PROPERTY_AARCH64_FEATURE_1_GCS)
14381441
attributes |= GNU_PROPERTY_AARCH64_FEATURE_1_GCS;
14391442

14401443
return attributes;

lld/ELF/InputFiles.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ class ELFFileBase : public InputFile {
208208
}
209209
template <typename ELFT> typename ELFT::PhdrRange getELFPhdrs() const {
210210
return typename ELFT::PhdrRange(
211-
reinterpret_cast<const typename ELFT::Phdr *>(elfPhdrs), numElfPhdrs);
211+
reinterpret_cast<const typename ELFT::Phdr *>(elfPhdrs), numElfPhdrs);
212212
}
213213
template <typename ELFT> typename ELFT::SymRange getELFSyms() const {
214214
return typename ELFT::SymRange(

0 commit comments

Comments
 (0)