diff options
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. |