Bug 2149614

Summary: gcc-annobin.so missing in GCC Toolset 12
Product: Red Hat Enterprise Linux 9 Reporter: Terje Røsten <terje.rosten>
Component: gcc-toolset-12-gccAssignee: Marek Polacek <mpolacek>
Status: CLOSED DUPLICATE QA Contact: qe-baseos-tools-bugs
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.1Keywords: Bugfix, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: No Doc Update
Doc Text:
If this bug requires documentation, please select an appropriate Doc Type value.
Story Points: ---
Clone Of: Environment:
Last Closed: 2023-07-17 16:35:53 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2107575, 2151926, 2164769, 2164771, 2164772, 2164773, 2164774, 2164775    
Bug Blocks:    

Description Terje Røsten 2022-11-30 11:36:53 UTC
Description of problem:

rpmbuild uses %optflags which is:

$ rpm --eval %optflags
-O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1  -m64 -march=x86-64-v2 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection

Note this part:

 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1

The file /usr/lib/rpm/redhat/redhat-annobin-cc1 contains:

*cc1_options:
+ %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=gcc-annobin}

Note the use of -fplugin=gcc-annobin

This works for GCC 11 as 

$ rpm -ql gcc-plugin-annobin | tail -3
/usr/lib/gcc/x86_64-redhat-linux/11/plugin/gcc-annobin.so
/usr/lib/gcc/x86_64-redhat-linux/11/plugin/gcc-annobin.so.0
/usr/lib/gcc/x86_64-redhat-linux/11/plugin/gcc-annobin.so.0.0.0

However, for GCC 12 there are no gcc-annobin.so*:

$ rpm -ql gcc-toolset-12-annobin-plugin-gcc
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/plugin/annobin-plugin-version-info
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/plugin/annobin.so
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/plugin/annobin.so.0
/opt/rh/gcc-toolset-12/root/usr/lib/gcc/x86_64-redhat-linux/12/plugin/annobin.so.0.0.0

This means we can't mix default rpmbuild %optflags and GCC 12, which make usefulness of GCC 12 very small,
it can't be used to build rpms.

Can the gcc-annobin.so files required via rpmbuild's %optflags please be added to gcc-toolset-12?

Comment 1 Marek Polacek 2022-12-02 21:53:22 UTC
It looks like this is essentially a dup of bug 2107575.

Comment 2 Marek Polacek 2023-07-17 16:35:53 UTC

*** This bug has been marked as a duplicate of bug 2107575 ***