aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2023-06-07 10:11:47 -0400
committerXavier Claessens <xclaesse@gmail.com>2023-06-07 13:18:58 -0400
commit6c480085d5c80815a4c514c1406f1289a05acbb1 (patch)
tree8cb4caeb400660fd76ca38b88885196bcb2897d2 /mesonbuild
parent58aa301accc2dc1f107c2e77b8187de94fb1bd0c (diff)
downloadmeson-6c480085d5c80815a4c514c1406f1289a05acbb1.zip
meson-6c480085d5c80815a4c514c1406f1289a05acbb1.tar.gz
meson-6c480085d5c80815a4c514c1406f1289a05acbb1.tar.bz2
rust: PIC is always enabled
rustc enables PIC by default and Meson currently has no way to force disabling PIC, it can only force enable or use compiler's default.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/build.py4
-rw-r--r--mesonbuild/compilers/rust.py4
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