[PATCH] D152363: [llvm-dlltool] Implement the --no-leading-underscore option

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 7 09:35:17 PDT 2023


mstorsjo added a comment.

In D152363#4403514 <https://reviews.llvm.org/D152363#4403514>, @jeremyd2019 wrote:

> FYI, binutils' dlltool also has a variant of that flag going the other way (`--leading-underscores`), causing underscores to be added on arches other than i386 (the default for leading underscores is "only on i386" but the flag can either set it to true or false explicitly).  I don't see the utility of that, but then again I didn't really see the utility of `--no-leading-underscores` either until rust was trying to use it.

Indeed; I didn’t see much need for adding that either. After thinking about it, I do see the need for this flag though, making things more straightforward, bypassing all the extra adding/removing of decorations.



================
Comment at: llvm/lib/Object/COFFModuleDefinition.cpp:143
+      : Lex(S), Machine(M), MingwDef(B), AddUnderscores(AU) {
+    if (Machine != IMAGE_FILE_MACHINE_I386)
+      AddUnderscores = false;
----------------
mstorsjo wrote:
> mati865 wrote:
> > I know nothing about ARM on Windows so double-check it but shouldn't this also check for ARM?
> Nope, out of the current 4 active architectures, only i386 uses such prefixes. And I don’t think the other ones (alpha, mips, sh4, ppc, ia64) used any prefix either, but I don’t know for sure about them.
> 
> In most cases, i386 is the weirdo - https://devblogs.microsoft.com/oldnewthing/20040914-00/?p=37873
Oh, and this matches the existing machine checks that get folded in here, which check specifically for i386.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D152363/new/

https://reviews.llvm.org/D152363



More information about the llvm-commits mailing list