<commit_before>#!/bin/sh

# TODO:
# * support versioned symbols
# * compile with -ffreestanding to avoid autogenerated memset and crap

set -e

cd $(dirname $0)

mkdir -p bin
rm -f bin/*

scripts/gendefs.py > bin/all_libc_syms.def

CPPFLAGS='-Iinclude -Ibin -D_GNU_SOURCE'

CFLAGS='-g -O2'
CFLAGS="$CFLAGS -Wall -Wextra -Werror"
CFLAGS="$CFLAGS -fvisibility=hidden -fPIC -shared"
#CFLAGS="$CFLAGS -g -O0 -save-temps"

LDFLAGS='-Wl,--no-as-needed -ldl -lm -lpthread'

gcc -o bin/libsigtester.so src/*.c $CPPFLAGS $CFLAGS $LDFLAGS

# Quick check
LD_PRELOAD=bin/libsigtester.so ls
<commit_msg>Do sanity checking on bash instead of ls.<commit_after>#!/bin/sh

# TODO:
# * support versioned symbols
# * compile with -ffreestanding to avoid autogenerated memset and crap

set -e

cd $(dirname $0)

mkdir -p bin
rm -f bin/*

scripts/gendefs.py > bin/all_libc_syms.def

CPPFLAGS='-Iinclude -Ibin -D_GNU_SOURCE'

CFLAGS='-g -O2'
CFLAGS="$CFLAGS -Wall -Wextra -Werror"
CFLAGS="$CFLAGS -fvisibility=hidden -fPIC -shared"
#CFLAGS="$CFLAGS -g -O0 -save-temps"

LDFLAGS='-Wl,--no-as-needed -ldl -lm -lpthread'

gcc -o bin/libsigtester.so src/*.c $CPPFLAGS $CFLAGS $LDFLAGS

# Quick check
SIGTESTER_VERBOSE=1 LD_PRELOAD=bin/libsigtester.so bash -c 'whoami; whoami'

{'fraction_non_alphanumeric': 0.1456, 'fraction_numerical': 0.0056, 'mean_word_length': 4.044354838709677, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6995157', 'n_tokens_mistral': 532, 'n_tokens_neox': 505, 'n_words': 129}