Bug 1085127

Summary: optflags should not set -fsigned-char
Product: [Fedora] Fedora Reporter: Aldy Hernandez <aldyh>
Component: rpmAssignee: Packaging Maintenance Team <packaging-team-maint>
Status: CLOSED UPSTREAM QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: unspecified    
Version: rawhideCC: codonell, dan, jzeleny, novyjindrich, packaging-team-maint, pknirsch, pmatilai
Target Milestone: ---   
Target Release: ---   
Hardware: ppc64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-05-07 10:03:56 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: 245418, 1071880    

Description Aldy Hernandez 2014-04-07 22:19:37 UTC
Description of problem:

-fsigned-char is being set in optflags (/usr/lib/rpm/rpmc) for PPC variants:

optflags: ppc -O2 -g -fsigned-char
optflags: ppc8260 -O2 -g -fsigned-char
optflags: ppc8560 -O2 -g -fsigned-char
optflags: ppc32dy4 -O2 -g -fsigned-char
optflags: ppciseries -O2 -g -fsigned-char
optflags: ppcpseries -O2 -g -fsigned-char
optflags: ppc64 -O2 -g -fsigned-char
optflags: ppc64p7 -O3 -mtune=power7 -mcpu=power7 -g -fsigned-char

Most of these are then being overridden by redhat-rpm-config (/usr/lib/rpm/redhat/rpmrc):

optflags: ppc %{__global_cflags} -m32
optflags: ppciseries %{__global_cflags} -m32
optflags: ppcpseries %{__global_cflags} -m32
optflags: ppc64 %{__global_cflags} -m64
optflags: ppc64iseries %{__global_cflags} -m64
optflags: ppc64pseries %{__global_cflags} -m64
optflags: ppc8260 %{__global_cflags} -m32
optflags: ppc8560 %{__global_cflags} -m32

As passing -fsigned-char and -funsigned-char is an ABI change, rpm should NOT be passing these ever.  The compiler should be in charge of setting the ABI.

At least for ppc64, the default ABI is unsigned char, so the override in redhat-rpm-config has everything working fine, but ideally rpm nor its subsidiaries should be passing -fsigned-char or -funsigned-char.

I also see Arm is doing something similar in /usr/lib/rpm/redhat/rpmrc (redhat-rpm-config package):

optflags: armv3l %{__global_cflags} -fsigned-char -march=armv3
optflags: armv4b %{__global_cflags} -fsigned-char -march=armv4
optflags: armv4l %{__global_cflags} -fsigned-char -march=armv4
optflags: armv4tl %{__global_cflags} -march=armv4t
optflags: armv5tel %{__global_cflags} -march=armv5te -mfloat-abi=soft
optflags: armv5tejl %{__global_cflags} -march=armv5te -mfloat-abi=soft
optflags: armv6l %{__global_cflags} -march=armv6 -mfloat-abi=soft
optflags: armv7l %{__global_cflags} -march=armv7-a -mfloat-abi=soft
optflags: armv7hl %{__global_cflags} -march=armv7-a -mfpu=vfpv3-d16  -mfloat-abi=hard
optflags: armv7hnl %{__global_cflags} -march=armv7-a -mfpu=neon  -mfloat-abi=hard

RPM configuration files changing the ABI is highly suspect.

Version-Release number of selected component (if applicable):


How reproducible:

every time


Steps to Reproduce:
1. Look in /usr/lib/rpm/rpmrc and /usr/lib/rpm/redhat/rpmrc.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Panu Matilainen 2014-05-07 10:03:56 UTC
-fsigned-char for ppc dates back to 1997, arm to 1998. Both added with equally little fanfare and non-existent rationale for the selected swithces:
http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=3cb5b141d5d26a73b9d3b4a21763dac1fb3b32ed
http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=d92ce3f6354ce7dba633589a8001348c68cc1351

I'd assume there was a reason, but that would be long lost in history at this point. An rpm maintainer is really not in a position to say what flags any given arch should be using, so whatever is there is whatever "arch folks" have sent for inclusion. The latest example being ppc64le, where -fsigned-char has most likely been carried on just because all the other ppc-entries had it:
http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=cf07feda05822377d62b973adc4010c0d7f9eaa0

What is the proper place for all these different kinds of distro-wide settings is a line drawn in sand at best because rpm's idea of an architecture is not identical to the compilers idea of an architecture, and everybody wants to cook their own on top so we have arm-subarchitectures that differ by their floating point ABI only, etc.

All that said, "fixed" upstream now:
http://rpm.org/gitweb?p=rpm.git;a=commitdiff;h=b08e63f508de91ab5252a6eeec838462f645b360