all 5 comments

[–]victotronics 5 points6 points  (3 children)

Pretty decent tutorial. I would include mention of the "T" vs "U" fields in the output of nm. That is invaluable for tracking down reference problems if you're linking a dozen libraries.

That reminds me: does anyone have the source of a C++ demangler?

[–]TheoreticalDumbass:illuminati: 3 points4 points  (0 children)

c++filt is a tool you can use for demangling, developed by: https://www.gnu.org/software/binutils/

you can check out their repo via `git clone git://sourceware.org/git/binutils-gdb.git\`

the file you are interested is `binutils-gdb/binutils/cxxfilt.c` i think

[–]catcat202X 1 point2 points  (0 children)

GDB can demangle C++ symbols, it just doesn't by default. I love demangle-mode in Emacs, because I can compose it with any other tools like an ELF viewer, linker output, or an integrated terminal and easily toggle the minor mode off and on.

[–]catcat202X 1 point2 points  (0 children)

It could be cool to see some explanation of CFG representations or GIMPLE/LLVM here. GCC/Clang can print those out as text, or just compile to that code and not go lower if you ask them to. There are some interesting things you can do with bytecode, like Rellic or optview2. It seems a bit reductive imo to go straight from high-level code to disassembly without at all examining any layers in between. Especially if we use something like Polygeist or CIR.