[clang] 5bb5142 - Revert [CodeView] Emit S_OBJNAME record
Alexandre Ganea via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 21 16:02:22 PST 2021
Author: Alexandre Ganea
Date: 2021-12-21T19:02:14-05:00
New Revision: 5bb5142e80c9c6eb1a948d6d2ff4834e4e69741f
URL: https://github.com/llvm/llvm-project/commit/5bb5142e80c9c6eb1a948d6d2ff4834e4e69741f
DIFF: https://github.com/llvm/llvm-project/commit/5bb5142e80c9c6eb1a948d6d2ff4834e4e69741f.diff
LOG: Revert [CodeView] Emit S_OBJNAME record
Also revert all subsequent fixes:
- abd1cbf5e543f0f114d2742e109ead7d7ddbf9c4 [Clang] Disable debug-info-objname.cpp test on Unix until I sort out the issue.
- 00ec441253048f5e30540ea26bb0a28c42a5fc18 [Clang] debug-info-objname.cpp test: explictly encode a x86 target when using %clang_cl to avoid falling back to a native CPU triple.
- cd407f6e52b09cce2bef24c74b7f36fedc94991b [Clang] Fix build by restricting debug-info-objname.cpp test to x86.
Added:
Modified:
clang/include/clang/Basic/CodeGenOptions.h
clang/include/clang/Driver/Job.h
clang/include/clang/Driver/Options.td
clang/lib/CodeGen/BackendUtil.cpp
clang/lib/Driver/ToolChains/Clang.cpp
clang/test/CMakeLists.txt
llvm/include/llvm/MC/MCTargetOptions.h
llvm/include/llvm/Support/Caching.h
llvm/include/llvm/Support/ToolOutputFile.h
llvm/include/llvm/Target/TargetOptions.h
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
llvm/lib/LTO/LTOBackend.cpp
llvm/lib/Support/Caching.cpp
llvm/test/DebugInfo/COFF/globals.ll
llvm/test/DebugInfo/COFF/multifunction.ll
llvm/test/DebugInfo/COFF/pr28747.ll
llvm/test/DebugInfo/COFF/simple.ll
llvm/test/DebugInfo/COFF/vframe-fpo.ll
llvm/test/MC/AArch64/coff-debug.ll
llvm/test/MC/ARM/coff-debugging-secrel.ll
llvm/test/MC/COFF/cv-compiler-info.ll
llvm/tools/llc/llc.cpp
llvm/tools/llvm-lto2/llvm-lto2.cpp
Removed:
clang/test/CodeGenCXX/debug-info-objname.cpp
################################################################################
diff --git a/clang/include/clang/Basic/CodeGenOptions.h b/clang/include/clang/Basic/CodeGenOptions.h
index 33ec03a171362..960aa419b490e 100644
--- a/clang/include/clang/Basic/CodeGenOptions.h
+++ b/clang/include/clang/Basic/CodeGenOptions.h
@@ -227,9 +227,6 @@ class CodeGenOptions : public CodeGenOptionsBase {
/// Output filename for the split debug info, not used in the skeleton CU.
std::string SplitDwarfOutput;
- /// Output filename used in the COFF debug information.
- std::string ObjectFilenameForDebug;
-
/// The name of the relocation model to use.
llvm::Reloc::Model RelocationModel;
diff --git a/clang/include/clang/Driver/Job.h b/clang/include/clang/Driver/Job.h
index 6e3b51f2a7995..8b287638a271d 100644
--- a/clang/include/clang/Driver/Job.h
+++ b/clang/include/clang/Driver/Job.h
@@ -204,10 +204,6 @@ class Command {
/// from the parent process will be used.
virtual void setEnvironment(llvm::ArrayRef<const char *> NewEnvironment);
- void replaceArguments(llvm::opt::ArgStringList List) {
- Arguments = std::move(List);
- }
-
const char *getExecutable() const { return Executable; }
const llvm::opt::ArgStringList &getArguments() const { return Arguments; }
diff --git a/clang/include/clang/Driver/Options.td b/clang/include/clang/Driver/Options.td
index 08e9e1a3432ae..3b47512501d39 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -3802,11 +3802,6 @@ def o : JoinedOrSeparate<["-"], "o">, Flags<[NoXarchOption, RenderAsInput,
CC1Option, CC1AsOption, FC1Option, FlangOption]>,
HelpText<"Write output to <file>">, MetaVarName<"<file>">,
MarshallingInfoString<FrontendOpts<"OutputFile">>;
-def object_file_name_EQ : Joined<["-"], "object-file-name=">, Flags<[CC1Option, CC1AsOption, CoreOption]>,
- HelpText<"Set the output <file> for debug infos">, MetaVarName<"<file>">,
- MarshallingInfoString<CodeGenOpts<"ObjectFilenameForDebug">>;
-def object_file_name : Separate<["-"], "object-file-name">, Flags<[CC1Option, CC1AsOption, CoreOption]>,
- Alias<object_file_name_EQ>;
def pagezero__size : JoinedOrSeparate<["-"], "pagezero_size">;
def pass_exit_codes : Flag<["-", "--"], "pass-exit-codes">, Flags<[Unsupported]>;
def pedantic_errors : Flag<["-", "--"], "pedantic-errors">, Group<pedantic_Group>, Flags<[CC1Option]>,
diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 5e16d3525b383..3195615ae561c 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -646,7 +646,6 @@ static bool initTargetOptions(DiagnosticsEngine &Diags,
Options.MCOptions.Argv0 = CodeGenOpts.Argv0;
Options.MCOptions.CommandLineArgs = CodeGenOpts.CommandLineArgs;
Options.DebugStrictDwarf = CodeGenOpts.DebugStrictDwarf;
- Options.ObjectFilenameForDebug = CodeGenOpts.ObjectFilenameForDebug;
return true;
}
@@ -1584,8 +1583,7 @@ static void runThinLTOBackend(
return;
auto AddStream = [&](size_t Task) {
- return std::make_unique<CachedFileStream>(std::move(OS),
- CGOpts.ObjectFilenameForDebug);
+ return std::make_unique<CachedFileStream>(std::move(OS));
};
lto::Config Conf;
if (CGOpts.SaveTempsFilePrefix != "") {
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index 2a3723975568b..d76f810f1a7f0 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -625,9 +625,8 @@ getFramePointerKind(const ArgList &Args, const llvm::Triple &Triple) {
}
/// Add a CC1 option to specify the debug compilation directory.
-static const char *addDebugCompDirArg(const ArgList &Args,
- ArgStringList &CmdArgs,
- const llvm::vfs::FileSystem &VFS) {
+static void addDebugCompDirArg(const ArgList &Args, ArgStringList &CmdArgs,
+ const llvm::vfs::FileSystem &VFS) {
if (Arg *A = Args.getLastArg(options::OPT_ffile_compilation_dir_EQ,
options::OPT_fdebug_compilation_dir_EQ)) {
if (A->getOption().matches(options::OPT_ffile_compilation_dir_EQ))
@@ -639,31 +638,6 @@ static const char *addDebugCompDirArg(const ArgList &Args,
VFS.getCurrentWorkingDirectory()) {
CmdArgs.push_back(Args.MakeArgString("-fdebug-compilation-dir=" + *CWD));
}
- StringRef Path(CmdArgs.back());
- return Path.substr(Path.find('=') + 1).data();
-}
-
-static void addDebugObjectName(const ArgList &Args, ArgStringList &CmdArgs,
- const char *DebugCompilationDir,
- const char *OutputFileName) {
- // No need to generate a value for -object-file-name if it was provided.
- for (auto *Arg : Args.filtered(options::OPT_Xclang))
- if (StringRef(Arg->getValue()).startswith("-object-file-name"))
- return;
-
- if (Args.hasArg(options::OPT_object_file_name_EQ))
- return;
-
- SmallString<128> ObjFileNameForDebug(OutputFileName);
- if (ObjFileNameForDebug != "-" &&
- !llvm::sys::path::is_absolute(ObjFileNameForDebug) &&
- (!DebugCompilationDir ||
- llvm::sys::path::is_absolute(DebugCompilationDir))) {
- // Make the path absolute in the debug infos like MSVC does.
- llvm::sys::fs::make_absolute(ObjFileNameForDebug);
- }
- CmdArgs.push_back(
- Args.MakeArgString(Twine("-object-file-name=") + ObjFileNameForDebug));
}
/// Add a CC1 and CC1AS option to specify the debug file path prefix map.
@@ -5675,8 +5649,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("-fno-autolink");
// Add in -fdebug-compilation-dir if necessary.
- const char *DebugCompilationDir =
- addDebugCompDirArg(Args, CmdArgs, D.getVFS());
+ addDebugCompDirArg(Args, CmdArgs, D.getVFS());
addDebugPrefixMapArg(D, Args, CmdArgs);
@@ -7048,11 +7021,6 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back(Args.MakeArgString(Str));
}
- // Add the output path to the object file for CodeView debug infos.
- if (EmitCodeView && Output.isFilename())
- addDebugObjectName(Args, CmdArgs, DebugCompilationDir,
- Output.getFilename());
-
// Add the "-o out -x type src.c" flags last. This is done primarily to make
// the -cc1 command easier to edit when reproducing compiler crashes.
if (Output.getType() == types::TY_Dependencies) {
@@ -7670,14 +7638,11 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddAllArgs(CmdArgs, options::OPT_I_Group);
// Determine the original source input.
- auto FindSource = [](const Action *S) -> const Action * {
- while (S->getKind() != Action::InputClass) {
- assert(!S->getInputs().empty() && "unexpected root action!");
- S = S->getInputs()[0];
- }
- return S;
- };
- const Action *SourceAction = FindSource(&JA);
+ const Action *SourceAction = &JA;
+ while (SourceAction->getKind() != Action::InputClass) {
+ assert(!SourceAction->getInputs().empty() && "unexpected root action!");
+ SourceAction = SourceAction->getInputs()[0];
+ }
// Forward -g and handle debug info related flags, assuming we are dealing
// with an actual assembly file.
@@ -7696,10 +7661,6 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
codegenoptions::DebugInfoKind DebugInfoKind = codegenoptions::NoDebugInfo;
- // Add the -fdebug-compilation-dir flag if needed.
- const char *DebugCompilationDir =
- addDebugCompDirArg(Args, CmdArgs, C.getDriver().getVFS());
-
if (SourceAction->getType() == types::TY_Asm ||
SourceAction->getType() == types::TY_PP_Asm) {
// You might think that it would be ok to set DebugInfoKind outside of
@@ -7708,6 +7669,8 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
// and it's not clear whether that test is just overly restrictive.
DebugInfoKind = (WantDebug ? codegenoptions::DebugInfoConstructor
: codegenoptions::NoDebugInfo);
+ // Add the -fdebug-compilation-dir flag if needed.
+ addDebugCompDirArg(Args, CmdArgs, C.getDriver().getVFS());
addDebugPrefixMapArg(getToolChain().getDriver(), Args, CmdArgs);
@@ -7818,29 +7781,6 @@ void ClangAs::ConstructJob(Compilation &C, const JobAction &JA,
Args.AddAllArgs(CmdArgs, options::OPT_mllvm);
- if (DebugInfoKind > codegenoptions::NoDebugInfo && Output.isFilename())
- addDebugObjectName(Args, CmdArgs, DebugCompilationDir,
- Output.getFilename());
-
- // Fixup any previous commands that use -object-file-name because when we
- // generated them, the final .obj name wasn't yet known.
- for (Command &J : C.getJobs()) {
- if (SourceAction != FindSource(&J.getSource()))
- continue;
- auto &JArgs = J.getArguments();
- for (unsigned I = 0; I < JArgs.size(); ++I) {
- if (StringRef(JArgs[I]).startswith("-object-file-name=") &&
- Output.isFilename()) {
- ArgStringList NewArgs(JArgs.begin(), JArgs.begin() + I);
- addDebugObjectName(Args, NewArgs, DebugCompilationDir,
- Output.getFilename());
- NewArgs.append(JArgs.begin() + I + 1, JArgs.end());
- J.replaceArguments(NewArgs);
- break;
- }
- }
- }
-
assert(Output.isFilename() && "Unexpected lipo output.");
CmdArgs.push_back("-o");
CmdArgs.push_back(Output.getFilename());
diff --git a/clang/test/CMakeLists.txt b/clang/test/CMakeLists.txt
index 07de12b7c190b..32405fad820a9 100644
--- a/clang/test/CMakeLists.txt
+++ b/clang/test/CMakeLists.txt
@@ -126,7 +126,6 @@ if( NOT CLANG_BUILT_STANDALONE )
llvm-nm
llvm-objcopy
llvm-objdump
- llvm-pdbutil
llvm-profdata
llvm-rc
llvm-readelf
diff --git a/clang/test/CodeGenCXX/debug-info-objname.cpp b/clang/test/CodeGenCXX/debug-info-objname.cpp
deleted file mode 100644
index d80d805b8b41d..0000000000000
--- a/clang/test/CodeGenCXX/debug-info-objname.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-// REQUIRES: x86-registered-target
-// RUN: cp %s %T/debug-info-objname.cpp
-// RUN: cd %T
-
-// No output file provided, input file is relative, we emit an absolute path (MSVC behavior).
-// RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc debug-info-objname.cpp
-// RUN: llvm-pdbutil dump -all debug-info-objname.obj | FileCheck %s --check-prefix=ABSOLUTE
-
-// No output file provided, input file is absolute, we emit an absolute path (MSVC behavior).
-// RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc -- %T/debug-info-objname.cpp
-// RUN: llvm-pdbutil dump -all debug-info-objname.obj | FileCheck %s --check-prefix=ABSOLUTE
-
-// The output file is provided as an absolute path, we emit an absolute path.
-// RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc /Fo%T/debug-info-objname.obj -- %T/debug-info-objname.cpp
-// RUN: llvm-pdbutil dump -all debug-info-objname.obj | FileCheck %s --check-prefix=ABSOLUTE
-
-// The output file is provided as relative path, -working-dir is provided, we emit an absolute path.
-// RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc -working-dir=%T debug-info-objname.cpp
-// RUN: llvm-pdbutil dump -all debug-info-objname.obj | FileCheck %s --check-prefix=ABSOLUTE
-
-// The input file name is relative and we specify -fdebug-compilation-dir, we emit a relative path.
-// RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc -fdebug-compilation-dir=. debug-info-objname.cpp
-// RUN: llvm-pdbutil dump -all debug-info-objname.obj | FileCheck %s --check-prefix=RELATIVE
-
-// Ensure /FA emits an .asm file which contains the path to the final .obj, not the .asm
-// RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc -fdebug-compilation-dir=. /FA debug-info-objname.cpp
-// RUN: cat debug-info-objname.asm | FileCheck %s --check-prefix=ASM
-
-// Same thing for -save-temps
-// RUN: %clang_cl --target=x86_64-windows-msvc /c /Z7 -nostdinc -fdebug-compilation-dir=. /clang:-save-temps debug-info-objname.cpp
-// RUN: cat debug-info-objname.asm | FileCheck %s --check-prefix=ASM
-
-int main() {
- return 1;
-}
-
-// ABSOLUTE: S_OBJNAME [size = {{[0-9]+}}] sig=0, `{{.+}}debug-info-objname.obj`
-// RELATIVE: S_OBJNAME [size = {{[0-9]+}}] sig=0, `debug-info-objname.obj`
-// ASM: Record kind: S_OBJNAME
-// ASM-NEXT: .long 0
-// ASM-NEXT: .asciz "debug-info-objname.obj"
diff --git a/llvm/include/llvm/MC/MCTargetOptions.h b/llvm/include/llvm/MC/MCTargetOptions.h
index 3510eeca89538..db50dc6749e2e 100644
--- a/llvm/include/llvm/MC/MCTargetOptions.h
+++ b/llvm/include/llvm/MC/MCTargetOptions.h
@@ -62,7 +62,6 @@ class MCTargetOptions {
std::string ABIName;
std::string AssemblyLanguage;
std::string SplitDwarfFile;
- std::string COFFOutputFilename;
const char *Argv0 = nullptr;
ArrayRef<std::string> CommandLineArgs;
diff --git a/llvm/include/llvm/Support/Caching.h b/llvm/include/llvm/Support/Caching.h
index 5c30a822ef388..fbf5f3b5687ac 100644
--- a/llvm/include/llvm/Support/Caching.h
+++ b/llvm/include/llvm/Support/Caching.h
@@ -27,11 +27,8 @@ class MemoryBuffer;
/// that can be done by deriving from this class and overriding the destructor.
class CachedFileStream {
public:
- CachedFileStream(std::unique_ptr<raw_pwrite_stream> OS,
- std::string OSPath = "")
- : OS(std::move(OS)), ObjectPathName(OSPath) {}
+ CachedFileStream(std::unique_ptr<raw_pwrite_stream> OS) : OS(std::move(OS)) {}
std::unique_ptr<raw_pwrite_stream> OS;
- std::string ObjectPathName;
virtual ~CachedFileStream() = default;
};
diff --git a/llvm/include/llvm/Support/ToolOutputFile.h b/llvm/include/llvm/Support/ToolOutputFile.h
index 6b7222550b9f8..ec1d6ae522689 100644
--- a/llvm/include/llvm/Support/ToolOutputFile.h
+++ b/llvm/include/llvm/Support/ToolOutputFile.h
@@ -29,10 +29,9 @@ class ToolOutputFile {
/// raw_fd_ostream is destructed. It installs cleanups in its constructor and
/// uninstalls them in its destructor.
class CleanupInstaller {
- public:
/// The name of the file.
std::string Filename;
-
+ public:
/// The flag which indicates whether we should not delete the file.
bool Keep;
@@ -65,8 +64,6 @@ class ToolOutputFile {
/// Indicate that the tool's job wrt this output file has been successful and
/// the file should not be deleted.
void keep() { Installer.Keep = true; }
-
- const std::string &outputFilename() { return Installer.Filename; }
};
} // end llvm namespace
diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h
index c639f326abc9d..912f6d1c153a7 100644
--- a/llvm/include/llvm/Target/TargetOptions.h
+++ b/llvm/include/llvm/Target/TargetOptions.h
@@ -418,11 +418,6 @@ namespace llvm {
/// Machine level options.
MCTargetOptions MCOptions;
-
- /// Stores the filename/path of the final .o/.obj file, to be written in the
- /// debug information. This is used for emitting the CodeView S_OBJNAME
- /// record.
- std::string ObjectFilenameForDebug;
};
} // End llvm namespace
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index d621108408f08..928252a3d0419 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -649,7 +649,6 @@ void CodeViewDebug::endModule() {
switchToDebugSectionForSymbol(nullptr);
MCSymbol *CompilerInfo = beginCVSubsection(DebugSubsectionKind::Symbols);
- emitObjName();
emitCompilerInformation();
endCVSubsection(CompilerInfo);
@@ -785,29 +784,6 @@ void CodeViewDebug::emitTypeGlobalHashes() {
}
}
-void CodeViewDebug::emitObjName() {
- MCSymbol *CompilerEnd = beginSymbolRecord(SymbolKind::S_OBJNAME);
-
- StringRef PathRef(Asm->TM.Options.ObjectFilenameForDebug);
- llvm::SmallString<256> PathStore(PathRef);
-
- if (PathRef.empty() || PathRef == "-") {
- // Don't emit the filename if we're writing to stdout or to /dev/null.
- PathRef = {};
- } else {
- llvm::sys::path::remove_dots(PathStore, /*remove_dot_dot=*/true);
- PathRef = PathStore;
- }
-
- OS.AddComment("Signature");
- OS.emitIntValue(0, 4);
-
- OS.AddComment("Object name");
- emitNullTerminatedSymbolName(OS, PathRef);
-
- endSymbolRecord(CompilerEnd);
-}
-
namespace {
struct Version {
int Part[4];
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
index d1fc3cdccb207..6f88e15ee8fee 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.h
@@ -302,8 +302,6 @@ class LLVM_LIBRARY_VISIBILITY CodeViewDebug : public DebugHandlerBase {
void emitTypeGlobalHashes();
- void emitObjName();
-
void emitCompilerInformation();
void emitBuildInfo();
diff --git a/llvm/lib/LTO/LTOBackend.cpp b/llvm/lib/LTO/LTOBackend.cpp
index 855d0fc8a8bef..15e20fec565f5 100644
--- a/llvm/lib/LTO/LTOBackend.cpp
+++ b/llvm/lib/LTO/LTOBackend.cpp
@@ -412,8 +412,6 @@ static void codegen(const Config &Conf, TargetMachine *TM,
if (Error Err = StreamOrErr.takeError())
report_fatal_error(std::move(Err));
std::unique_ptr<CachedFileStream> &Stream = *StreamOrErr;
- TM->Options.ObjectFilenameForDebug = Stream->ObjectPathName;
-
legacy::PassManager CodeGenPasses;
CodeGenPasses.add(
createImmutableModuleSummaryIndexWrapperPass(&CombinedIndex));
diff --git a/llvm/lib/Support/Caching.cpp b/llvm/lib/Support/Caching.cpp
index 8c685640f791a..635647d724689 100644
--- a/llvm/lib/Support/Caching.cpp
+++ b/llvm/lib/Support/Caching.cpp
@@ -79,13 +79,14 @@ Expected<FileCache> llvm::localCache(Twine CacheNameRef,
struct CacheStream : CachedFileStream {
AddBufferFn AddBuffer;
sys::fs::TempFile TempFile;
+ std::string EntryPath;
unsigned Task;
CacheStream(std::unique_ptr<raw_pwrite_stream> OS, AddBufferFn AddBuffer,
sys::fs::TempFile TempFile, std::string EntryPath,
unsigned Task)
- : CachedFileStream(std::move(OS), std::move(EntryPath)),
- AddBuffer(std::move(AddBuffer)), TempFile(std::move(TempFile)),
+ : CachedFileStream(std::move(OS)), AddBuffer(std::move(AddBuffer)),
+ TempFile(std::move(TempFile)), EntryPath(std::move(EntryPath)),
Task(Task) {}
~CacheStream() {
@@ -98,7 +99,7 @@ Expected<FileCache> llvm::localCache(Twine CacheNameRef,
// Open the file first to avoid racing with a cache pruner.
ErrorOr<std::unique_ptr<MemoryBuffer>> MBOrErr =
MemoryBuffer::getOpenFile(
- sys::fs::convertFDToNativeFile(TempFile.FD), ObjectPathName,
+ sys::fs::convertFDToNativeFile(TempFile.FD), EntryPath,
/*FileSize=*/-1, /*RequiresNullTerminator=*/false);
if (!MBOrErr)
report_fatal_error(Twine("Failed to open new cache file ") +
@@ -114,14 +115,14 @@ Expected<FileCache> llvm::localCache(Twine CacheNameRef,
// AddBuffer a copy of the bytes we wrote in that case. We do this
// instead of just using the existing file, because the pruner might
// delete the file before we get a chance to use it.
- Error E = TempFile.keep(ObjectPathName);
+ Error E = TempFile.keep(EntryPath);
E = handleErrors(std::move(E), [&](const ECError &E) -> Error {
std::error_code EC = E.convertToErrorCode();
if (EC != errc::permission_denied)
return errorCodeToError(EC);
auto MBCopy = MemoryBuffer::getMemBufferCopy((*MBOrErr)->getBuffer(),
- ObjectPathName);
+ EntryPath);
MBOrErr = std::move(MBCopy);
// FIXME: should we consume the discard error?
@@ -132,7 +133,7 @@ Expected<FileCache> llvm::localCache(Twine CacheNameRef,
if (E)
report_fatal_error(Twine("Failed to rename temporary file ") +
- TempFile.TmpName + " to " + ObjectPathName + ": " +
+ TempFile.TmpName + " to " + EntryPath + ": " +
toString(std::move(E)) + "\n");
AddBuffer(Task, std::move(*MBOrErr));
diff --git a/llvm/test/DebugInfo/COFF/globals.ll b/llvm/test/DebugInfo/COFF/globals.ll
index 71c18a76f4b58..7960f63b1474f 100644
--- a/llvm/test/DebugInfo/COFF/globals.ll
+++ b/llvm/test/DebugInfo/COFF/globals.ll
@@ -1,9 +1,7 @@
; RUN: llc < %s | FileCheck %s --check-prefix=ASM
; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s --check-prefix=OBJ
; RUN: llc < %s | llvm-mc -filetype=obj --triple=x86_64-windows | llvm-readobj - --codeview | FileCheck %s --check-prefix=OBJ
-; RUN: llc < %s -filetype=obj | obj2yaml | FileCheck %s --check-prefixes=YAML,YAML-STDOUT
-; RUN: llc < %s -filetype=obj -o %t
-; RUN: obj2yaml < %t | FileCheck %s --check-prefixes=YAML,YAML-FILE
+; RUN: llc < %s -filetype=obj | obj2yaml | FileCheck %s --check-prefix=YAML
; C++ source to regenerate:
; $ cat a.cpp
@@ -248,11 +246,6 @@
; YAML: Subsections:
; YAML: - !Symbols
; YAML: Records:
-; YAML: - Kind: S_OBJNAME
-; YAML: ObjNameSym:
-; YAML: Signature: 0
-; YAML-STDOUT: ObjectName: ''
-; YAML-FILE: ObjectName: '{{.*}}'
; YAML: - Kind: S_COMPILE3
; YAML: Compile3Sym:
diff --git a/llvm/test/DebugInfo/COFF/multifunction.ll b/llvm/test/DebugInfo/COFF/multifunction.ll
index fa93b13497563..9f99ba05047e6 100644
--- a/llvm/test/DebugInfo/COFF/multifunction.ll
+++ b/llvm/test/DebugInfo/COFF/multifunction.ll
@@ -498,18 +498,18 @@
; OBJ64: Characteristics [ (0x42300040)
; OBJ64: ]
; OBJ64: Relocations [
-; OBJ64-NEXT: 0x70 IMAGE_REL_AMD64_SECREL x
-; OBJ64-NEXT: 0x74 IMAGE_REL_AMD64_SECTION x
-; OBJ64-NEXT: 0xA8 IMAGE_REL_AMD64_SECREL x
-; OBJ64-NEXT: 0xAC IMAGE_REL_AMD64_SECTION x
-; OBJ64-NEXT: 0x10C IMAGE_REL_AMD64_SECREL y
-; OBJ64-NEXT: 0x110 IMAGE_REL_AMD64_SECTION y
-; OBJ64-NEXT: 0x144 IMAGE_REL_AMD64_SECREL y
-; OBJ64-NEXT: 0x148 IMAGE_REL_AMD64_SECTION y
-; OBJ64-NEXT: 0x1A8 IMAGE_REL_AMD64_SECREL f
-; OBJ64-NEXT: 0x1AC IMAGE_REL_AMD64_SECTION f
-; OBJ64-NEXT: 0x1E0 IMAGE_REL_AMD64_SECREL f
-; OBJ64-NEXT: 0x1E4 IMAGE_REL_AMD64_SECTION f
+; OBJ64-NEXT: 0x64 IMAGE_REL_AMD64_SECREL x
+; OBJ64-NEXT: 0x68 IMAGE_REL_AMD64_SECTION x
+; OBJ64-NEXT: 0x9C IMAGE_REL_AMD64_SECREL x
+; OBJ64-NEXT: 0xA0 IMAGE_REL_AMD64_SECTION x
+; OBJ64-NEXT: 0x100 IMAGE_REL_AMD64_SECREL y
+; OBJ64-NEXT: 0x104 IMAGE_REL_AMD64_SECTION y
+; OBJ64-NEXT: 0x138 IMAGE_REL_AMD64_SECREL y
+; OBJ64-NEXT: 0x13C IMAGE_REL_AMD64_SECTION y
+; OBJ64-NEXT: 0x19C IMAGE_REL_AMD64_SECREL f
+; OBJ64-NEXT: 0x1A0 IMAGE_REL_AMD64_SECTION f
+; OBJ64-NEXT: 0x1D4 IMAGE_REL_AMD64_SECREL f
+; OBJ64-NEXT: 0x1D8 IMAGE_REL_AMD64_SECTION f
; OBJ64-NEXT: ]
; OBJ64: Subsection [
; OBJ64-NEXT: SubSectionType: Symbols (0xF1)
diff --git a/llvm/test/DebugInfo/COFF/pr28747.ll b/llvm/test/DebugInfo/COFF/pr28747.ll
index e9b3a8eae91be..c20e50e1992e4 100644
--- a/llvm/test/DebugInfo/COFF/pr28747.ll
+++ b/llvm/test/DebugInfo/COFF/pr28747.ll
@@ -5,10 +5,8 @@
; CHECK-NEXT: .long 241
; CHECK-NEXT: .long [[SUBSEC_END:.*]]-[[SUBSEC_START:.*]] # Subsection size
; CHECK-NEXT: [[SUBSEC_START]]:
-; CHECK-NEXT: .short [[OBJNAME_END:.*]]-[[OBJNAME_START:.*]] # Record length
-; CHECK: [[OBJNAME_END]]:
-; CHECK-NEXT: .short [[COMPILE3_END:.*]]-[[COMPILE3_START:.*]] # Record length
-; CHECK: [[COMPILE3_END]]:
+; CHECK-NEXT: .short [[C1_END:.*]]-[[C1_START:.*]] # Record length
+; CHECK: [[C1_END]]:
; CHECK-NEXT: [[SUBSEC_END]]:
; CHECK-NEXT: .p2align 2
; CHECK-NEXT: .cv_filechecksums
diff --git a/llvm/test/DebugInfo/COFF/simple.ll b/llvm/test/DebugInfo/COFF/simple.ll
index 70878ac33ef1d..082640182dc23 100644
--- a/llvm/test/DebugInfo/COFF/simple.ll
+++ b/llvm/test/DebugInfo/COFF/simple.ll
@@ -36,10 +36,8 @@
; X86-NEXT: .long [[COMPILE_END:.*]]-[[COMPILE_START:.*]] #
; Compiler information record
; X86-NEXT: [[COMPILE_START]]:
-; X86-NEXT: .short [[OBJNAME_END:.*]]-[[OBJNAME_START:.*]] #
-; X86: [[OBJNAME_END]]:
-; X86-NEXT: .short [[COMPILE3_END:.*]]-[[COMPILE3_START:.*]] #
-; X86: [[COMPILE3_END]]:
+; X86-NEXT: .short [[C1_END:.*]]-[[C1_START:.*]] #
+; X86: [[C1_END]]:
; X86-NEXT: [[COMPILE_END]]:
; X86-NEXT: .p2align 2
; X86-NEXT: .cv_fpo_data _f
@@ -90,11 +88,11 @@
; OBJ32: Characteristics [ (0x42300040)
; OBJ32: ]
; OBJ32: Relocations [
-; OBJ32-NEXT: 0x50 IMAGE_REL_I386_DIR32NB _f
-; OBJ32-NEXT: 0x9C IMAGE_REL_I386_SECREL _f
-; OBJ32-NEXT: 0xA0 IMAGE_REL_I386_SECTION _f
-; OBJ32-NEXT: 0xD4 IMAGE_REL_I386_SECREL _f
-; OBJ32-NEXT: 0xD8 IMAGE_REL_I386_SECTION _f
+; OBJ32-NEXT: 0x44 IMAGE_REL_I386_DIR32NB _f
+; OBJ32-NEXT: 0x90 IMAGE_REL_I386_SECREL _f
+; OBJ32-NEXT: 0x94 IMAGE_REL_I386_SECTION _f
+; OBJ32-NEXT: 0xC8 IMAGE_REL_I386_SECREL _f
+; OBJ32-NEXT: 0xCC IMAGE_REL_I386_SECTION _f
; OBJ32-NEXT: ]
; OBJ32: Subsection [
; OBJ32-NEXT: SubSectionType: Symbols (0xF1)
@@ -167,10 +165,8 @@
; X64-NEXT: .long [[COMPILE_END:.*]]-[[COMPILE_START:.*]] #
; Compiler information record
; X64-NEXT: [[COMPILE_START]]:
-; X64-NEXT: .short [[OBJNAME_END:.*]]-[[OBJNAME_START:.*]] #
-; X64: [[OBJNAME_END]]:
-; X64-NEXT: .short [[COMPILE3_END:.*]]-[[COMPILE3_START:.*]] #
-; X64: [[COMPILE3_END]]:
+; X64-NEXT: .short [[C1_END:.*]]-[[C1_START:.*]] #
+; X64: [[C1_END]]:
; X64-NEXT: [[COMPILE_END]]:
; X64-NEXT: .p2align 2
; X64-NEXT: .long 241 # Symbol subsection for f
@@ -220,10 +216,10 @@
; OBJ64: Characteristics [ (0x42300040)
; OBJ64: ]
; OBJ64: Relocations [
-; OBJ64-NEXT: 0x70 IMAGE_REL_AMD64_SECREL f
-; OBJ64-NEXT: 0x74 IMAGE_REL_AMD64_SECTION f
-; OBJ64-NEXT: 0xA8 IMAGE_REL_AMD64_SECREL f
-; OBJ64-NEXT: 0xAC IMAGE_REL_AMD64_SECTION f
+; OBJ64-NEXT: 0x64 IMAGE_REL_AMD64_SECREL f
+; OBJ64-NEXT: 0x68 IMAGE_REL_AMD64_SECTION f
+; OBJ64-NEXT: 0x9C IMAGE_REL_AMD64_SECREL f
+; OBJ64-NEXT: 0xA0 IMAGE_REL_AMD64_SECTION f
; OBJ64-NEXT: ]
; OBJ64: Subsection [
; OBJ64-NEXT: SubSectionType: Symbols (0xF1)
diff --git a/llvm/test/DebugInfo/COFF/vframe-fpo.ll b/llvm/test/DebugInfo/COFF/vframe-fpo.ll
index 599d9f07f9d59..6b77ac579cb3d 100644
--- a/llvm/test/DebugInfo/COFF/vframe-fpo.ll
+++ b/llvm/test/DebugInfo/COFF/vframe-fpo.ll
@@ -65,9 +65,7 @@
; CODEVIEW-NEXT: Subsection [
; CODEVIEW-NEXT: SubSectionType: Symbols (0xF1)
; CODEVIEW-NEXT: SubSectionSize:
-; CODEVIEW-NEXT: ObjNameSym {
-; CODEVIEW-NEXT: Kind: S_OBJNAME (0x1101)
-; CODEVIEW: Compile3Sym {
+; CODEVIEW-NEXT: Compile3Sym {
; CODEVIEW-NEXT: Kind: S_COMPILE3 (0x113C)
; CODEVIEW: }
; CODEVIEW: ]
diff --git a/llvm/test/MC/AArch64/coff-debug.ll b/llvm/test/MC/AArch64/coff-debug.ll
index 6099b3d570b46..bb7cc4db3f938 100644
--- a/llvm/test/MC/AArch64/coff-debug.ll
+++ b/llvm/test/MC/AArch64/coff-debug.ll
@@ -1,7 +1,5 @@
; RUN: llc -mtriple=aarch64-windows -filetype=obj -o - %s | \
-; RUN: llvm-readobj --codeview - | FileCheck %s --check-prefixes=CHECK,CHECK-STDOUT
-; RUN: llc -mtriple=aarch64-windows -filetype=obj -o %t.o %s
-; RUN: llvm-readobj --codeview %t.o | FileCheck %s --check-prefixes=CHECK,CHECK-FILE
+; RUN: llvm-readobj --codeview - | FileCheck %s
; ModuleID = 'a.c'
source_filename = "a.c"
@@ -68,12 +66,6 @@ attributes #0 = { noinline nounwind optnone "correctly-rounded-divide-sqrt-fp-ma
; CHECK: Magic: 0x4
; CHECK: Subsection [
; CHECK: SubSectionType: Symbols (0xF1)
-; CHECK: ObjNameSym {
-; CHECK: Kind: S_OBJNAME (0x1101)
-; CHECK: Signature: 0x0
-; CHECK-STDOUT: ObjectName: {{$}}
-; CHECK-FILE: ObjectName: {{.*}}.o
-; CHECK: }
; CHECK: Compile3Sym {
; CHECK: Kind: S_COMPILE3 (0x113C)
; CHECK: Language: C (0x0)
diff --git a/llvm/test/MC/ARM/coff-debugging-secrel.ll b/llvm/test/MC/ARM/coff-debugging-secrel.ll
index 1e00b05472354..dbd251adae194 100644
--- a/llvm/test/MC/ARM/coff-debugging-secrel.ll
+++ b/llvm/test/MC/ARM/coff-debugging-secrel.ll
@@ -42,10 +42,10 @@ entry:
; CHECK-MSVC: Relocations [
; CHECK-MSVC: Section {{.*}} .debug$S {
-; CHECK-MSVC: 0x70 IMAGE_REL_ARM_SECREL function
-; CHECK-MSVC: 0x74 IMAGE_REL_ARM_SECTION function
-; CHECK-MSVC: 0xAC IMAGE_REL_ARM_SECREL function
-; CHECK-MSVC: 0xB0 IMAGE_REL_ARM_SECTION function
+; CHECK-MSVC: 0x64 IMAGE_REL_ARM_SECREL function
+; CHECK-MSVC: 0x68 IMAGE_REL_ARM_SECTION function
+; CHECK-MSVC: 0xA0 IMAGE_REL_ARM_SECREL function
+; CHECK-MSVC: 0xA4 IMAGE_REL_ARM_SECTION function
; CHECK-MSVC: }
; CHECK-MSVC: ]
diff --git a/llvm/test/MC/COFF/cv-compiler-info.ll b/llvm/test/MC/COFF/cv-compiler-info.ll
index a9deb74bc9b9f..d8cfe99736cff 100644
--- a/llvm/test/MC/COFF/cv-compiler-info.ll
+++ b/llvm/test/MC/COFF/cv-compiler-info.ll
@@ -1,6 +1,4 @@
-; RUN: llc -mtriple i686-pc-windows-msvc < %s | FileCheck %s --check-prefixes=CHECK,STDOUT
-; RUN: llc -mtriple i686-pc-windows-msvc < %s -o %t
-; RUN: FileCheck %s --input-file=%t --check-prefixes=CHECK,FILE
+; RUN: llc -mtriple i686-pc-windows-msvc < %s | FileCheck %s
; ModuleID = 'D:\src\scopes\foo.cpp'
source_filename = "D:\5Csrc\5Cscopes\5Cfoo.cpp"
target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"
@@ -22,23 +20,19 @@ attributes #0 = { nounwind sspstrong "correctly-rounded-divide-sqrt-fp-math"="fa
; One .debug$S section should contain an S_COMPILE3 record that identifies the
; source language and the version of the compiler based on the DICompileUnit.
; CHECK: .section .debug$S,"dr"
-; CHECK: .short 4353 # Record kind: S_OBJNAME
-; CHECK-NEXT: .long 0 # Signature
-; STDOUT-NEXT: .byte 0 # Object name
-; FILE-NEXT: .asciz "{{.*}}{{\\\\|/}}cv-compiler-info.ll.tmp" # Object name
; CHECK: .short 4412 # Record kind: S_COMPILE3
-; CHECK-NEXT: .long 1 # Flags and language
-; CHECK-NEXT: .short 7 # CPUType
-; CHECK-NEXT: .short 4 # Frontend version
-; CHECK-NEXT: .short 0
-; CHECK-NEXT: .short 0
-; CHECK-NEXT: .short 0
-; CHECK-NEXT: .short [[BACKEND_VERSION:[0-9]+]] # Backend version
-; CHECK-NEXT: .short 0
-; CHECK-NEXT: .short 0
-; CHECK-NEXT: .short 0
-; CHECK-NEXT: .asciz "clang version 4.0.0 " # Null-terminated compiler version string
-; CHECK-NOT: .short 4412 # Record kind: S_COMPILE3
+; CHECK: .long 1 # Flags and language
+; CHECK: .short 7 # CPUType
+; CHECK: .short 4 # Frontend version
+; CHECK: .short 0
+; CHECK: .short 0
+; CHECK: .short 0
+; CHECK: .short [[BACKEND_VERSION:[0-9]+]] # Backend version
+; CHECK: .short 0
+; CHECK: .short 0
+; CHECK: .short 0
+; CHECK: .asciz "clang version 4.0.0 " # Null-terminated compiler version string
+; CHECK-NOT: .short 4412 # Record kind: S_COMPILE3
!1 = !DIFile(filename: "D:\5Csrc\5Cscopes\5Cfoo.cpp", directory: "D:\5Csrc\5Cscopes\5Cclang")
!2 = !{}
!7 = !{i32 2, !"CodeView", i32 1}
diff --git a/llvm/tools/llc/llc.cpp b/llvm/tools/llc/llc.cpp
index c07f4e66486c8..9d80f062c8f95 100644
--- a/llvm/tools/llc/llc.cpp
+++ b/llvm/tools/llc/llc.cpp
@@ -605,9 +605,6 @@ static int compileModule(char **argv, LLVMContext &Context) {
GetOutputStream(TheTarget->getName(), TheTriple.getOS(), argv[0]);
if (!Out) return 1;
- // Ensure the filename is passed down to CodeViewDebug.
- Target->Options.ObjectFilenameForDebug = Out->outputFilename();
-
std::unique_ptr<ToolOutputFile> DwoOut;
if (!SplitDwarfOutputFile.empty()) {
std::error_code EC;
diff --git a/llvm/tools/llvm-lto2/llvm-lto2.cpp b/llvm/tools/llvm-lto2/llvm-lto2.cpp
index 7416e58509440..6830bd8f1b2c5 100644
--- a/llvm/tools/llvm-lto2/llvm-lto2.cpp
+++ b/llvm/tools/llvm-lto2/llvm-lto2.cpp
@@ -378,7 +378,7 @@ static int run(int argc, char **argv) {
std::error_code EC;
auto S = std::make_unique<raw_fd_ostream>(Path, EC, sys::fs::OF_None);
check(EC, Path);
- return std::make_unique<CachedFileStream>(std::move(S), Path);
+ return std::make_unique<CachedFileStream>(std::move(S));
};
auto AddBuffer = [&](size_t Task, std::unique_ptr<MemoryBuffer> MB) {
More information about the cfe-commits
mailing list