From f0abd6177879087435f4d552dc01e095c9ad311c Mon Sep 17 00:00:00 2001 From: Jon Poole Date: Mon, 22 May 2023 13:43:05 +0100 Subject: [PATCH] Make PIC one of the default compiler flags rather than something injected in the build def! --- .gitignore | 2 ++ .plzconfig | 8 ++++---- build_defs/cc.build_defs | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index f55993e..f2b0156 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ compile_commands.json # Entries below this point are managed by Please (DO NOT EDIT) plz-out .plzconfig.local + +.idea \ No newline at end of file diff --git a/.plzconfig b/.plzconfig index 831301c..5aa315a 100644 --- a/.plzconfig +++ b/.plzconfig @@ -35,22 +35,22 @@ Inherit = true [PluginConfig "default_opt_cflags"] ConfigKey = DefaultOptCFlags -DefaultValue = --std=c99 -O3 -pipe -DNDEBUG -Wall -Werror +DefaultValue = --std=c99 -O3 -pipe -DNDEBUG -Wall -Werror -fPIC Inherit = true [PluginConfig "default_dbg_cflags"] ConfigKey = DefaultDbgCFlags -DefaultValue = --std=c99 -g3 -pipe -DDEBUG -Wall -Werror +DefaultValue = --std=c99 -g3 -pipe -DDEBUG -Wall -Werror -fPIC Inherit = true [PluginConfig "default_opt_cppflags"] ConfigKey = DefaultOptCppFlags -DefaultValue = --std=c++11 -O3 -pipe -DNDEBUG -Wall -Werror +DefaultValue = --std=c++11 -O3 -pipe -DNDEBUG -Wall -Werror -fPIC Inherit = true [PluginConfig "default_dbg_cppflags"] ConfigKey = DefaultDbgCppFlags -DefaultValue = --std=c++11 -g3 -pipe -DDEBUG -Wall -Werror +DefaultValue = --std=c++11 -g3 -pipe -DDEBUG -Wall -Werror -fPIC Inherit = true [PluginConfig "default_ldflags"] diff --git a/build_defs/cc.build_defs b/build_defs/cc.build_defs index 083d916..1efb891 100644 --- a/build_defs/cc.build_defs +++ b/build_defs/cc.build_defs @@ -673,7 +673,7 @@ def _default_cflags(c, dbg): def _build_flags(compiler_flags:list, pkg_config_libs:list, pkg_config_cflags:list, defines=None, c=False, dbg=False): """Builds flags that we'll pass to the compiler invocation.""" - compiler_flags = [_default_cflags(c, dbg), '-fPIC'] + compiler_flags # N.B. order is important! + compiler_flags = [_default_cflags(c, dbg)] + compiler_flags if defines: compiler_flags += ['-D' + define for define in defines]