#!/bin/sh
# make ksym.h file from globals.txt
# this is done by translating the file globals.txt (generated by lld)
# line by line...
#   <Address> : <Label>
# becomes
#   #define lkf_<Label> $<Address>

cat globals.txt | (
  echo "#ifndef _KSYM_H"
  echo "#define _KSYM_H"
  while read ADDR SEP GLOBAL
  do
    echo "#define lkf_$GLOBAL \$$ADDR"
  done
  echo "#endif" ) >../include/ksym.h
