meson: use -static-pie instead of -static in PIE mode
If compiling with -Db_pie=true, we should do PIE compilation (position independent executables), even in the static mode. The caveat is that people distributions actually override compilation flags when doing their builds. They'll need to set the static flags properly if they do such builds. (cherry picked from commit 8b289a8c4d9e2f69a2c10d109c1c19f353005047)
This commit is contained in:
committed by
Luca Boccassi
parent
b7ae93f093
commit
dfdcaaa269
+12
-1
@@ -219,13 +219,24 @@ if conf.get('SYSTEMD_MULTICALL_BINARY') == 1
|
||||
]
|
||||
endif
|
||||
|
||||
if get_option('build-static')
|
||||
if (get_option('b_pie') and
|
||||
cc.links(basic_c_prog, args : '-static-pie', name : '-static-pie'))
|
||||
systemd_link_args = ['-static-pie', '-Wl,-static,-pie']
|
||||
else
|
||||
systemd_link_args = ['-static']
|
||||
endif
|
||||
else
|
||||
systemd_link_args = []
|
||||
endif
|
||||
|
||||
executables += [
|
||||
libexec_template + {
|
||||
'name' : 'systemd',
|
||||
'dbus' : true,
|
||||
'public' : true,
|
||||
'sources' : systemd_sources,
|
||||
'link_args_static' : get_option('build-static') ? ['-static'] : [],
|
||||
'link_args_static' : systemd_link_args,
|
||||
'link_with' : [
|
||||
libcore,
|
||||
libshared,
|
||||
|
||||
Reference in New Issue
Block a user