New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
llvm-nm -U conflicts with GNU nm -U (since binutils>=2.38) #55297
Comments
@llvm/issue-subscribers-tools-llvm-nm |
|
I think that we should conditionalize that on the platform. |
It's possible that if Ideally this issue can also be used to get some alignment on the level of compatibility that llvm-nm should strive for. This has come up before on an llvm-nm change of mine here. The resolution in that case was that @MaskRay put in the work (thanks for that!) to get the flag in binutils before we landed it in llvm-nm. There was also some discussion around not requiring binutils behavior mirroring for new long-form flags, but requiring it for new single letter flags, to reduce the chance of future conflicts. If this is the aligned upon opinion, is there some place we could codify this? Ideally reviewers of these tools would be on the same page, or there was somewhere we could at least link to when they aren't. I'm feeling thrash here since I added On that note, maybe given the niche use case of the unicode feature, this is also a place where llvm-nm could diverge instead? FWIW at Lyft we have production code that uses both |
@jh7370 is this discussed or documented somewhere? |
I filed https://sourceware.org/pipermail/binutils/2022-May/120742.html whether GNU nm can redefine -U as Note that llvm-nm should not have different behaviors on different host platforms. That would make cross compilation inconvenient. I don't think llvm-nm should change its interpretation of options by inspecting input files. If llvm-nm keeps having more GNU vs Darwin discrepancy, we may need a Darwin specific frontend (like llvm-objdump/llvm-otool, or llvm-libtool-darwin).
By archaeology, GNU nm compatibility was the original goal and this generally reflects recent years' development. While I personally use |
+1 to the best resolution being getting GNU to change their option: if they do that, I don't think there's an issue with a temporary incompatibility, since our usage has been around for longer.
At the very least, it was discussed at at least one LLVM developer conference directly that I attended, in BoF or Round Table formats, and was indirectly talked about in other talks too. Here's the notes I have from the round table: https://lists.llvm.org/pipermail/llvm-dev/2019-April/132033.html and the BoF https://lists.llvm.org/pipermail/llvm-dev/2019-April/132032.html in Euro LLVM 2019. I don't think these notes are the only time, but I don't concretely recall what the previous occasions were, so trying to look them up may be a little tricky. Tools like llvm-nm are also listed in https://llvm.org/docs/CommandGuide/ under "GNU binutils replacements" too, though that's possibly a historical artifact because they were never originally intended to be Mac OS replacements. I feel like there have been more concrete discussions on mailing lists and reviews before, but I forget exact;y when. One tool I can concretely say is that ELF llvm-objcopy was explicitly written to produce GNU-identical output, but only where that output made sense (I know this because I was involved from very early, basically day one, in its development). I think we should take this discussion to Discourse, as it sounds like it needs to attract wider attention. |
It looks like the binutils folks are open to using
|
Thanks for the update. This will be the best outcome. I filed a GNU nm feature request for --no-weak/-W (https://sourceware.org/bugzilla/show_bug.cgi?id=29135). We can then add back -U and -W to documentation. I think The only(?) conflicting option will be |
I noticed that GNU nm did not have
-U
and removed-U
(--defined-only
) from llvm-nm's --help and documentation in https://reviews.llvm.org/D105330 (like "soft deprecation", there is no warning invoking llvm-nm with the option).Since binutils 2.38, GNU nm defines
-U
as an alias for--unicode
, so we do have conflicting semantics now.llvm-nm is a utility which tried to be compatible with both GNU nm and macOS nm. When the two nm implementations have conflicting semantics for an option, llvm-nm has a portability problem. I just did a bit research: for some older Mac OS X manpages, e.g. https://www.unix.com/man-page/osx/1/nm/
-U
is not listed. On some newer systems, e.g. Apple M1, I can find the following in itsnm(1)
:Note: the
--unicode
feature is probably not so useful right now.The text was updated successfully, but these errors were encountered: