33A tool for testing compiler optimization by compiling the same code under
44various optimization levels and comparing emulation results.
55
6+ Currently, only x86 is supported.
7+
68Name subject to change.
79
810## Requirements
@@ -11,18 +13,23 @@ Name subject to change.
1113poetry install
1214```
1315
16+ Please ensure that the target LLVM binaries are in PATH.
17+
18+ In addition, download and ` make ` CSmith runtime files in home directory (i.e.
19+ ` ~/csmith/runtime ` ). In the future, the location of the runtime directory will
20+ be changed into a command-line option that defaults to the system install
21+ location of libcsmith0 package.
22+
23+ For [ IRFuzzer] ( https://github.com/SecurityLab-UCD/IRFuzzer ) -related program
24+ providers such as ` irfuzzer ` and ` mutate-csmith ` , please ensure that the
25+ MutatorDriver is compiled and present in PATH.
26+
1427## Example
1528
1629``` shell
17- # assemble into ELF format
18- as foo.a.s -o foo.a.elf
19- as foo.b.s -o foo.b.elf
20- # copy executable code out of ELF format
21- objcopy -O binary foo.a.elf foo.a.bin
22- objcopy -O binary foo.b.elf foo.b.bin
23- # emulate and compare
24- ./sem.py --arch x86 --mode 64 --count 10000 --seed 12345 foo.{a,b}.bin
30+ # -e 0: Use all cores to compare -O0 and -O3
31+ ./sem.py -p mutate-csmith -e 0 -o ./experiment -O03
2532```
2633
27- If you encounter an "Invalid instruction" error, chances are Unicorn Engine /
28- QEMU does not support the associated CPU extension yet .
34+ To terminate, Ctrl+C and run ` pkill -f sem.py ` . Relevant program seeds can be
35+ found in the specified output directory .
0 commit comments