restore previous functionality, and add what we need with -t <template>
This commit is contained in:
parent
2cab231d44
commit
f0d25730ac
@ -1,21 +1,48 @@
|
||||
#!/bin/sh
|
||||
# $NetBSD: mkldscript.sh,v 1.2 2014/11/12 02:15:58 christos Exp $
|
||||
# $NetBSD: mkldscript.sh,v 1.3 2014/11/12 13:23:41 christos Exp $
|
||||
#
|
||||
# This script is used by cats, luna68k and shark to produce
|
||||
# a kernel linker script that merges link sets for a.out kernels
|
||||
# (without -t). It is also used for the same reason by kernel modules
|
||||
# (with -t).
|
||||
|
||||
TEMPLATE="$1"
|
||||
shift
|
||||
PROG="$(basename "$0")"
|
||||
TEMPLATE=
|
||||
|
||||
mksets() {
|
||||
"${OBJDUMP:-objdump}" -x "$@" | fgrep "RELOCATION RECORDS FOR [link_set" | \
|
||||
sort -u | sed 's/^.*\[\(.*\)\]:$/\1/'
|
||||
}
|
||||
|
||||
while getopts "t:" f; do
|
||||
case "$f" in
|
||||
t)
|
||||
TEMPLATE=${OPTARG};;
|
||||
*)
|
||||
echo "Usage: $PROG [-t <template>] objs" 1>^&2
|
||||
exit 1;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((OPTIND - 1))
|
||||
|
||||
SETS=$(mksets "$@")
|
||||
|
||||
if [ -n "${TEMPLATE}" ]; then
|
||||
grep -v '^}$' "${TEMPLATE}"
|
||||
fi
|
||||
|
||||
grep -v '^}$' "$TEMPLATE"
|
||||
for s in $SETS; do
|
||||
printf ' . = ALIGN(4);\n'
|
||||
printf ' PROVIDE (__start_%s = .);\n' $s
|
||||
printf ' %s : { *(%s) }\n' $s $s
|
||||
if [ -n "${TEMPLATE}" ]; then
|
||||
printf ' %s : { *(%s) }\n' $s $s
|
||||
else
|
||||
printf ' *(%s)\n' $s
|
||||
fi
|
||||
printf ' PROVIDE (__stop_%s = .);\n' $s
|
||||
done
|
||||
printf '}\n'
|
||||
|
||||
if [ -n "${TEMPLATE}" ]; then
|
||||
printf '}\n'
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user