blob: 5367b70935f0482c819234ac928f9c5615796938 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#!/bin/sh
2[ $# -lt 4 -o -z "$1" -o -z "$2" -o -z "$3" -o -z "$4" ] && {
3 echo "Usage: $0 <cross> <reference> <pic .a> <destination>"
4 exit 1
5}
6
7cross="$1"; shift
8ref="$1"; shift
9pic="$1"; shift
10dest="$1"; shift
11
12SYMBOLS="$(${cross}nm "$ref" | grep -E '........ [TW] ' | awk '$3 {printf "-u%s ", $3}')"
13set -x
14${cross}gcc -nostdlib -nostartfiles -shared -Wl,--gc-sections -o "$dest" $SYMBOLS "$pic" "$@"