Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lto-rebuild fails to find archives for GCC 12 -> 13 update #878

Open
zeule opened this issue May 5, 2023 · 1 comment
Open

lto-rebuild fails to find archives for GCC 12 -> 13 update #878

zeule opened this issue May 5, 2023 · 1 comment

Comments

@zeule
Copy link
Contributor

zeule commented May 5, 2023

Because a GCC 12 version contains"p13".

@zeule
Copy link
Contributor Author

zeule commented May 5, 2023

A simple fix:

--- /usr/bin/lto-rebuild.orig    2023-05-02 23:20:59.064006276 +0200
+++ /usr/bin/lto-rebuild 2023-05-05 21:10:58.499995951 +0200
@@ -27,6 +27,7 @@
 {
 local prefix="${EROOT%/}/usr/lib"
 local suffix="\.a"
+local all_archives=()
 local archives=()
 local packages=()
 local GCC_VER=""
@@ -41,16 +42,18 @@
 
 # Exclude /usr/lib/gcc/<arch> because these are internal
 # to the [cross-]compilers on the system
-mapfile -t archives < <(
+mapfile -t all_archives < <(
    find "${prefix}"{,64,32} -type f -name "*${suffix}" \
-   -exec readelf -p .comment {} + \
    -o -path "${prefix}64/gcc" -prune \
    -o -path "${prefix}32/gcc" -prune \
-   -o -path "${prefix}/gcc" -prune 2> /dev/null | \
-   grep -v "${GCC_VER}" | grep -B3 "GCC:" | \
-   grep -o "${prefix}.*${suffix}" | uniq
+   -o -path "${prefix}/gcc" -prune 2> /dev/null
 )
 
+for a in ${all_archives[@]}; do
+   gcc_ver=$(readelf -p .comment "$a" 2>/dev/null | grep "GCC:" | sed -E 's/^.+\(.+\) ([0-9]+).*$/\1/' | sort -u | head -1 )
+   [[ ! -z $gcc_ver && $gcc_ver != $GCC_VER ]] && archives+=( "$a" )
+done
+
 if [[ ${#archives[@]} -eq 0 ]]
 then
    echo "No problems found!" >&2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant