Skip to content

Commit f8c3439

Browse files
adetaylorcopybara-github
authored andcommitted
[rust] Export cxx.cc symbols
This is a version of dtolnay/cxx#1025 backported to the version of cxx which we currently use, plus associated GN changes to trigger that behavior. Purpose of this change: The Rust cxx interop tool produces both Rust and C++ side code for its bindings. It also has fixed C++ code for some of its interop types (e.g. the C++ representation of a Rust string). In most cases, all of this ends up in the same binary, but in debug component builds a test executable may have Rust code which needs to use thse symbols from (for instance) libbase.so. We already previously exported the symbols for dynamically generated bindings code; we now export the symbols for the fixed C++ code too. The patch within this change should be removed if/when dtolnay/cxx#1025 is accepted upstream and we have rolled cxx to include it. Bug: 1287545 Change-Id: I6a0f76fcf6afb36718d5e939c797e7988826bad1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3531194 Reviewed-by: danakj <[email protected]> Commit-Queue: Adrian Taylor <[email protected]> Cr-Commit-Position: refs/heads/main@{#982195} NOKEYCHECK=True GitOrigin-RevId: 3b659d0f18bf8f08354a8c35a25b51e542eed659
1 parent ffcf93a commit f8c3439

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

rust/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ static_library("cxx_cppdeps") {
2828
"//third_party/rust/cxx/v1/crate/src/cxx.cc",
2929
]
3030

31+
defines = [ "CXX_RS_EXPORT=__attribute__((visibility(\"default\")))" ]
32+
3133
# Depending on the C++ bindings side of cxx then requires also depending
3234
# on the Rust bindings, since one calls the other. And the Rust bindings
3335
# require the Rust standard library.

0 commit comments

Comments
 (0)