Commit: Add support for displaying unicode characters

Fangrui Song i@maskray.me
Sun May 8 05:46:26 GMT 2022


On Tue, Nov 9, 2021 at 5:25 AM Nick Clifton via Binutils
<binutils@sourceware.org> wrote:
>
> Hi Guys,
>
>   I am applying the attached patch to add the ability to display unicode
>   characters to the nm, strings, objdump and readelf tools.  This is
>   part of a response to the Trojan Source vulnerability that was
>   recently disclosed.  I am also working on a separate patch for gas,
>   but that is not quite ready yet.
>
> Cheers
>   Nick
>
> binutils/ChangeLog
> 2021-11-09  Nick Clifton  <nickc@redhat.com>
>
>         * nm.c: Add --unicode option to control how unicode characters are
>         handled.
>         * objdump.c: Likewise.
>         * readelf.c: Likewise.
>         * strings.c: Likewise.
>         * binutils.texi: Document the new feature.
>         * NEWS: Document the new feature.
>         * testsuite/binutils-all/unicode.exp: New file.
>         * testsuite/binutils-all/nm.hex.unicode
>         * testsuite/binutils-all/strings.escape.unicode
>         * testsuite/binutils-all/objdump.highlight.unicode
>         * testsuite/binutils-all/readelf.invalid.unicode
>

I just learned that this patch added -U as an alias for --unicode. In
macOS nm and llvm-nm, -U is an alias for --defined-only.
--defined-only seems much more useful than --unicode. I wonder if it
is too late to redefine -U as --defined-only...

(On the llvm-nm side, I have filed
https://github.com/llvm/llvm-project/issues/55297 .
If it needs to keep compatibility with GNU nm, it will need to drop -U....)


More information about the Binutils mailing list