Fix brp-llvm-compile-lto to not rely on a backtracking regex
Instead, grep the llvm-strings output for "-flto" and "-fno-lto" and recognize the input as LTO input if -flto has a byte index greater than -fno-lto.
This commit is contained in:
parent
b2a58c86fb
commit
25ea080503
@ -16,14 +16,20 @@ check_convert_bitcode () {
|
|||||||
CLANG_FLAGS="$@"
|
CLANG_FLAGS="$@"
|
||||||
|
|
||||||
if [[ "${file_type}" == *"LLVM IR bitcode"* ]]; then
|
if [[ "${file_type}" == *"LLVM IR bitcode"* ]]; then
|
||||||
# check for an indication that the bitcode was
|
# Check the output of llvm-strings for the command line, which is in the LLVM bitcode because
|
||||||
# compiled with -flto
|
# we pass -frecord-gcc-switches.
|
||||||
llvm-bcanalyzer -dump ${file_name} | grep -xP '.*\-flto((?!-fno-lto).)*' 2>&1 > /dev/null
|
# Check for a line that has "-flto" after (or without) "-fno-lto".
|
||||||
if [ $? -eq 0 ]; then
|
llvm-strings ${file_name} | while read line ; do
|
||||||
echo "Compiling LLVM bitcode file ${file_name}."
|
flto=$(echo $line | grep -o -b -e -flto | tail -n 1 | cut -d : -f 1)
|
||||||
clang ${CLANG_FLAGS} -fno-lto -Wno-unused-command-line-argument \
|
fnolto=$(echo $line | grep -o -b -e -fno-lto | tail -n 1 | cut -d : -f 1)
|
||||||
-x ir ${file_name} -c -o ${file_name}
|
|
||||||
fi
|
if test -n "$flto" && { test -z "$fnolto" || test "$flto" -gt "$fnolto"; } ; then
|
||||||
|
echo "Compiling LLVM bitcode file ${file_name}."
|
||||||
|
clang ${CLANG_FLAGS} -fno-lto -Wno-unused-command-line-argument \
|
||||||
|
-x ir ${file_name} -c -o ${file_name}
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
elif [[ "${file_type}" == *"current ar archive"* ]]; then
|
elif [[ "${file_type}" == *"current ar archive"* ]]; then
|
||||||
echo "Unpacking ar archive ${file_name} to check for LLVM bitcode components."
|
echo "Unpacking ar archive ${file_name} to check for LLVM bitcode components."
|
||||||
# create archive stage for objects
|
# create archive stage for objects
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# 2) When making changes, increment the version (in baserelease) by 1.
|
# 2) When making changes, increment the version (in baserelease) by 1.
|
||||||
# rpmdev-bumpspec and other tools update the macro below, which is used
|
# rpmdev-bumpspec and other tools update the macro below, which is used
|
||||||
# in Version: to get the desired effect.
|
# in Version: to get the desired effect.
|
||||||
%global baserelease 231
|
%global baserelease 232
|
||||||
|
|
||||||
Summary: Red Hat specific rpm configuration files
|
Summary: Red Hat specific rpm configuration files
|
||||||
Name: redhat-rpm-config
|
Name: redhat-rpm-config
|
||||||
@ -221,6 +221,9 @@ install -p -m 644 -t %{buildroot}%{_rpmluadir}/fedora/srpm forge.lua
|
|||||||
%doc buildflags.md
|
%doc buildflags.md
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Fri Sep 23 2022 Timm Bäder <tbaeder@redhat.com> - 232-1
|
||||||
|
- Fix brp-compile-lto-elf to not rely on a backtracking regex
|
||||||
|
|
||||||
* Thu Sep 08 2022 Maxwell G <gotmax@e.email> - 231-1
|
* Thu Sep 08 2022 Maxwell G <gotmax@e.email> - 231-1
|
||||||
- forge macros: Support Sourcehut. Fixes rhbz#2035935.
|
- forge macros: Support Sourcehut. Fixes rhbz#2035935.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user