diff --git a/implib-gen.py b/implib-gen.py index b293f6e..8ecb902 100755 --- a/implib-gen.py +++ b/implib-gen.py @@ -146,6 +146,19 @@ def collect_relocs(f): error("multiple headers in output of readelf") words = re.split(r'\s\s+', line) # "Symbol's Name + Addend" toc = make_toc(words) + elif re.match(r'^\s*r_offset', line): # FreeBSD header? + if toc is not None: + error("multiple headers in output of readelf") + words = re.split(r'\s\s+', line) # "st_name + r_addend" + toc = make_toc(words) + rename = { + 'r_offset' : 'Offset', + 'r_info' : 'Info', + 'r_type' : 'Type', + 'st_value' : 'Symbol\'s Value', + 'st_name + r_addend' : 'Symbol\'s Name + Addend', + } + toc = {idx : rename[name] for idx, name in toc.items()} elif toc is not None: line = re.sub(r' \+ ', '+', line) words = re.split(r'\s+', line) diff --git a/scripts/install-freebsd-prereqs.sh b/scripts/install-freebsd-prereqs.sh new file mode 100755 index 0000000..c34f268 --- /dev/null +++ b/scripts/install-freebsd-prereqs.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +set -eu + +pkg update +pkg upgrade +pkg install gcc g++ binutils python3 diff --git a/tests/basic/run.sh b/tests/basic/run.sh index afb220b..99c2376 100755 --- a/tests/basic/run.sh +++ b/tests/basic/run.sh @@ -25,6 +25,7 @@ fi . ../common.sh CFLAGS="-g -O2 $CFLAGS" +CFLAGS="-Wno-unused-command-line-argument $CFLAGS" # For -no-pie on BSD # Build shlib to test against $CC $CFLAGS -shared -fPIC interposed.c -o libinterposed.so