Commit d459371e authored by Nico Weber's avatar Nico Weber Committed by Chromium LUCI CQ

mac/lld: Disable PIE, and disable TLS for protoc (for plugin dylibs)

lld/MachO currently doesn't produce working TLS for position-independent code.
Disable PIE, and for protoc disable TLS (since protoc loads dylibs for plugins
at runtime).

The produced Chromium Framework still uses TLS and PIC and is still broken,
but with this (and
https://chromium-review.googlesource.com/c/chromium/src/+/2591007) all host
binaries that run during the build at least work. So with this, a build with
use_lld=true on a macOS machine at least gets mostly through the build
(...and far enough to find new interesting problems in lld).

Bug: 1149587
Change-Id: I862308158f4aaa4419f0fb5e98c206294a2835cb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2590392
Commit-Queue: Nico Weber <thakis@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Reviewed-by: default avatarRobert Sesek <rsesek@chromium.org>
Auto-Submit: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836863}
parent f1595a9d
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
import("//build/config/c++/c++.gni") import("//build/config/c++/c++.gni")
import("//build/config/chrome_build.gni") import("//build/config/chrome_build.gni")
import("//build/config/chromecast_build.gni") import("//build/config/chromecast_build.gni")
import("//build/config/compiler/compiler.gni")
import("//build/config/crypto.gni") import("//build/config/crypto.gni")
import("//build/config/dcheck_always_on.gni") import("//build/config/dcheck_always_on.gni")
import("//build/config/features.gni") import("//build/config/features.gni")
...@@ -331,6 +332,12 @@ config("executable_config") { ...@@ -331,6 +332,12 @@ config("executable_config") {
configs += [ "//third_party/instrumented_libraries:locally_built_ldflags" ] configs += [ "//third_party/instrumented_libraries:locally_built_ldflags" ]
} }
configs += [ "//build/config/sanitizers:link_executable" ] configs += [ "//build/config/sanitizers:link_executable" ]
# lld/mac produces broken TLS for position-independent code.
# TODO(thakis): Remove this once llvm.org/PR48491 is fixed.
if (is_apple && use_lld && !is_nacl) {
ldflags = [ "-Wl,-no_pie" ]
}
} }
# Shared library configs ------------------------------------------------------- # Shared library configs -------------------------------------------------------
......
# Copyright 2014 The Chromium Authors. All rights reserved. # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//build/config/compiler/compiler.gni")
import("//build/config/linux/gtk/gtk.gni") import("//build/config/linux/gtk/gtk.gni")
import("//build/config/sanitizers/sanitizers.gni") import("//build/config/sanitizers/sanitizers.gni")
...@@ -16,6 +17,11 @@ config("protobuf_config") { ...@@ -16,6 +17,11 @@ config("protobuf_config") {
"GOOGLE_PROTOBUF_NO_RTTI", "GOOGLE_PROTOBUF_NO_RTTI",
"GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER", "GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER",
] ]
if (is_apple && use_lld) {
# lld/mac produces broken TLS for position-independent code.
# TODO(thakis): Remove this once llvm.org/PR48491 is fixed.
defines += [ "GOOGLE_PROTOBUF_NO_THREADLOCAL" ]
}
if (!is_win) { if (!is_win) {
defines += [ "HAVE_PTHREAD" ] defines += [ "HAVE_PTHREAD" ]
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment