Skip to content

Commit

Permalink
Remove support for "nodeps" dynamic libraries on Apple platforms.
Browse files Browse the repository at this point in the history
Any such usage was only accidentally working due to -undefined dynamic_lookup.
That flag only works on Darwin (macOS) at all.

But even there, TLS can cause undefined symbols with these "nodeps" libraries.

Fundamentally, Mach-O's two-level namespacing makes this infeasible.

#4341

Closes #4341.

PiperOrigin-RevId: 352002776
  • Loading branch information
Googler authored and copybara-github committed Jan 15, 2021
1 parent bbeb1da commit ec55533
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 12 deletions.
8 changes: 8 additions & 0 deletions src/test/shell/bazel/cc_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,10 @@ EOF
}

function test_aspect_accessing_args_link_action_with_tree_artifact() {
# This test assumes the presence of "nodeps" dynamic libraries, which do not
# function on Apple platforms.
[ "$PLATFORM" != "darwin" ] || return 0

local package="${FUNCNAME[0]}"
mkdir -p "${package}"
cat > "${package}/makes_tree_artifacts.sh" <<EOF
Expand Down Expand Up @@ -739,6 +743,10 @@ EOF
}

function test_directory_arg_compile_action() {
# This test assumes the presence of "nodeps" dynamic libraries, which do not
# function on Apple platforms.
[ "$PLATFORM" != "darwin" ] || return 0

local package="${FUNCNAME[0]}"
mkdir -p "${package}"

Expand Down
18 changes: 10 additions & 8 deletions src/test/shell/bazel/tags_propagation_native_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,16 @@ EOF
assert_contains "local:" output1
assert_contains "no-cache:" output1
assert_contains "no-remote:" output1

bazel aquery --experimental_allow_tags_propagation 'mnemonic("CppLink", outputs(".*/libtest.so", //test:test))' > output1 2> $TEST_log \
|| fail "should have generated output successfully"

assert_contains "ExecutionInfo: {" output1
assert_contains "local:" output1
assert_contains "no-cache:" output1
assert_contains "no-remote:" output1
if [ "${PLATFORM}" != "darwin" ]; then
# Darwin does not support implicit "nodeps" shared libraries.
bazel aquery --experimental_allow_tags_propagation 'mnemonic("CppLink", outputs(".*/libtest.so", //test:test))' > output1 2> $TEST_log \
|| fail "should have generated output successfully"

assert_contains "ExecutionInfo: {" output1
assert_contains "local:" output1
assert_contains "no-cache:" output1
assert_contains "no-remote:" output1
fi
}

function test_cc_binary_tags_propagated() {
Expand Down
2 changes: 2 additions & 0 deletions src/test/shell/integration/configured_query_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,8 @@ EOF

if "$is_windows"; then
assert_contains "cclib.lib" output
elif is_darwin; then
assert_contains "libcclib.a" output
else
assert_contains "libcclib.a" output
assert_contains "libcclib.so" output
Expand Down
1 change: 0 additions & 1 deletion tools/cpp/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,6 @@ def _impl(ctx):
features = [
default_compile_flags_feature,
default_link_flags_feature,
supports_dynamic_linker_feature,
supports_pic_feature,
objcopy_embed_flags_feature,
dbg_feature,
Expand Down
3 changes: 0 additions & 3 deletions tools/osx/crosstool/cc_toolchain_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -4734,8 +4734,6 @@ def _impl(ctx):
],
)

supports_dynamic_linker_feature = feature(name = "supports_dynamic_linker", enabled = True)

objc_actions_feature = feature(
name = "objc_actions",
implies = [
Expand Down Expand Up @@ -6243,7 +6241,6 @@ def _impl(ctx):
linker_param_file_feature,
compiler_input_flags_feature,
compiler_output_flags_feature,
supports_dynamic_linker_feature,
objcopy_embed_flags_feature,
dynamic_linking_mode_feature,
set_install_name,
Expand Down

0 comments on commit ec55533

Please sign in to comment.