Module Name: src Committed By: christos Date: Wed Nov 12 13:23:41 UTC 2014
Modified Files: src/sys/conf: mkldscript.sh Log Message: restore previous functionality, and add what we need with -t <template> To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/conf/mkldscript.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/conf/mkldscript.sh diff -u src/sys/conf/mkldscript.sh:1.2 src/sys/conf/mkldscript.sh:1.3 --- src/sys/conf/mkldscript.sh:1.2 Tue Nov 11 21:15:58 2014 +++ src/sys/conf/mkldscript.sh Wed Nov 12 08:23:41 2014 @@ -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