Skip to content

Conversation

@grendello
Copy link
Contributor

@grendello grendello commented Mar 4, 2024

Wrappers are needed to appease API Scan which doesn't find PDB files of renamed
binaries, such as llvm-strip.exe (which is renamed llvm-objcopy.exe) and
ld.exe (which is renamed lld.exe). Both utilities look at their argv[0]
to determine the "mode" in which they should work.

llvm-objcopy.exe renamed to llvm-strip.exe causes API Scan to not find the required
PDB file (which we also rename, but whose original name is recorded in .exe).

lld.exe is a special case, because, unlike llvm-objcopy, it cannot be invoked
under this name. The utility will complain about lld being a generic driver name
and that a specific one (such as ld) must be used instead - i.e., argv[0] must
be that specific name.

In both cases adding a wrapper with the "target" name appeases API Scan and makes
the utilities work as we need them to.

This PR implements both wrappers and reorganizes the native code a bit so that portions
of it can be shared between the 3 wrappers that we now have (as is another one). To
stay consistent, the wrappers are also used on Unix OS-es, even though they aren't necessary
there.

C++ standard library on macOS is too out of date to support `constexpr`
`std::string`, don't use that then.

Windows build required some minute changes to fix type cast issues and
add missing include files.
@grendello
Copy link
Contributor Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@grendello grendello marked this pull request as ready for review March 8, 2024 09:01
@grendello grendello changed the title Beginnings of the llvm-strip wrapper Add llvm-strip and lld wrappers Mar 8, 2024
@grendello grendello requested review from jonpryor and pjcollins March 8, 2024 09:02
@grendello grendello mentioned this pull request Mar 8, 2024
@grendello grendello closed this Apr 3, 2024
@grendello grendello deleted the dev/grendel/llvm-strip-wrapper branch April 3, 2024 09:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants