kit

kit
git clone https://git.ryansepassi.com/git/kit.git
Log | Files | Refs | README

02-symbols-global-local.sh (520B)


      1 # Golden: symbol table for a rv64 object with one global + one static
      2 # function. Asserts both kinds appear with correct binding chars.
      3 
      4 cat > t.c <<'EOF'
      5 int g_func(int x) { return x; }
      6 static int s_func(int x) { return x + 1; }
      7 int caller(int x) { return g_func(x) + s_func(x); }
      8 EOF
      9 "$KIT" cc -target riscv64-linux -c t.c -o t.o
     10 "$KIT" objdump -t t.o | awk '
     11 /^SYMBOL TABLE/ {print; next}
     12 NF >= 6 {
     13     name=$NF
     14     if (name=="g_func" || name=="s_func" || name=="caller")
     15         printf "%s %s %s\n", $2, $3, name
     16 }'