Bug 1548707

Summary: libsmi: Partial build flags injection
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: libsmiAssignee: Tom "spot" Callaway <tcallawa>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: fweimer, jose.p.oliveira.oss, jsafrane, rvokal, tcallawa
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-05 19:29:00 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: 1539083    

Description Florian Weimer 2018-02-24 13:05:56 UTC
/usr/lib64/libsmi.so.2.0.27 in libsmi-0.4.8-21.fc28.x86_64 has not been linked with the standard Fedora linker flags (LDFLAGS) from redhat-rpm-config:

libtool: link: gcc -shared  -fPIC -DPIC  .libs/data.o .libs/check.o .libs/error.o .libs/util.o .libs/snprintf.o .libs/smi.o .libs/parser-smi.o .libs/scanner-smi.o .libs/parser-sming.o .libs/scanner-sming.o    -O2 -g -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -mcet -Wl,-z -Wl,relro   -Wl,-soname -Wl,libsmi.so.2 -o .libs/libsmi.so.2.0.27

-specs=/usr/lib/rpm/redhat/redhat-hardened-ld is missing.

See https://src.fedoraproject.org/rpms/redhat-rpm-config/blob/master/f/buildflags.md for information on RPM macros and environment variables provided by the build environment.

Comment 1 Tom "spot" Callaway 2018-03-05 18:34:20 UTC
The full invocation is:

/usr/bin/libtool --tag=CC   --mode=link gcc  -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -mcet -fcf-protection  -version-info 2:27:0 -Wl,-z,relro  -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -o libsmi.la -rpath /usr/lib64 data.lo check.lo error.lo util.lo snprintf.lo smi.lo parser-smi.lo scanner-smi.lo parser-sming.lo scanner-sming.lo

As you can see, the -specs=/usr/lib/rpm/redhat/redhat-hardened-ld is present, but libtool strips it out when making the shared library file. This seems to be intentional on libtool's part, since it strips out any flags that it does not have whitelisted.

I'm not sure how to resolve this.

Comment 2 Florian Weimer 2018-03-05 19:02:33 UTC
I filed this bug before the change in bug 1548397.  With a bit of luck, a rebuild will fix the lack of BIND_NOW.

Comment 3 Tom "spot" Callaway 2018-03-05 19:10:46 UTC
"-Wl,-z -Wl,now" now makes it through libtool into the gcc -shared call. I'll rebuild if that's all we need.

Comment 4 Florian Weimer 2018-03-05 19:23:39 UTC
(In reply to Tom "spot" Callaway from comment #3)
> "-Wl,-z -Wl,now" now makes it through libtool into the gcc -shared call.
> I'll rebuild if that's all we need.

Yes, please.  For Fedora 28 and rawhide.

Comment 5 Tom "spot" Callaway 2018-03-05 19:29:00 UTC
Fixed in libsmi-0.4.8-22.fc29 (rawhide) and ibsmi-0.4.8-22.fc28 (F28).