kit

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

06-rv64-archive-objdump.sh (584B)


      1 # rv64 cross-compile: build an archive of rv64 ELF objects, then read the
      2 # members back through `kit objdump`. Exercises the ar reader on rv64
      3 # object members and confirms format detection per member.
      4 
      5 cat > a.c <<'EOF'
      6 int alpha(int x) { return x + 1; }
      7 EOF
      8 cat > b.c <<'EOF'
      9 int beta(int x) { return x * 2; }
     10 EOF
     11 "$KIT" cc -target riscv64-linux -c a.c -o a.o
     12 "$KIT" cc -target riscv64-linux -c b.c -o b.o
     13 "$KIT" ar rcs lib.a a.o b.o
     14 
     15 echo "== members =="
     16 "$KIT" ar t lib.a | sort
     17 echo "== formats =="
     18 "$KIT" objdump -f lib.a 2>/dev/null | awk '/file format/{print $NF}' | sort -u