Skip to content

Commit 7d13775

Browse files
committed
[ELF] Pass ctx &
1 parent 4a67b93 commit 7d13775

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

lld/ELF/DriverUtils.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ static cl::TokenizerCallback getQuotingStyle(Ctx &ctx,
8989
// `--plugin-opt <foo>` is converted to `--plugin-opt=<foo>`. This is a
9090
// bit hacky, but looks like it is still better than handling --plugin-opt
9191
// options by hand.
92-
static void concatLTOPluginOptions(SmallVectorImpl<const char *> &args) {
92+
static void concatLTOPluginOptions(Ctx &ctx,
93+
SmallVectorImpl<const char *> &args) {
9394
SmallVector<const char *, 256> v;
9495
for (size_t i = 0, e = args.size(); i != e; ++i) {
9596
StringRef s = args[i];
@@ -118,7 +119,7 @@ opt::InputArgList ELFOptTable::parse(Ctx &ctx, ArrayRef<const char *> argv) {
118119
// Expand response files (arguments in the form of @<filename>)
119120
// and then parse the argument again.
120121
cl::ExpandResponseFiles(saver(ctx), getQuotingStyle(ctx, args), vec);
121-
concatLTOPluginOptions(vec);
122+
concatLTOPluginOptions(ctx, vec);
122123
args = this->ParseArgs(vec, missingIndex, missingCount);
123124

124125
handleColorDiagnostics(ctx, args);

lld/ELF/SyntheticSections.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ static void writeUint(Ctx &ctx, uint8_t *buf, uint64_t val) {
7171
}
7272

7373
// Returns an LLD version string.
74-
static ArrayRef<uint8_t> getVersion() {
74+
static ArrayRef<uint8_t> getVersion(Ctx &ctx) {
7575
// Check LLD_VERSION first for ease of testing.
7676
// You can get consistent output by using the environment variable.
7777
// This is only for testing.
@@ -88,8 +88,9 @@ static ArrayRef<uint8_t> getVersion() {
8888
// by "readelf --string-dump .comment <file>".
8989
// The returned object is a mergeable string section.
9090
MergeInputSection *elf::createCommentSection(Ctx &ctx) {
91-
auto *sec = make<MergeInputSection>(
92-
ctx, SHF_MERGE | SHF_STRINGS, SHT_PROGBITS, 1, getVersion(), ".comment");
91+
auto *sec =
92+
make<MergeInputSection>(ctx, SHF_MERGE | SHF_STRINGS, SHT_PROGBITS, 1,
93+
getVersion(ctx), ".comment");
9394
sec->splitIntoPieces();
9495
return sec;
9596
}

0 commit comments

Comments
 (0)