Bug 1548400

Summary: dialog: Partial build flags injection
Product: [Fedora] Fedora Reporter: Florian Weimer <fweimer>
Component: dialogAssignee: Miroslav Lichvar <mlichvar>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: mlichvar
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dialog-1.3-13.20171209.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-03-29 13:45:12 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-23 12:13:52 UTC
/usr/lib64/libdialog.so.14.0.0 in dialog-1.3-11.20170509.fc28.x86_64 was not linked with the standard Fedora linker flags (LDFLAGS) from redhat-rpm-config:

libtool: link: gcc -shared  -fPIC -DPIC  .libs/trace.o .libs/rc.o .libs/calendar.o .libs/fselect.o .libs/timebox.o .libs/buildlist.o .libs/rangebox.o .libs/treeview.o .libs/formbox.o .libs/guage.o .libs/pause.o .libs/prgbox.o .libs/progressbox.o .libs/tailbox.o .libs/mixedform.o .libs/mixedgauge.o .libs/argv.o .libs/arrows.o .libs/buttons.o .libs/checklist.o .libs/columns.o .libs/dlg_keys.o .libs/editbox.o .libs/help.o .libs/inputbox.o .libs/inputstr.o .libs/menubox.o .libs/mouse.o .libs/mousewget.o .libs/msgbox.o .libs/textbox.o .libs/ui_getc.o .libs/util.o .libs/version.o .libs/yesno.o   -lncursesw -ltinfo -lm  -Wl,-z -Wl,relro   -Wl,-soname -Wl,libdialog.so.14 -o .libs/libdialog.so.14.0.0

-specs=/usr/lib/rpm/redhat/redhat-hardened-ld is missing.  It was still there when LDFLAGS was set at the beginning of the %build section.  So this failure looks libtool-related.

Comment 1 Miroslav Lichvar 2018-02-23 16:58:20 UTC
dialog uses the system libtool, which doesn't include the hardening hack. However, the configure script has an option to specify options for libtool. This seems to help:

--with-libtool-opts="-Wc,%{?_hardened_ldflags}"

From the build log:

libtool: link: gcc -shared  -fPIC -DPIC  .libs/trace.o .libs/rc.o .libs/calendar.o .libs/fselect.o .libs/timebox.o .libs/buildlist.o .libs/rangebox.o .libs/treeview.o .libs/formbox.o .libs/guage.o .libs/pause.o .libs/prgbox.o .libs/progressbox.o .libs/tailbox.o .libs/mixedform.o .libs/mixedgauge.o .libs/argv.o .libs/arrows.o .libs/buttons.o .libs/checklist.o .libs/columns.o .libs/dlg_keys.o .libs/editbox.o .libs/help.o .libs/inputbox.o .libs/inputstr.o .libs/menubox.o .libs/mouse.o .libs/mousewget.o .libs/msgbox.o .libs/textbox.o .libs/ui_getc.o .libs/util.o .libs/version.o .libs/yesno.o   -lncursesw -ltinfo -lm  -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z -Wl,relro   -Wl,-soname -Wl,libdialog.so.14 -o .libs/libdialog.so.14.0.0

Comment 2 Miroslav Lichvar 2018-03-29 11:44:52 UTC
It seems this stopped working in rawhide. Now the command is mangled to:

libtool: link: gcc -shared  -fPIC -DPIC  .libs/trace.o .libs/rc.o .libs/calendar.o .libs/fselect.o .libs/timebox.o .libs/buildlist.o .libs/rangebox.o .libs/treeview.o .libs/formbox.o .libs/guage.o .libs/pause.o .libs/prgbox.o .libs/progressbox.o .libs/tailbox.o .libs/mixedform.o .libs/mixedgauge.o .libs/argv.o .libs/arrows.o .libs/buttons.o .libs/checklist.o .libs/columns.o .libs/dlg_keys.o .libs/editbox.o .libs/help.o .libs/inputbox.o .libs/inputstr.o .libs/menubox.o .libs/mouse.o .libs/mousewget.o .libs/msgbox.o .libs/textbox.o .libs/ui_getc.o .libs/util.o .libs/version.o .libs/yesno.o   -lncursesw -ltinfo -lm  -Wl -z now -Wl,-z -Wl,relro -Wl,-z -Wl,now   -Wl,-soname -Wl,libdialog.so.14 -o .libs/libdialog.so.14.0.0
gcc: error: unrecognized command line option '-Wl'; did you mean '-W'?

Comment 3 Miroslav Lichvar 2018-03-29 13:45:12 UTC
The problem was with _hardened_flags including a new linker option. The spec was fixed to specify the options separately using multiple -Xcompiler options of libtool (although only the -spec option has to be specified like that).