line=$(printf "#define %-20s 0x%04x" $prefix$name $rodata)
}
+fn="${1:-.}/pico_int_offs.h"
if echo $CFLAGS | grep -qe -flto; then CFLAGS="$CFLAGS -fno-lto"; fi
+
+# don't do this if readelf isn't available. it doesn't matter since offsets are
+# only needed for the asm parts (currently mips/arm32) and those have readelf
+if ! command -v readelf >/dev/null; then
+ echo "/* mkoffset.sh: readelf not found, offset table not created */" >$fn
+ echo "WARNING: readelf not found, offset table not created"
+ exit
+fi
# determine endianess
echo '#include <stdint.h>' >/tmp/getoffs.c
echo "const int32_t val = 1;" >>/tmp/getoffs.c
compile_rodata
ENDIAN=$(if [ "$rodata" -eq 1 ]; then echo be; else echo le; fi)
# output header
-fn="${1:-.}/pico_int_offs.h"
echo "/* autogenerated by mkoffset.sh, do not edit */" >$fn
echo "/* target endianess: $ENDIAN, compiled with: $CC $CFLAGS */" >>$fn
# output offsets