diff options
author | P. J. McDermott <pj@pehjota.net> | 2016-02-23 01:55:27 (EST) |
---|---|---|
committer | P. J. McDermott <pj@pehjota.net> | 2016-02-23 01:57:17 (EST) |
commit | bbd1319faf0599a374051a0af04a553292298e96 (patch) | |
tree | 06d0b03a5c00c7dfe9cf6488272127a6fccd29fa /eshld/link.esh | |
parent | 43a8cf835bf017b3362f5dd02efa74f69537462d (diff) | |
download | eggshell-bbd1319faf0599a374051a0af04a553292298e96.zip eggshell-bbd1319faf0599a374051a0af04a553292298e96.tar.gz eggshell-bbd1319faf0599a374051a0af04a553292298e96.tar.bz2 |
eshld: Add runtime library
Diffstat (limited to 'eshld/link.esh')
-rw-r--r-- | eshld/link.esh | 28 |
1 files changed, 6 insertions, 22 deletions
diff --git a/eshld/link.esh b/eshld/link.esh index d01fc4d..d674821 100644 --- a/eshld/link.esh +++ b/eshld/link.esh @@ -1,6 +1,6 @@ -# Eggshell Linker entry point +# Eggshell Linker program linking functions # -# Copyright (C) 2015 Patrick "P. J." McDermott +# Copyright (C) 2015, 2016 Patrick "P. J." McDermott # # This file is part of the Eggshell Linker. # @@ -50,20 +50,11 @@ link_begin() die 'Cannot open file "%s"' "${output}~" fi - # Write magic number and interpreter path. + # Add a magic number with interpreter path and the runtime library. if ${make_executable}; then printf '#!%s\n' "${interpreter}" >&3 + eshrtbegin >&3 fi - - # Write __init() function. - cat >&3 <<-'EOF' - __init_funcs='' - __init() - { - __init_funcs="${__init_funcs} ${1}" - } - EOF - } link_file() @@ -77,16 +68,9 @@ link_file() link_end() { - # Add call to init functions. - cat >&3 <<-'EOF' - for __func in ${__init_funcs}; do - ${__func} - done - EOF - - # Add call to entry point. + # Add calls to __init functions and the entry point. if ${make_executable}; then - printf '%s "${@}"\n' "${entry_point}" >&3 + eshrtend "${entry_point}" >&3 fi # Close output file, make it executable, and set its name. |