Bug 1548707 - libsmi: Partial build flags injection
Summary: libsmi: Partial build flags injection
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: libsmi
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Tom "spot" Callaway
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks: Fedora28BuildFlags
TreeView+ depends on / blocked
 
Reported: 2018-02-24 13:05 UTC by Florian Weimer
Modified: 2018-03-05 19:29 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-03-05 19:29:00 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

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).


Note You need to log in before you can comment on or make changes to this bug.