Add workaround_gcc_no_pie option to force non-PIE output

Certain file managers need this figure out that the executable is actually executable. The problem is further complicated by meson being uncooperative and not implementing its own -Db_pie=false correctly.
This commit is contained in:
Tamás Bálint Misius 2021-04-10 18:24:37 +02:00
parent e1ca5f2177
commit 844c5c5186
No account linked to committer's email address
2 changed files with 10 additions and 1 deletions

View File

@ -208,10 +208,13 @@ else
'-fomit-frame-pointer',
]
endif
if copt_platform == 'mac'
if copt_platform == 'mac' and uopt_static == 'prebuilt'
args_ccomp += [ '-mmacosx-version-min=10.9' ]
project_link_args += [ '-mmacosx-version-min=10.9' ]
endif
if copt_platform == 'lin' and not get_option('b_pie') and get_option('workaround_gcc_no_pie') # nice one, meson
project_link_args += [ '-no-pie' ]
endif
project_c_args += args_ccomp
project_cpp_args += args_ccomp + [ '-Wno-invalid-offsetof' ]
endif

View File

@ -165,3 +165,9 @@ option(
value: '',
description: 'Update server, only used by snapshots and mods, see \'snapshot_id\' and \'mod_id\''
)
option(
'workaround_gcc_no_pie',
type: 'boolean',
value: true,
description: 'Pass -no-pie to gcc manually to work around meson\'s -Db_pie=false doing nothing'
)