Fix building with -Wl,-z,defs

This allows us to find undefined references at compile time, not runtime.
This commit is contained in:
Richard Hughes 2018-12-22 12:11:33 +00:00 committed by Mario Limonciello
parent 363127e518
commit 0e17e6d030
29 changed files with 89 additions and 20 deletions

View File

@ -111,6 +111,7 @@ add_project_arguments(cc.get_supported_arguments(warning_flags), language : 'c')
global_link_args = [] global_link_args = []
test_link_args = [ test_link_args = [
'-Wl,-z,relro', '-Wl,-z,relro',
'-Wl,-z,defs',
'-Wl,-z,now', '-Wl,-z,now',
] ]
foreach arg: test_link_args foreach arg: test_link_args

View File

@ -17,6 +17,9 @@ shared_module('fu_plugin_altos',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
libelf, libelf,

View File

@ -11,6 +11,9 @@ shared_module('fu_plugin_amt',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -19,6 +19,9 @@ shared_module('fu_plugin_colorhug',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -22,6 +22,7 @@ shared_module('fu_plugin_csr',
plugin_deps, plugin_deps,
], ],
link_with : [ link_with : [
libfwupdprivate,
dfu, dfu,
], ],
) )

View File

@ -21,6 +21,9 @@ shared_module('fu_plugin_dell_dock',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -12,8 +12,11 @@ shared_module('fu_plugin_dell_esrt',
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
c_args : [ c_args : [
cargs, cargs,
], ],
link_with : [
libfwupdprivate,
],
dependencies : [ dependencies : [
plugin_deps, plugin_deps,
libsmbios_c, libsmbios_c,

View File

@ -16,9 +16,12 @@ shared_module('fu_plugin_dell',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : [ c_args : [
cargs, cargs,
], ],
dependencies : [ dependencies : [
plugin_deps, plugin_deps,
efivar, efivar,
@ -51,7 +54,6 @@ if get_option('tests')
valgrind, valgrind,
], ],
link_with : [ link_with : [
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
c_args : [ c_args : [

View File

@ -31,6 +31,9 @@ dfu = static_library(
gusb, gusb,
gudev, gudev,
], ],
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
include_directories : [ include_directories : [
include_directories('../..'), include_directories('../..'),
@ -55,6 +58,7 @@ shared_module('fu_plugin_dfu',
plugin_deps, plugin_deps,
], ],
link_with : [ link_with : [
libfwupdprivate,
dfu, dfu,
], ],
) )
@ -79,7 +83,6 @@ dfu_tool = executable(
], ],
link_with : [ link_with : [
dfu, dfu,
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
c_args : cargs, c_args : cargs,
@ -130,7 +133,6 @@ if get_option('tests')
], ],
link_with : [ link_with : [
dfu, dfu,
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
c_args : cargs c_args : cargs

View File

@ -17,6 +17,9 @@ shared_module('fu_plugin_ebitdo',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -16,6 +16,9 @@ shared_module('fu_plugin_fastboot',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -15,6 +15,9 @@ shared_module('fu_plugin_flashrom',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : [ c_args : [
cargs, cargs,
'-DLOCALSTATEDIR="' + localstatedir + '"', '-DLOCALSTATEDIR="' + localstatedir + '"',

View File

@ -17,6 +17,9 @@ shared_module('fu_plugin_nitrokey',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -16,6 +16,9 @@ shared_module('fu_plugin_nvme',
cargs, cargs,
'-DLOCALSTATEDIR="' + localstatedir + '"', '-DLOCALSTATEDIR="' + localstatedir + '"',
], ],
link_with : [
libfwupdprivate,
],
dependencies : [ dependencies : [
plugin_deps, plugin_deps,
efivar, efivar,
@ -42,7 +45,6 @@ if get_option('tests')
efivar, efivar,
], ],
link_with : [ link_with : [
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
c_args : cargs c_args : cargs

View File

@ -13,6 +13,9 @@ shared_module('fu_plugin_redfish',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,
@ -44,7 +47,6 @@ if get_option('tests')
libjsonglib, libjsonglib,
], ],
link_with : [ link_with : [
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
c_args : cargs c_args : cargs

View File

@ -19,6 +19,9 @@ shared_module('fu_plugin_rts54hid',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -18,6 +18,9 @@ shared_module('fu_plugin_rts54hub',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -16,6 +16,9 @@ shared_module('fu_plugin_steelseries',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -16,6 +16,9 @@ shared_module('fu_plugin_superio',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -18,8 +18,11 @@ shared_module('fu_plugin_synapticsmst',
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
c_args : [ c_args : [
cargs, cargs,
], ],
link_with : [
libfwupdprivate,
],
dependencies : [ dependencies : [
plugin_deps, plugin_deps,
], ],
@ -47,7 +50,6 @@ if get_option('tests')
valgrind, valgrind,
], ],
link_with : [ link_with : [
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
c_args : [ c_args : [

View File

@ -16,6 +16,9 @@ shared_module('fu_plugin_test',
], ],
install : install_dummy, install : install_dummy,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -11,6 +11,9 @@ fu_plugin_thunderbolt_power = shared_module('fu_plugin_thunderbolt_power',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -12,6 +12,9 @@ fu_plugin_thunderbolt = shared_module('fu_plugin_thunderbolt',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,
@ -33,7 +36,6 @@ executable('tbtfwucli',
c_args : cargs, c_args : cargs,
link_with : [ link_with : [
fu_plugin_thunderbolt, fu_plugin_thunderbolt,
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
dependencies : [ dependencies : [
@ -62,7 +64,6 @@ if get_option('tests') and umockdev.found() and gio.version().version_compare('>
umockdev, umockdev,
], ],
link_with : [ link_with : [
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
c_args : cargs c_args : cargs

View File

@ -12,6 +12,9 @@ shared_module('fu_plugin_udev',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,
@ -33,7 +36,6 @@ executable(
plugin_deps, plugin_deps,
], ],
link_with : [ link_with : [
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
c_args : cargs, c_args : cargs,
@ -59,7 +61,6 @@ if get_option('tests')
plugin_deps, plugin_deps,
], ],
link_with : [ link_with : [
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
c_args : cargs c_args : cargs

View File

@ -26,6 +26,9 @@ shared_module('fu_plugin_uefi',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,
@ -62,7 +65,6 @@ executable(
efiboot, efiboot,
], ],
link_with : [ link_with : [
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
install : true, install : true,
@ -101,7 +103,6 @@ if get_option('tests')
efiboot, efiboot,
], ],
link_with : [ link_with : [
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
c_args : cargs c_args : cargs

View File

@ -26,6 +26,9 @@ shared_module('fu_plugin_unifying',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,
@ -47,7 +50,7 @@ if get_option('tests')
plugin_deps, plugin_deps,
], ],
link_with : [ link_with : [
fwupd, libfwupdprivate,
], ],
c_args : cargs, c_args : cargs,
) )

View File

@ -11,6 +11,9 @@ shared_module('fu_plugin_upower',
], ],
install : true, install : true,
install_dir: plugin_dir, install_dir: plugin_dir,
link_with : [
libfwupdprivate,
],
c_args : cargs, c_args : cargs,
dependencies : [ dependencies : [
plugin_deps, plugin_deps,

View File

@ -27,6 +27,7 @@ shared_module('fu_plugin_wacom_usb',
plugin_deps, plugin_deps,
], ],
link_with : [ link_with : [
libfwupdprivate,
dfu, dfu,
], ],
) )
@ -57,7 +58,6 @@ if get_option('tests')
], ],
link_with : [ link_with : [
dfu, dfu,
fwupd,
libfwupdprivate, libfwupdprivate,
], ],
c_args : cargs c_args : cargs

View File

@ -59,6 +59,9 @@ libfwupdprivate = static_library(
valgrind, valgrind,
uuid, uuid,
], ],
link_with : [
fwupd,
],
c_args : [ c_args : [
'-DFU_OFFLINE_DESTDIR=""', '-DFU_OFFLINE_DESTDIR=""',
], ],