Bug 1547522

Summary: autogen: Partial injection of Fedora build flags
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: autogenAssignee: Anthony Green <green>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: debarshir, green, mlichvar
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-02-21 18:06:23 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-21 13:30:06 UTC
/usr/lib64/libopts.so.25.16.1 in autogen-libopts-5.18.12-6.fc28.x86_64 has not been linked with the standard Fedora linker flags (LDFLAGS) from redhat-rpm-config:

libtool: link: gcc -Wl,--as-needed -shared  -fPIC -DPIC  .libs/libopts_la-libopts.o  -Wl,--whole-archive ../snprintfv/.libs/libsnprintfv.a -Wl,--no-whole-archive  -lm -ldl  -O2 -g -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -mcet -Wl,-z -Wl,relro   -Wl,-soname -Wl,libopts.so.25 -o .libs/libopts.so.25.16.1

This is a bit odd because we do start out with the correct flags:

+ LDFLAGS='-Wl,-z,relro  -specs=/usr/lib/rpm/redhat/redhat-hardened-ld'

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 Miroslav Lichvar 2018-02-21 18:06:23 UTC
Thanks for the report. The problem was in the RPATH fix. It replaced the generated libtool with /usr/bin/libtool, which doesn't seem to include the hardening hack.

It should be fixed in autogen-5.18.12-7.

From the build log:
libtool: link: gcc -Wl,--as-needed -shared  -fPIC -DPIC  .libs/libopts_la-libopts.o  -Wl,--whole-archive ../snprintfv/.libs/libsnprintfv.a -Wl,--no-whole-archive  -lm -ldl -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -O2 -m64 -mtune=generic -mcet -Wl,-z -Wl,relro   -Wl,-soname -Wl,libopts.so.25 -o .libs/libopts.so.25.16.1