Fix broken build under Debian Wheezy.
With the toolchain under Wheezy (GCC 4.7.2 and binutils 2.22), using
both -fPIE and -fPIC does not create pic object files, which the build
of Bazel seems to expect as of ee8fcd312eef51d2558c940f00d6381af0d52dff.
--
Change-Id: I0a33d1bc6dc0e3cdcffb473d4e78dac1a6b8ab41
Reviewed-on: https://bazel-review.googlesource.com/#/c/1690/
MOS_MIGRATED_REVID=104093416
diff --git a/src/main/cpp/BUILD b/src/main/cpp/BUILD
index dfa4a60..7954a67 100644
--- a/src/main/cpp/BUILD
+++ b/src/main/cpp/BUILD
@@ -26,6 +26,15 @@
"blaze_util.h",
"blaze_util_platform.h",
],
+ linkopts = select({
+ "//src:darwin": [
+ ],
+ "//src:freebsd": [
+ ],
+ "//conditions:default": [
+ "-lrt",
+ ],
+ }),
visibility = ["//visibility:public"],
deps = [
"//src/main/cpp/util",
diff --git a/tools/cpp/CROSSTOOL b/tools/cpp/CROSSTOOL
index c3de9c6..623dad4 100644
--- a/tools/cpp/CROSSTOOL
+++ b/tools/cpp/CROSSTOOL
@@ -159,8 +159,6 @@
compiler_flag: "-U_FORTIFY_SOURCE"
compiler_flag: "-D_FORTIFY_SOURCE=1"
compiler_flag: "-fstack-protector"
- compiler_flag: "-fPIE"
- linker_flag: "-pie"
linker_flag: "-Wl,-z,relro,-z,now"
# Enable coloring even if there's no attached terminal. Bazel removes the
@@ -272,7 +270,6 @@
# Conservative choice; -D_FORTIFY_SOURCE=2 may be unsafe in some cases.
compiler_flag: "-D_FORTIFY_SOURCE=1"
compiler_flag: "-fstack-protector"
- compiler_flag: "-fPIE"
# Enable coloring even if there's no attached terminal. Bazel removes the
# escape sequences if --nocolor is specified.
@@ -380,8 +377,6 @@
compiler_flag: "-U_FORTIFY_SOURCE"
compiler_flag: "-D_FORTIFY_SOURCE=1"
compiler_flag: "-fstack-protector"
- compiler_flag: "-fPIE"
- linker_flag: "-pie"
linker_flag: "-Wl,-z,relro,-z,now"
# Enable coloring even if there's no attached terminal. Bazel removes the