[PATCH] D149611: [LLD][COFF] Allow overwriting directives exports with cmd-line exports

Alexandre Ganea via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon May 1 12:49:13 PDT 2023


aganea created this revision.
aganea added reviewers: alvinhochun, mstorsjo, hans.
Herald added a project: All.
aganea requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

MSVC link.exe allows overriding exports on the cmd-line with exports seen in OBJ directives. The typical case is what is described in #62329 <https://github.com/llvm/llvm-project/issues/62329>.

Before this patch, trying to override an export with `/export` or `/def` would generate a duplicate warning. This patches tries to replicate the MSVC behavior. A second override on the cmd-line would still generate the warning.

There's still a case which we don't cover: MSVC link.exe is able to demangle an exported OBJ directive function, and match it with a unmangled export function in a .def file. In the meanwhile, one can use the mangled export in the .def to cover that case.

Depends on D149610 <https://reviews.llvm.org/D149610>.

This fixes #62329 <https://github.com/llvm/llvm-project/issues/62329>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D149611

Files:
  lld/COFF/Config.h
  lld/COFF/DLL.cpp
  lld/COFF/Driver.cpp
  lld/COFF/DriverUtils.cpp
  lld/test/COFF/export.test
  lld/test/COFF/export32.test
  lld/test/COFF/ordinals-override.test

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D149611.518532.patch
Type: text/x-patch
Size: 18108 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230501/540109b7/attachment.bin>


More information about the llvm-commits mailing list