When we converted our libffi assembly preprocessing to use
GENERATED_FILES, we translated
sed 's%/F[dpa][^ ]*%%g' to use the Python
'F[dpa][^ ]*'. Note that we missed the leading
the sed expression; omitting that leading slash causes no end of trouble if
you have particular expressions in your assembly file, such as
"FastFailCode". (I'm a little surprised this hasn't bitten us yet.)
The straightfoward fix is to add the leading slash.
But wait, the rabbit hole goes deeper. The actual bit from libffi's
msvcc.sh that this was trying to translate was:
echo "$cl -nologo -EP $includes $defines $src > $ppsrc"
"$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $?
output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')"
args="-nologo $safeseh $single $output $ppsrc"
echo "$ml $args"
eval "\"$ml\" $args"
Note that the sed expression is operating on
$output, which is a
completely separate thing from the output from the result of
$output is actually some arguments that are
supposed to be passed to the assembler, per the above and the only place in
the script that sets
$output to a non-trivial value:
base="$(basename $2|sed 's/\.[^.]*//g')"
if [ -n "$single" ]; then
if [ -n "$assembly" ]; then
args="$args $output -Fd$outdir/$base -Fp$outdir/$base -Fa$outdir/$base"
Presumably the sed expression is attempting to remove
-Fd and friends from
$args instead of
$output, but failing badly at doing so.
In any event, the regex substitution the script is doing is unnecessary and,
with the current code, actively harmful. Let's remove the regular
expression substitution entirely.