diff --git a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp --- a/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp +++ b/llvm/lib/DebugInfo/GSYM/GsymCreator.cpp @@ -29,7 +29,13 @@ llvm::sys::path::Style Style) { llvm::StringRef directory = llvm::sys::path::parent_path(Path, Style); llvm::StringRef filename = llvm::sys::path::filename(Path, Style); - FileEntry FE(insertString(directory), insertString(filename)); + // We must insert the strings first, then call the FileEntry constructor. + // If we inline the insertString() function call into the constructor, the + // call order is undefined due to parameter lists not having any ordering + // requirements. + const uint32_t Dir = insertString(directory); + const uint32_t Base = insertString(filename); + FileEntry FE(Dir, Base); std::lock_guard Guard(Mutex); const auto NextIndex = Files.size(); diff --git a/llvm/test/tools/llvm-gsymutil/fat-macho-dwarf.yaml b/llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml rename from llvm/test/tools/llvm-gsymutil/fat-macho-dwarf.yaml rename to llvm/test/tools/llvm-gsymutil/ARM_AArch64/fat-macho-dwarf.yaml diff --git a/llvm/test/tools/llvm-gsymutil/ARM_AArch64/lit.local.cfg b/llvm/test/tools/llvm-gsymutil/ARM_AArch64/lit.local.cfg new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-gsymutil/ARM_AArch64/lit.local.cfg @@ -0,0 +1,4 @@ +if not ('ARM' in config.root.targets and 'AArch64' in config.root.targets): + config.unsupported = True + +config.suffixes = ['.test', '.yaml'] diff --git a/llvm/test/tools/llvm-gsymutil/elf-dwarf.yaml b/llvm/test/tools/llvm-gsymutil/X86/elf-dwarf.yaml rename from llvm/test/tools/llvm-gsymutil/elf-dwarf.yaml rename to llvm/test/tools/llvm-gsymutil/X86/elf-dwarf.yaml diff --git a/llvm/test/tools/llvm-gsymutil/X86/lit.local.cfg b/llvm/test/tools/llvm-gsymutil/X86/lit.local.cfg new file mode 100644 --- /dev/null +++ b/llvm/test/tools/llvm-gsymutil/X86/lit.local.cfg @@ -0,0 +1,4 @@ +if not 'X86' in config.root.targets: + config.unsupported = True + +config.suffixes = ['.test', '.yaml'] diff --git a/llvm/test/tools/llvm-gsymutil/mach-dwarf.yaml b/llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml rename from llvm/test/tools/llvm-gsymutil/mach-dwarf.yaml rename to llvm/test/tools/llvm-gsymutil/X86/mach-dwarf.yaml diff --git a/llvm/tools/llvm-gsym/llvm-gsymutil.cpp b/llvm/tools/llvm-gsym/llvm-gsymutil.cpp --- a/llvm/tools/llvm-gsym/llvm-gsymutil.cpp +++ b/llvm/tools/llvm-gsym/llvm-gsymutil.cpp @@ -179,7 +179,8 @@ if (ArchFilters.empty()) return true; - StringRef ObjArch = Obj.getArchTriple().getArchName(); + Triple ObjTriple(Obj.getArchTriple()); + StringRef ObjArch = ObjTriple.getArchName(); for (auto Arch : ArchFilters) { // Match name. @@ -350,7 +351,8 @@ error(Filename, errorToErrorCode(BinOrErr.takeError())); if (auto *Obj = dyn_cast(BinOrErr->get())) { - auto ArchName = Obj->makeTriple().getArchName(); + Triple ObjTriple(Obj->makeTriple()); + auto ArchName = ObjTriple.getArchName(); outs() << "Output file (" << ArchName << "): " << OutFile << "\n"; if (auto Err = handleObjectFile(*Obj, OutFile.c_str())) return Err; @@ -374,7 +376,8 @@ // Now handle each architecture we need to convert. for (auto &Obj: FilterObjs) { - auto ArchName = Obj->getArchTriple().getArchName(); + Triple ObjTriple(Obj->getArchTriple()); + auto ArchName = ObjTriple.getArchName(); std::string ArchOutFile(OutFile); // If we are only handling a single architecture, then we will use the // normal output file. If we are handling multiple architectures append