3 # Test input arguments:
4 # $1 is path to the HHVM binary.
5 # $2 is the path to thread_locals.txt.
7 # We use `nm` to list symbols, filter to thread locals in the HPHP:: namespace,
8 # use cut to select just the name, then strip trailing whitespace and ABI tags.
10 nm
--demangle --format sysv
"$1" \
12 |
grep -v 'HPHP::HHBBC::' \
13 |
grep '\(\.tbss\|\.tdata\)' \
14 | cut
--delimiter '|' --field 1 \
16 |
sed -e 's/\[abi:[^]]*\]$//' \
19 # Remove bash-style comments from the whitelist file.
20 WHITELIST
=$
(sed -e 's/ *#.*//' "$2")
22 # comm -23 returns lines in the first input that are not in the second.
23 # We need -u becaues a symbol may appear multiple times with different ABI tags.
24 EXTRA
=$
(comm -23 <(echo "$ALL" |
sort -u) <(echo "$WHITELIST" |
sort -u))
28 --------------------------------------------------------------------------------
29 \\e[0;31mERROR: New thread locals detected.\\e[0m
30 Per-request memory should be allocated using RDS locals to allow for
31 userland scheduling. New thread locals indicate a potential logic error.
32 If these thread locals are necessary, add them to thread_locals.txt:
35 --------------------------------------------------------------------------------