Make RTC_OBJC_EXPORT respect is_component_build.

While RTC_EXPORT is aware of component builds (selecting "default"
visibility only when WebRTC is built as a shared library),
RTC_OBJC_EXPORT (which predates RTC_EXPORT) was always marking symbols
as "default" visible.

This CL fixes the problem but on the other hand it will require
standalone builds of the WebRTC.framework to set the GN argument
`rtc_enable_symbol_export` to true.

No-Presubmit: True
Bug: chromium:1159620
Change-Id: I4a16f9bd3c1564140a5a30f03b3e77caed1df591
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/198082
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Henrik Andreassson <henrika@webrtc.org>
Reviewed-by: Nico Weber <thakis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#32856}
This commit is contained in:
Mirko Bonadei
2020-12-17 15:56:13 +01:00
committed by Commit Bot
parent 0ff2b4cd42
commit c1254e84a5
2 changed files with 13 additions and 2 deletions

View File

@ -11,6 +11,18 @@
#ifndef SDK_OBJC_BASE_RTCMACROS_H_ #ifndef SDK_OBJC_BASE_RTCMACROS_H_
#define SDK_OBJC_BASE_RTCMACROS_H_ #define SDK_OBJC_BASE_RTCMACROS_H_
#ifdef WEBRTC_ENABLE_SYMBOL_EXPORT
#if defined(WEBRTC_LIBRARY_IMPL)
#define RTC_OBJC_EXPORT __attribute__((visibility("default")))
#endif
#endif // WEBRTC_ENABLE_SYMBOL_EXPORT
#ifndef RTC_OBJC_EXPORT
#define RTC_OBJC_EXPORT
#endif
// Internal macros used to correctly concatenate symbols. // Internal macros used to correctly concatenate symbols.
#define RTC_SYMBOL_CONCAT_HELPER(a, b) a##b #define RTC_SYMBOL_CONCAT_HELPER(a, b) a##b
#define RTC_SYMBOL_CONCAT(a, b) RTC_SYMBOL_CONCAT_HELPER(a, b) #define RTC_SYMBOL_CONCAT(a, b) RTC_SYMBOL_CONCAT_HELPER(a, b)
@ -35,8 +47,6 @@
// that will be affected by the configurable RTC_OBJC_TYPE_PREFIX. // that will be affected by the configurable RTC_OBJC_TYPE_PREFIX.
#define RTC_OBJC_TYPE(type_name) RTC_SYMBOL_CONCAT(RTC_OBJC_TYPE_PREFIX, type_name) #define RTC_OBJC_TYPE(type_name) RTC_SYMBOL_CONCAT(RTC_OBJC_TYPE_PREFIX, type_name)
#define RTC_OBJC_EXPORT __attribute__((visibility("default")))
#if defined(__cplusplus) #if defined(__cplusplus)
#define RTC_EXTERN extern "C" RTC_OBJC_EXPORT #define RTC_EXTERN extern "C" RTC_OBJC_EXPORT
#else #else

View File

@ -146,6 +146,7 @@ def BuildWebRTC(output_dir, target_arch, flavor, gn_target_name,
gn_args.append('enable_ios_bitcode=' + gn_args.append('enable_ios_bitcode=' +
('true' if use_bitcode else 'false')) ('true' if use_bitcode else 'false'))
gn_args.append('use_goma=' + ('true' if use_goma else 'false')) gn_args.append('use_goma=' + ('true' if use_goma else 'false'))
gn_args.append('rtc_enable_symbol_export=true')
args_string = ' '.join(gn_args + extra_gn_args) args_string = ' '.join(gn_args + extra_gn_args)
logging.info('Building WebRTC with args: %s', args_string) logging.info('Building WebRTC with args: %s', args_string)