From 603db7425ffa96915854f425b027cc8403ab333d Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 26 Mar 2024 13:18:09 +0100 Subject: [LLD][COFF] Preserve all attributes from forwarding exports from parsed .def files. (#86564) It's similar to #86535, but for export specified in .def files. --- lld/COFF/Driver.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'lld/COFF') diff --git a/lld/COFF/Driver.cpp b/lld/COFF/Driver.cpp index 1b07538..1814929 100644 --- a/lld/COFF/Driver.cpp +++ b/lld/COFF/Driver.cpp @@ -1032,19 +1032,18 @@ void LinkerDriver::parseModuleDefs(StringRef path) { for (COFFShortExport e1 : m.Exports) { Export e2; - // In simple cases, only Name is set. Renamed exports are parsed - // and set as "ExtName = Name". If Name has the form "OtherDll.Func", - // it shouldn't be a normal exported function but a forward to another - // DLL instead. This is supported by both MS and GNU linkers. + // Renamed exports are parsed and set as "ExtName = Name". If Name has + // the form "OtherDll.Func", it shouldn't be a normal exported + // function but a forward to another DLL instead. This is supported + // by both MS and GNU linkers. if (!e1.ExtName.empty() && e1.ExtName != e1.Name && StringRef(e1.Name).contains('.')) { e2.name = saver().save(e1.ExtName); e2.forwardTo = saver().save(e1.Name); - ctx.config.exports.push_back(e2); - continue; + } else { + e2.name = saver().save(e1.Name); + e2.extName = saver().save(e1.ExtName); } - e2.name = saver().save(e1.Name); - e2.extName = saver().save(e1.ExtName); e2.aliasTarget = saver().save(e1.AliasTarget); e2.ordinal = e1.Ordinal; e2.noname = e1.Noname; -- cgit v1.1