From 28d4cc333eb1037221b37d55cbd0ca11e52bdd94 Mon Sep 17 00:00:00 2001 From: Jarno Rajahalme Date: Tue, 12 May 2026 17:16:17 +0200 Subject: [PATCH] build: Pass --force_pic to bazel We already pass the -fPIC option in envoy.bazelrc (build:linux --copt=-fPIC) to the compiler, but bazel does not know about it and still builds both .pic.o and .o objects. Passing --force_pic to bazel supresses the .o compilation and saves build time. Noticed when non-test sources (such as Compiling source/common/network/address_impl.cc) were compiled for tests right after cilium-envoy was built. With the --force_pic option the tests build shows building only test files. Signed-off-by: Jarno Rajahalme --- .bazelrc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.bazelrc b/.bazelrc index 9cb0fc27a..9aa599c0c 100644 --- a/.bazelrc +++ b/.bazelrc @@ -10,6 +10,10 @@ import %workspace%/envoy.bazelrc build --incompatible_enable_cc_toolchain_resolution build --platform_mappings=bazel/platform_mappings +# envoy.bazelrc always sets -fPIC, tell bazel about it to suppress building both .o and .pic.o +# objects from the same C++ sources. +build --force_pic + # Enable path normalization by default. # See: https://github.com/envoyproxy/envoy/pull/6519 build --define path_normalization_by_default=true