C++ linker presentation
This commit is contained in:
27
cpplinker/03_name_mangling/build.sh
Normal file
27
cpplinker/03_name_mangling/build.sh
Normal file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
echo "=== Compile to object file ==="
|
||||
g++ -std=c++17 -c mangling.cpp -o mangling.o
|
||||
|
||||
echo ""
|
||||
echo "=== Raw mangled symbols ==="
|
||||
nm -g mangling.o | grep -E "process|sqrt|dot|legacy"
|
||||
|
||||
echo ""
|
||||
echo "=== Demangled symbols ==="
|
||||
nm -C -g mangling.o | grep -E "process|sqrt|dot|legacy"
|
||||
|
||||
echo ""
|
||||
echo "=== Demangle individual symbols ==="
|
||||
echo "_Z7processi" | c++filt
|
||||
echo "_Z7processd" | c++filt
|
||||
echo "_Z7processid" | c++filt
|
||||
echo "_ZN4Math4sqrtEd" | c++filt
|
||||
echo "_ZN6Vector3dotERKS_" | c++filt
|
||||
echo "legacy_init" | c++filt
|
||||
|
||||
echo ""
|
||||
echo "=== Build and run ==="
|
||||
g++ -std=c++17 mangling.o -o app
|
||||
./app
|
||||
Reference in New Issue
Block a user