Bug 28581 - nm/objdump --help display unsupported demangling styles
Summary: nm/objdump --help display unsupported demangling styles
Status: RESOLVED FIXED
Alias: None
Product: binutils
Classification: Unclassified
Component: binutils (show other bugs)
Version: 2.38
: P2 normal
Target Milestone: ---
Assignee: Alan Modra
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-10 15:55 UTC by panxiaohe
Modified: 2021-11-12 04:38 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2021-11-11 00:00:00


Attachments
Fix-demangle-styles-of-usage-about-nm-and-objdump.patch (803 bytes, application/mbox)
2021-11-10 15:55 UTC, panxiaohe
Details

Note You need to log in before you can comment on or make changes to this bug.
Description panxiaohe 2021-11-10 15:55:52 UTC
Created attachment 13772 [details]
Fix-demangle-styles-of-usage-about-nm-and-objdump.patch

Hello,

There are following demangling styles in include/demangle.h.
  "auto", "gnu-v3", "java", "gnat", "dlang", "rust"
But usage of nm and objdump still displays old styles.
So if you execute --demangle=gnu, it will display error message:
#nm -C --demange=gnu a.out
nm: unknown demangling style `gnu'
Comment 1 Alan Modra 2021-11-11 12:02:45 UTC
I'm writing a new function for use in nm, objdump and readelf.

/* Print the list of demangling styles to STREAM.  A one line MSG is
   printed before the styles.  Output is limited to 80 columns, with
   continuation lines being indented by leading spaces in MSG.  */

void
display_demangler_styles (FILE *stream, const char *msg)

This should mean we never need worry about updating the --demangle usage message as libiberty evolves.
Comment 2 cvs-commit@gcc.gnu.org 2021-11-12 04:25:11 UTC
The master branch has been updated by Alan Modra <amodra@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0d64622696e02ad649d048f4af3a3f293481f89f

commit 0d64622696e02ad649d048f4af3a3f293481f89f
Author: Alan Modra <amodra@gmail.com>
Date:   Thu Nov 11 20:21:32 2021 +1030

    Fix demangle style usage info
    
    Extract allowed styles from libiberty, so we don't have to worry about
    our help messages getting out of date.  The function probably belongs
    in libiberty/cplus-dem.c but it can be here for a while to iron out
    bugs.
    
            PR 28581
            * demanguse.c: New file.
            * demanguse.h: New file.
            * nm.c (usage): Break up output.  Use display_demangler_styles.
            * objdump.c (usage): Use display_demangler_styles.
            * readelf.c (usage): Likewise.
            * Makefile.am: Add demanguse.c and demanguse.h.
            * Makefile.in: Regenerate.
            * po/POTFILESin: Regenerate.
Comment 3 Alan Modra 2021-11-12 04:38:37 UTC
Fixed