Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1056669

Summary: please add -msse -msse2 for i686 builds
Product: Red Hat Enterprise Linux 7 Reporter: Pat Riehecky <riehecky>
Component: rpmAssignee: Florian Festi <ffesti>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: csieh, ffesti, jakub, misterbonnie, mpolacek, ohudlick
Target Milestone: rcKeywords: EasyFix
Target Release: ---   
Hardware: i686   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-14 07:18:25 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:    
Bug Blocks: 1289025    
Attachments:
Description Flags
a mock config
none
Spec file for quick demonstration none

Description Pat Riehecky 2014-01-22 16:54:17 UTC
Created attachment 853963 [details]
a mock config

Description of problem: The rhel7 redhat-rpm-config rpmrc sets -m32 -march=x86-64 -mfpmath=sse to provide more optimized binaries.  However, when compiling x86_64 binaries with -m64 -march=x86_64 the -msse -msse2 options are automatically enabled.

On i686 builds, where sse would be used, no sse is enabled by default and the build fails due to the use of '-mfpmath=sse'


Version-Release number of selected component (if applicable):redhat-rpm-config-9.1.0-56.el7


How reproducible: 100%


Steps to Reproduce:
1. populate minimal buildroot for i686 with redhat-rpm-config (Fed 19 gcc and friends are fine)
2. find source using sse (tboot-1.7.3-3.el7.src.rpm)
3. rpmbuild --rebuild --target=i686 tboot-1.7.3-3.el7.src.rpm
4. build fails
5. add -msse -msse2 to /usr/lib/rpm/redhat/rpmrc's i686 line
6. rpmbuild --rebuild --target=i686 tboot-1.7.3-3.el7.src.rpm
7. build succeeds
8. rpmbuild --rebuild --target=x86_64 tboot-1.7.3-3.el7.src.rpm
9. build succeeds

Actual results:
cannot build certian i686 C files due to compile opts

Expected results:
sse enabled when -mfpmath=sse is used

Additional info:
My tests show -msse -msse2 does not alter the size or configuration of the binary when sse instructions are not in use

Comment 2 Pat Riehecky 2014-01-22 21:11:06 UTC
Created attachment 854045 [details]
Spec file for quick demonstration

The attached spec is extra simple, but demonstrates the problem in a clean way - i think....

Comment 3 RHEL Program Management 2014-03-22 06:10:27 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 5 Florian Festi 2016-05-12 07:22:56 UTC
Can someone from the tools team please comment on whether this is save and then bounce the bug back to redhat-rpm.config?

Thanks!

Comment 6 Jakub Jelinek 2016-05-12 07:30:09 UTC
-mfpmath=sse should be of course only used with -msse2, unless it is implied by -march.  -msse is implied by -msse2.
On x86_64, -mfpmath=sse as well as -msse2 are the default, no need to specify them.  On i686, if we only support x86_64 capable CPUs, we should either use
-march=x86-64 -mtune=generic -mfpmath=sse, or -mfpmath=sse -msse2 (or do we tune for something else, in Fedora for atom?).

Comment 7 Jakub Jelinek 2016-05-12 07:35:26 UTC
Note that RHEL7 gcc defaults to -march=x86-64, and that option already implies SSE and SSE2 (and MMX, FXSR and NO_SAHF).
You can easily check if SSE2 is enabled by running gcc -E -dD -xc /dev/null | grep SSE
and check for __SSE__, __SSE2__, __SSE_MATH__ and __SSE2_MATH__ macros.

Comment 8 Jakub Jelinek 2016-05-12 07:40:57 UTC
Perhaps the tboot package (whatever it is) adds -march=i386 or similar option to flags, then obviously the build would fail.  But it would be a package then, if it wants to change the arch, it should either filter out -mfpmath=sse, or add -msse2.

Comment 9 Florian Festi 2016-06-14 07:18:25 UTC
I don't feel really confident to change the flags as this has compatibility implications for all our 32 bit code. Packages that rely on these flags should just set them manually in the spec file for now.