|
30 | 30 | #include "llvm/LTO/LTO.h" |
31 | 31 | #include "llvm/Object/ArchiveWriter.h" |
32 | 32 | #include "llvm/Object/COFFImportFile.h" |
33 | | -#include "llvm/Object/COFFModuleDefinition.h" |
34 | 33 | #include "llvm/Option/Arg.h" |
35 | 34 | #include "llvm/Option/ArgList.h" |
36 | 35 | #include "llvm/Option/Option.h" |
@@ -1012,67 +1011,6 @@ void LinkerDriver::createImportLibrary(bool asLib) { |
1012 | 1011 | } |
1013 | 1012 | } |
1014 | 1013 |
|
1015 | | -void LinkerDriver::parseModuleDefs(StringRef path) { |
1016 | | - llvm::TimeTraceScope timeScope("Parse def file"); |
1017 | | - std::unique_ptr<MemoryBuffer> mb = |
1018 | | - CHECK(MemoryBuffer::getFile(path, /*IsText=*/false, |
1019 | | - /*RequiresNullTerminator=*/false, |
1020 | | - /*IsVolatile=*/true), |
1021 | | - "could not open " + path); |
1022 | | - COFFModuleDefinition m = check(parseCOFFModuleDefinition( |
1023 | | - mb->getMemBufferRef(), ctx.config.machine, ctx.config.mingw)); |
1024 | | - |
1025 | | - // Include in /reproduce: output if applicable. |
1026 | | - ctx.driver.takeBuffer(std::move(mb)); |
1027 | | - |
1028 | | - if (ctx.config.outputFile.empty()) |
1029 | | - ctx.config.outputFile = std::string(saver().save(m.OutputFile)); |
1030 | | - ctx.config.importName = std::string(saver().save(m.ImportName)); |
1031 | | - if (m.ImageBase) |
1032 | | - ctx.config.imageBase = m.ImageBase; |
1033 | | - if (m.StackReserve) |
1034 | | - ctx.config.stackReserve = m.StackReserve; |
1035 | | - if (m.StackCommit) |
1036 | | - ctx.config.stackCommit = m.StackCommit; |
1037 | | - if (m.HeapReserve) |
1038 | | - ctx.config.heapReserve = m.HeapReserve; |
1039 | | - if (m.HeapCommit) |
1040 | | - ctx.config.heapCommit = m.HeapCommit; |
1041 | | - if (m.MajorImageVersion) |
1042 | | - ctx.config.majorImageVersion = m.MajorImageVersion; |
1043 | | - if (m.MinorImageVersion) |
1044 | | - ctx.config.minorImageVersion = m.MinorImageVersion; |
1045 | | - if (m.MajorOSVersion) |
1046 | | - ctx.config.majorOSVersion = m.MajorOSVersion; |
1047 | | - if (m.MinorOSVersion) |
1048 | | - ctx.config.minorOSVersion = m.MinorOSVersion; |
1049 | | - |
1050 | | - for (COFFShortExport e1 : m.Exports) { |
1051 | | - Export e2; |
1052 | | - // Renamed exports are parsed and set as "ExtName = Name". If Name has |
1053 | | - // the form "OtherDll.Func", it shouldn't be a normal exported |
1054 | | - // function but a forward to another DLL instead. This is supported |
1055 | | - // by both MS and GNU linkers. |
1056 | | - if (!e1.ExtName.empty() && e1.ExtName != e1.Name && |
1057 | | - StringRef(e1.Name).contains('.')) { |
1058 | | - e2.name = saver().save(e1.ExtName); |
1059 | | - e2.forwardTo = saver().save(e1.Name); |
1060 | | - } else { |
1061 | | - e2.name = saver().save(e1.Name); |
1062 | | - e2.extName = saver().save(e1.ExtName); |
1063 | | - } |
1064 | | - e2.exportAs = saver().save(e1.ExportAs); |
1065 | | - e2.importName = saver().save(e1.ImportName); |
1066 | | - e2.ordinal = e1.Ordinal; |
1067 | | - e2.noname = e1.Noname; |
1068 | | - e2.data = e1.Data; |
1069 | | - e2.isPrivate = e1.Private; |
1070 | | - e2.constant = e1.Constant; |
1071 | | - e2.source = ExportSource::ModuleDefinition; |
1072 | | - ctx.symtab.exports.push_back(e2); |
1073 | | - } |
1074 | | -} |
1075 | | - |
1076 | 1014 | void LinkerDriver::enqueueTask(std::function<void()> task) { |
1077 | 1015 | taskQueue.push_back(std::move(task)); |
1078 | 1016 | } |
@@ -2352,7 +2290,7 @@ void LinkerDriver::linkerMain(ArrayRef<const char *> argsArr) { |
2352 | 2290 | // Handle /def |
2353 | 2291 | if (auto *arg = args.getLastArg(OPT_deffile)) { |
2354 | 2292 | // parseModuleDefs mutates Config object. |
2355 | | - parseModuleDefs(arg->getValue()); |
| 2293 | + mainSymtab.parseModuleDefs(arg->getValue()); |
2356 | 2294 | } |
2357 | 2295 |
|
2358 | 2296 | // Handle generation of import library from a def file. |
|
0 commit comments