Skip to content

Add test_namespace_visibility (experiment, not for merging) #4044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Jul 6, 2022

Description

To answer the question: Is there a difference in behavior if some __attribute__((visibility("hidden"))) are missing (PR #4043)?

A second motivation for this experiment was to gain clarity about Google-internal vs external behavior.

Suggested changelog entry:

@rwgk
Copy link
Collaborator Author

rwgk commented Jul 6, 2022

Summary of results for commit 3f01275:

$ grep UNEXPECTED *.txt | cut -d']' -f2- | cut -d' ' -f3- | sort | uniq -c
      6 UNEXPECTED code_line: AAA:AAc:AaA:Aac:aAC:aAc:aaC:aac
     30 UNEXPECTED code_line: AAA:AAc:AaC:Aac:aAC:aAc:aaC:aac

$ grep 'UNEXPECTED code_line: AAA:AAc:AaA:Aac:aAC:aAc:aaC:aac' *.txt | cutniq
13______3.6_____macos-latest_____x64.txt
14______3.9_____macos-latest_____x64.txt
15______3.10_____macos-latest_____x64.txt

$ grep 'UNEXPECTED code_line: AAA:AAc:AaC:Aac:aAC:aAc:aaC:aac' *.txt | cutniq
1______3.6_____ubuntu-latest_____x64_-DPYBIND11_FINDPYTHON=ON_-DCM.txt
1______3.7_____Debian_____x86______Install.txt
1______3.9-dbg__deadsnakes______Valgrind_____x64.txt
1______3_____centos7_____x64.txt
1______3_____Clang_3.6_____C++11_____x64.txt
1______3_____GCC_7_____C++11____x64.txt
2______3.9_____ubuntu-latest_____x64.txt
2______3_____almalinux8_____x64.txt
2______3_____Clang_3.7_____C++11_____x64.txt
2______3_____GCC_latest_____C++11____x64.txt
3______3.10_____ubuntu-latest_____x64.txt
3______3_____almalinux9_____x64.txt
3______3_____Clang_3.9_____C++11_____x64.txt
3______3_____GCC_10_____C++20____x64.txt
4______3_____Clang_7_____C++11_____x64.txt
4______pypy-3.7_____ubuntu-latest_____x64.txt
5______3_____Clang_9_____C++11_____x64.txt
5______pypy-3.8_____ubuntu-latest_____x64_-DPYBIND11_FINDPYTHON=ON.txt
6______3_____Clang_dev_____C++11_____x64.txt
6______pypy-3.9_____ubuntu-latest_____x64.txt
7______3_____Clang_5_____C++14_____x64.txt
8______3_____Clang_10_____C++20_____x64.txt
9______3_____Clang_10_____C++17_____x64.txt

@rwgk
Copy link
Collaborator Author

rwgk commented Jul 6, 2022

To explain:

      6 UNEXPECTED code_line: AAA:AAc:AaA:Aac:aAC:aAc:aaC:aac
     30 UNEXPECTED code_line: AAA:AAc:AaC:Aac:aAC:aAc:aaC:aac
----------------------------------------^

The dynamic loaders behave differently on macOS (1st line above) vs Linux (2nd line).

If a namespace has hidden visibility in one Translation Unit (TU), but default in another TU linked into the same PYBIND11_MODULE, the net result is that it is

  • macOS: visible from another PYBIND11_MODULE.
  • Linux: hidden from another PYBIND11_MODULE.

Note that this is withOUT -fvisibility=hidden and RTLD_GLOBAL on Linux, i.e. for an unusual situation.

@rwgk
Copy link
Collaborator Author

rwgk commented Jul 10, 2022

The code added here was moved to separate files (tests/namespace_visibility) under PR #4050.

@rwgk rwgk closed this Jul 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant