[prev in list] [next in list] [prev in thread] [next in thread]
List: llvm-commits
Subject: [PATCH] D112871: [lld/coff] Add parsing for /pdbpagesize: flag
From: Nico Weber via Phabricator via llvm-commits <llvm-commits () lists ! llvm ! org>
Date: 2021-10-31 22:36:40
Message-ID: znJICmFuSvaF6SrAuL8yKA () ismtpd0218p1mdw1 ! sendgrid ! net
[Download RAW message or body]
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf964ca896f5e: [lld/coff] Add parsing for /pdbpagesize: f=
lag (authored by thakis).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D112871/new/
https://reviews.llvm.org/D112871
Files:
lld/COFF/Config.h
lld/COFF/Driver.cpp
lld/COFF/Driver.h
lld/COFF/DriverUtils.cpp
lld/COFF/Options.td
lld/COFF/PDB.cpp
lld/test/COFF/pdbpagesize.test
llvm/include/llvm/DebugInfo/MSF/MSFCommon.h
["D112871.383690.patch" (D112871.383690.patch)]
Index: llvm/include/llvm/DebugInfo/MSF/MSFCommon.h
===================================================================
--- llvm/include/llvm/DebugInfo/MSF/MSFCommon.h
+++ llvm/include/llvm/DebugInfo/MSF/MSFCommon.h
@@ -93,6 +93,9 @@
case 1024:
case 2048:
case 4096:
+ case 8192:
+ case 16384:
+ case 32768:
return true;
}
return false;
Index: lld/test/COFF/pdbpagesize.test
===================================================================
--- /dev/null
+++ lld/test/COFF/pdbpagesize.test
@@ -0,0 +1,15 @@
+# RUN: yaml2obj %p/Inputs/empty.yaml -o %t.obj
+
+# RUN: not lld-link /entry:main %t.obj /out:%t.exe /debug /pdbpagesize:hi 2>&1 \
+# RUN: | FileCheck --check-prefix=INVALID %s
+# RUN: not lld-link /entry:main %t.obj /out:%t.exe /debug /pdbpagesize:15 2>&1 \
+# RUN: | FileCheck --check-prefix=INVALID %s
+# INVALID: error: /pdbpagesize: invalid argument:
+
+# RUN: lld-link /entry:main %t.obj /out:%t.exe /debug /pdbpagesize:4096
+# RUN: llvm-pdbutil pdb2yaml %t.pdb | FileCheck --check-prefix=PAGE4096 %s
+# PAGE4096: BlockSize: 4096
+
+# RUN: lld-link /entry:main %t.obj /out:%t.exe /debug /pdbpagesize:8192 2>&1 \
+# RUN: | FileCheck --check-prefix=TODO %s
+# TODO: warning: /pdbpagesize: page sizes != 4096 not yet implemented, ignoring flag
Index: lld/COFF/PDB.cpp
===================================================================
--- lld/COFF/PDB.cpp
+++ lld/COFF/PDB.cpp
@@ -1588,7 +1588,7 @@
}
void PDBLinker::initialize(llvm::codeview::DebugInfo *buildId) {
- exitOnErr(builder.initialize(4096)); // 4096 is blocksize
+ exitOnErr(builder.initialize(config->pdbPageSize));
buildId->Signature.CVSignature = OMF::Signature::PDB70;
// Signature is set to a hash of the PDB contents when the PDB is done.
Index: lld/COFF/Options.td
===================================================================
--- lld/COFF/Options.td
+++ lld/COFF/Options.td
@@ -78,8 +78,9 @@
def out : P<"out", "Path to file to write output">;
def natvis : P<"natvis", "Path to natvis file to embed in the PDB">;
def pdb : P<"pdb", "PDB file path">;
-def pdbstripped : P<"pdbstripped", "Stripped PDB file path">;
def pdbaltpath : P<"pdbaltpath", "PDB file path to embed in the image">;
+def pdbpagesize : P<"pdbpagesize", "PDB page size">;
+def pdbstripped : P<"pdbstripped", "Stripped PDB file path">;
def pdbstream : Joined<["/", "-", "/?", "-?"], "pdbstream:">,
MetaVarName<"<name>=<file>">,
HelpText<"Embed the contents of <file> in the PDB as named stream <name>">;
Index: lld/COFF/DriverUtils.cpp
===================================================================
--- lld/COFF/DriverUtils.cpp
+++ lld/COFF/DriverUtils.cpp
@@ -175,6 +175,26 @@
}
}
+void parsePDBPageSize(StringRef s) {
+ int v;
+ if (s.getAsInteger(0, v)) {
+ error("/pdbpagesize: invalid argument: " + s);
+ return;
+ }
+ if (v != 4096 && v != 8192 && v != 16384 && v != 32768) {
+ error("/pdbpagesize: invalid argument: " + s);
+ return;
+ }
+
+ // FIXME: Remove this once other page sizes work.
+ if (v != 4096) {
+ warn("/pdbpagesize: page sizes != 4096 not yet implemented, ignoring flag");
+ v = 4096;
+ }
+
+ config->pdbPageSize = v;
+}
+
static uint32_t parseSectionAttributes(StringRef s) {
uint32_t ret = 0;
for (char c : s.lower()) {
Index: lld/COFF/Driver.h
===================================================================
--- lld/COFF/Driver.h
+++ lld/COFF/Driver.h
@@ -176,6 +176,7 @@
void parseAlternateName(StringRef);
void parseMerge(StringRef);
+void parsePDBPageSize(StringRef);
void parseSection(StringRef);
void parseAligncomm(StringRef);
Index: lld/COFF/Driver.cpp
===================================================================
--- lld/COFF/Driver.cpp
+++ lld/COFF/Driver.cpp
@@ -1428,6 +1428,8 @@
config->pdbPath = arg->getValue();
if (auto *arg = args.getLastArg(OPT_pdbaltpath))
config->pdbAltPath = arg->getValue();
+ if (auto *arg = args.getLastArg(OPT_pdbpagesize))
+ parsePDBPageSize(arg->getValue());
if (args.hasArg(OPT_natvis))
config->natvisFiles = args.getAllArgValues(OPT_natvis);
if (args.hasArg(OPT_pdbstream)) {
Index: lld/COFF/Config.h
===================================================================
--- lld/COFF/Config.h
+++ lld/COFF/Config.h
@@ -124,6 +124,7 @@
std::vector<std::string> natvisFiles;
llvm::StringMap<std::string> namedStreams;
llvm::SmallString<128> pdbAltPath;
+ int pdbPageSize = 4096;
llvm::SmallString<128> pdbPath;
llvm::SmallString<128> pdbSourcePath;
std::vector<llvm::StringRef> argv;
[Attachment #4 (text/plain)]
_______________________________________________
llvm-commits mailing list
llvm-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic