Skip to content

Commit f6056d1

Browse files
committed
fix formatting issues
1 parent ca2d695 commit f6056d1

File tree

5 files changed

+14
-29
lines changed

5 files changed

+14
-29
lines changed

lld/wasm/Driver.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -963,8 +963,7 @@ static void createSyntheticSymbols() {
963963
// See:
964964
// https://github.com/WebAssembly/tool-conventions/blob/main/DynamicLinking.md
965965
auto *globalType = is64 ? &globalTypeI64 : &globalTypeI32;
966-
ctx.sym.memoryBase =
967-
createUndefinedGlobal("__memory_base", globalType);
966+
ctx.sym.memoryBase = createUndefinedGlobal("__memory_base", globalType);
968967
ctx.sym.tableBase = createUndefinedGlobal("__table_base", globalType);
969968
ctx.sym.memoryBase->markLive();
970969
ctx.sym.tableBase->markLive();
@@ -1000,14 +999,11 @@ static void createOptionalSymbols() {
1000999
ctx.sym.globalBase = symtab->addOptionalDataSymbol("__global_base");
10011000
ctx.sym.heapBase = symtab->addOptionalDataSymbol("__heap_base");
10021001
ctx.sym.heapEnd = symtab->addOptionalDataSymbol("__heap_end");
1003-
ctx.sym.definedMemoryBase =
1004-
symtab->addOptionalDataSymbol("__memory_base");
1005-
ctx.sym.definedTableBase =
1006-
symtab->addOptionalDataSymbol("__table_base");
1002+
ctx.sym.definedMemoryBase = symtab->addOptionalDataSymbol("__memory_base");
1003+
ctx.sym.definedTableBase = symtab->addOptionalDataSymbol("__table_base");
10071004
}
10081005

1009-
ctx.sym.firstPageEnd =
1010-
symtab->addOptionalDataSymbol("__wasm_first_page_end");
1006+
ctx.sym.firstPageEnd = symtab->addOptionalDataSymbol("__wasm_first_page_end");
10111007
if (ctx.sym.firstPageEnd)
10121008
ctx.sym.firstPageEnd->setVA(ctx.arg.pageSize);
10131009

lld/wasm/InputChunks.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,7 @@ bool InputChunk::generateRelocationCode(raw_ostream &os) const {
413413
if (isTLS())
414414
writeUleb128(os, ctx.sym.tlsBase->getGlobalIndex(), "tls_base");
415415
else
416-
writeUleb128(os, ctx.sym.memoryBase->getGlobalIndex(),
417-
"memory_base");
416+
writeUleb128(os, ctx.sym.memoryBase->getGlobalIndex(), "memory_base");
418417
writeU8(os, opcode_ptr_add, "ADD");
419418
}
420419

lld/wasm/OutputSections.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,7 @@ void DataSection::finalizeContents() {
137137
if (ctx.isPic) {
138138
assert(segment->startVA == 0);
139139
initExpr.Inst.Opcode = WASM_OPCODE_GLOBAL_GET;
140-
initExpr.Inst.Value.Global =
141-
ctx.sym.memoryBase->getGlobalIndex();
140+
initExpr.Inst.Value.Global = ctx.sym.memoryBase->getGlobalIndex();
142141
} else {
143142
initExpr = intConst(segment->startVA, is64);
144143
}

lld/wasm/SyntheticSections.cpp

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -445,8 +445,7 @@ void GlobalSection::generateRelocationCode(raw_ostream &os, bool TLS) const {
445445
if (sym->isTLS())
446446
writeUleb128(os, ctx.sym.tlsBase->getGlobalIndex(), "__tls_base");
447447
else
448-
writeUleb128(os, ctx.sym.memoryBase->getGlobalIndex(),
449-
"__memory_base");
448+
writeUleb128(os, ctx.sym.memoryBase->getGlobalIndex(), "__memory_base");
450449

451450
// Add the virtual address of the data symbol
452451
writeU8(os, opcode_ptr_const, "CONST");
@@ -456,8 +455,7 @@ void GlobalSection::generateRelocationCode(raw_ostream &os, bool TLS) const {
456455
continue;
457456
// Get __table_base
458457
writeU8(os, WASM_OPCODE_GLOBAL_GET, "GLOBAL_GET");
459-
writeUleb128(os, ctx.sym.tableBase->getGlobalIndex(),
460-
"__table_base");
458+
writeUleb128(os, ctx.sym.tableBase->getGlobalIndex(), "__table_base");
461459

462460
// Add the table index to __table_base
463461
writeU8(os, opcode_ptr_const, "CONST");
@@ -564,14 +562,11 @@ void ExportSection::writeBody() {
564562
writeExport(os, export_);
565563
}
566564

567-
bool StartSection::isNeeded() const {
568-
return ctx.sym.startFunction != nullptr;
569-
}
565+
bool StartSection::isNeeded() const { return ctx.sym.startFunction != nullptr; }
570566

571567
void StartSection::writeBody() {
572568
raw_ostream &os = bodyOutputStream;
573-
writeUleb128(os, ctx.sym.startFunction->getFunctionIndex(),
574-
"function index");
569+
writeUleb128(os, ctx.sym.startFunction->getFunctionIndex(), "function index");
575570
}
576571

577572
void ElemSection::addEntry(FunctionSymbol *sym) {

lld/wasm/Writer.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -936,8 +936,7 @@ static void finalizeIndirectFunctionTable() {
936936

937937
uint32_t tableSize = ctx.arg.tableBase + out.elemSec->numEntries();
938938
WasmLimits limits = {0, tableSize, 0, 0};
939-
if (ctx.sym.indirectFunctionTable->isDefined() &&
940-
!ctx.arg.growableTable) {
939+
if (ctx.sym.indirectFunctionTable->isDefined() && !ctx.arg.growableTable) {
941940
limits.Flags |= WASM_LIMITS_FLAG_HAS_MAX;
942941
limits.Maximum = limits.Minimum;
943942
}
@@ -1286,8 +1285,7 @@ void Writer::createInitMemoryFunction() {
12861285
writeUleb128(os, 2, "local count");
12871286
writeU8(os, is64 ? WASM_TYPE_I64 : WASM_TYPE_I32, "address type");
12881287
writeU8(os, WASM_OPCODE_GLOBAL_GET, "GLOBAL_GET");
1289-
writeUleb128(os, ctx.sym.memoryBase->getGlobalIndex(),
1290-
"memory_base");
1288+
writeUleb128(os, ctx.sym.memoryBase->getGlobalIndex(), "memory_base");
12911289
writePtrConst(os, flagAddress, is64, "flag address");
12921290
writeU8(os, is64 ? WASM_OPCODE_I64_ADD : WASM_OPCODE_I32_ADD, "add");
12931291
writeU8(os, WASM_OPCODE_LOCAL_SET, "local.set");
@@ -1352,8 +1350,7 @@ void Writer::createInitMemoryFunction() {
13521350
writePtrConst(os, s->startVA, is64, "destination address");
13531351
}
13541352
writeU8(os, WASM_OPCODE_GLOBAL_SET, "GLOBAL_SET");
1355-
writeUleb128(os, ctx.sym.tlsBase->getGlobalIndex(),
1356-
"__tls_base");
1353+
writeUleb128(os, ctx.sym.tlsBase->getGlobalIndex(), "__tls_base");
13571354
if (ctx.isPic) {
13581355
writeU8(os, WASM_OPCODE_LOCAL_GET, "local.tee");
13591356
writeUleb128(os, 1, "local 1");
@@ -1584,8 +1581,7 @@ void Writer::createCommandExportWrapper(uint32_t functionIndex,
15841581
// applies any runtime relocations in Emscripten-style PIC mode)
15851582
if (ctx.sym.callCtors->isLive()) {
15861583
writeU8(os, WASM_OPCODE_CALL, "CALL");
1587-
writeUleb128(os, ctx.sym.callCtors->getFunctionIndex(),
1588-
"function index");
1584+
writeUleb128(os, ctx.sym.callCtors->getFunctionIndex(), "function index");
15891585
}
15901586

15911587
// Call the user's code, leaving any return values on the operand stack.

0 commit comments

Comments
 (0)