Bug 224812 - gtest.a exports symbols, causing link-time warning: direct access in function ... means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.
Summary: gtest.a exports symbols, causing link-time warning: direct access in function...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tools / Tests (show other bugs)
Version: WebKit Local Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Kimmo Kinnunen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2021-04-20 06:46 PDT by Kimmo Kinnunen
Modified: 2021-04-23 02:45 PDT (History)
4 users (show)

See Also:


Attachments
Patch (6.82 KB, patch)
2021-04-20 07:04 PDT, Kimmo Kinnunen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kimmo Kinnunen 2021-04-20 06:46:24 PDT
gtest.a exports symbols, causing link-time warning: direct access in function ... means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

ld: warning: direct access in function 'testing::internal::SuiteApiResolver<testing::internal::(anonymous namespace)::FailureTest>::GetSetUpCaseOrSuite(char const*, int)' from file '/Users/kkinnunen/Build/Debug/libgtest.a(gtest-all.o)' to global weak symbol 'testing::Test::SetUpTestSuite()' from file '/Users/kkinnunen/Build/Debug/libTestWTF.a(AtomString.o)' means the weak symbol cannot be overridden at runtime. This was likely caused by different translation units being compiled with different visibility settings.

This is due to gtest.a static library is being compiled with dynamic library settings.
This causes the symbols to be marked as default visibility.
This is being worked around by hiding the symbols explicitly via ld flags
This causes ld warning.
Comment 1 Kimmo Kinnunen 2021-04-20 07:00:49 PDT
Chromium similar setup (at the time of writing):
https://chromium.googlesource.com/chromium/src/+/master/third_party/googletest/BUILD.gn
Comment 2 Kimmo Kinnunen 2021-04-20 07:04:33 PDT
Created attachment 426544 [details]
Patch
Comment 3 EWS 2021-04-20 15:06:25 PDT
Committed r276319 (236800@main): <https://commits.webkit.org/236800@main>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 426544 [details].
Comment 4 Ling Ho 2021-04-23 02:45:56 PDT
rdar://76920626