diff options
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/build.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/rust.py | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 7b23a1d..7254f75 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -762,6 +762,10 @@ class BuildTarget(Target): raise MesonException('cannot mix structured sources and unstructured sources') if self.structured_sources and 'rust' not in self.compilers: raise MesonException('structured sources are only supported in Rust targets') + if self.uses_rust(): + # relocation-model=pic is rustc's default and Meson does not + # currently have a way to disable PIC. + self.pic = True def __repr__(self): repr_str = "<{0} {1}: {2}>" diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 450f657..4fc3a49 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -207,8 +207,8 @@ class RustCompiler(Compiler): return self._WARNING_LEVELS["0"] def get_pic_args(self) -> T.List[str]: - # This defaults to - return ['-C', 'relocation-model=pic'] + # relocation-model=pic is rustc's default already. + return [] def get_pie_args(self) -> T.List[str]: # Rustc currently has no way to toggle this, it's controlled by whether |