b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 1 | #!/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 | |||||
7 | cross="$1"; shift | ||||
8 | ref="$1"; shift | ||||
9 | pic="$1"; shift | ||||
10 | dest="$1"; shift | ||||
11 | |||||
12 | SYMBOLS="$(${cross}nm "$ref" | grep -E '........ [TW] ' | awk '$3 {printf "-u%s ", $3}')" | ||||
13 | set -x | ||||
14 | ${cross}gcc -nostdlib -nostartfiles -shared -Wl,--gc-sections -o "$dest" $SYMBOLS "$pic" "$@" |