Commit d87b11a6 authored by Shiz's avatar Shiz
Browse files

Simplify and remove questionable defaults.

parent 6081557a
......@@ -58,13 +58,13 @@ def find_symbol(paths, libraries, symbol):
def main():
parser = argparse.ArgumentParser()
parser.add_argument('-a', '--architecture', default='x86', help='architecture to generate asm code for')
parser.add_argument('-l', '--library', metavar='LIB', default=['c'], action='append', help='libraries to link against')
parser.add_argument('symbols', metavar='SYM', nargs='+', help='symbol to search for')
parser.add_argument('-l', '--library', metavar='LIB', action='append', help='libraries to link against')
parser.add_argument('symbols', metavar='SYM', nargs='*', help='symbol to search for')
args = parser.parse_args()
paths = get_cc_paths()
symbols = {}
libraries = ['lib{}.so'.format(l) for l in args.library]
libraries = ['lib{}'.format(l) for l in args.library or []]
for symbol in args.symbols:
library = find_symbol(paths['libraries'], libraries, symbol)
......
......@@ -28,7 +28,7 @@ mkdir -p obj
cleared=
mksym_args=
files=
symfiles=
symbols=
output=s.out
i=1
......@@ -39,8 +39,8 @@ add_out() {
}
add_syms() {
readelf -s "$1" | grep UND | sed 1d | awk '{ print $8 }' > $1.syms
symfiles="$symfiles $1.syms"
local syms=$(readelf -s "$1" | grep -F UND | sed 1d | awk '{ print $8 }')
symbols="$symbols $syms"
}
for a; do
......@@ -63,6 +63,6 @@ for a; do
esac
done
./ldr/mksyms $mksym_args $(cat $symfiles) > obj/$output.syms.s
./ldr/mksyms $mksym_args $symbols > obj/$output.syms.s
nasm $ASFLAGS obj/$output.syms.s -o obj/$output.header.o
ld $LDFLAGS obj/$output.header.o $files -o bin/$output
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment