Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/conf restore previous functionality, and add what we nee...



details:   https://anonhg.NetBSD.org/src/rev/b875bdf9bfd2
branches:  trunk
changeset: 333651:b875bdf9bfd2
user:      christos <christos%NetBSD.org@localhost>
date:      Wed Nov 12 13:23:41 2014 +0000

description:
restore previous functionality, and add what we need with -t <template>

diffstat:

 sys/conf/mkldscript.sh |  39 +++++++++++++++++++++++++++++++++------
 1 files changed, 33 insertions(+), 6 deletions(-)

diffs (58 lines):

diff -r 514742903742 -r b875bdf9bfd2 sys/conf/mkldscript.sh
--- a/sys/conf/mkldscript.sh    Wed Nov 12 10:47:20 2014 +0000
+++ b/sys/conf/mkldscript.sh    Wed Nov 12 13:23:41 2014 +0000
@@ -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



Home | Main Index | Thread Index | Old Index