GaloisInc / saw-script

The SAW scripting language.
BSD 3-Clause "New" or "Revised" License
442 stars 63 forks source link

Match against `LLVMValString` in overrides (#2148) #2149

Closed RyanGlScott closed 1 week ago

RyanGlScott commented 1 week ago

LLVM will sometimes optimize uint8_t arrays into top-level string constants. For example, Clang will optimize uint8_t xs[4] = {0,1,2,3}; into the LLVM string constant "\00\01\02\03". This is still a value of type [4 x i8], but it uses string syntax for convenience. crucible-llvm mirrors this choice by having a dedicated LLVMValString value alongside the more general LLVMValArray, with the former using a ByteString as its payload for convenience.

While SAW's LLVM override matching logic had cases for LLVMValArray, it did not have cases for LLVMValString, which meant that any override that needs to match on an LLVM string constant argument would fail. This is easily fixed by adding the missing cases.

Fixes #2148.