Skip to content

Commit 1ad5415

Browse files
committed
capture the functional oneTBB modifications as patches
Comparing src/tbb against a pristine oneTBB 2022.0.0 turns up 41 modified files. Most are workarounds for over-zealous CRAN checks -- commented-out '#pragma warning' / '#pragma GCC diagnostic' directives and the like -- and are not worth carrying. Seven are not: - src/tbb/def/{lin32,lin64,mac64}-tbb.def add tbb::internal::task_scheduler_observer_v3::observe to the export list, under a comment reading 'Needed by rstan', along with std:: exception typeinfo and destructors for backwards compatibility. These are the Linux/macOS counterpart of the Windows tbb.dll stub, so losing them would break rstan on exactly the platforms where it currently works. - The four CMakeLists.txt files drop VERSION / SOVERSION, so the build emits unversioned libraries. install.libs.R's versionBundledTbbLibraries() then re-creates the 'libtbb.so.2' layout (#260); the two have to stay in step. Both patches verified by applying them to a pristine tree and confirming every touched file matches what we ship.
1 parent 85984f1 commit 1ad5415

2 files changed

Lines changed: 133 additions & 0 deletions

File tree

patches/legacy_tbb_abi.diff

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,90 @@
171171
+
172172
+#endif /* _WIN32 */
173173
\ No newline at end of file
174+
--- a/src/tbb/src/tbb/def/lin32-tbb.def
175+
+++ b/src/tbb/src/tbb/def/lin32-tbb.def
176+
@@ -17,6 +17,26 @@
177+
{
178+
global:
179+
180+
+/* Needed for backwards compatibility */
181+
+_ZNSt13runtime_errorD1Ev;
182+
+_ZTISt13runtime_error;
183+
+_ZTSSt13runtime_error;
184+
+_ZNSt16invalid_argumentD1Ev;
185+
+_ZTISt16invalid_argument;
186+
+_ZTSSt16invalid_argument;
187+
+_ZNSt11range_errorD1Ev;
188+
+_ZTISt11range_error;
189+
+_ZTSSt11range_error;
190+
+_ZNSt12length_errorD1Ev;
191+
+_ZTISt12length_error;
192+
+_ZTSSt12length_error;
193+
+_ZNSt12out_of_rangeD1Ev;
194+
+_ZTISt12out_of_range;
195+
+_ZTSSt12out_of_range;
196+
+
197+
+/* Needed by rstan */
198+
+_ZN3tbb8internal26task_scheduler_observer_v37observeEb;
199+
+
200+
/* Assertions (assert.cpp) */
201+
_ZN3tbb6detail2r117assertion_failureEPKciS3_S3_;
202+
203+
--- a/src/tbb/src/tbb/def/lin64-tbb.def
204+
+++ b/src/tbb/src/tbb/def/lin64-tbb.def
205+
@@ -17,6 +17,26 @@
206+
{
207+
global:
208+
209+
+/* Needed for backwards compatibility */
210+
+_ZNSt13runtime_errorD1Ev;
211+
+_ZTISt13runtime_error;
212+
+_ZTSSt13runtime_error;
213+
+_ZNSt16invalid_argumentD1Ev;
214+
+_ZTISt16invalid_argument;
215+
+_ZTSSt16invalid_argument;
216+
+_ZNSt11range_errorD1Ev;
217+
+_ZTISt11range_error;
218+
+_ZTSSt11range_error;
219+
+_ZNSt12length_errorD1Ev;
220+
+_ZTISt12length_error;
221+
+_ZTSSt12length_error;
222+
+_ZNSt12out_of_rangeD1Ev;
223+
+_ZTISt12out_of_range;
224+
+_ZTSSt12out_of_range;
225+
+
226+
+/* Needed by rstan */
227+
+_ZN3tbb8internal26task_scheduler_observer_v37observeEb;
228+
+
229+
/* Assertions (assert.cpp) */
230+
_ZN3tbb6detail2r117assertion_failureEPKciS3_S3_;
231+
232+
--- a/src/tbb/src/tbb/def/mac64-tbb.def
233+
+++ b/src/tbb/src/tbb/def/mac64-tbb.def
234+
@@ -19,6 +19,26 @@
235+
# be listed WITHOUT one leading underscore. __TBB_SYMBOL macro should add underscore when
236+
# necessary, depending on the intended usage.
237+
238+
+# Needed for backwards compatibility
239+
+__ZNSt13runtime_errorD1Ev
240+
+__ZTISt13runtime_error
241+
+__ZTSSt13runtime_error
242+
+__ZNSt16invalid_argumentD1Ev
243+
+__ZTISt16invalid_argument
244+
+__ZTSSt16invalid_argument
245+
+__ZNSt11range_errorD1Ev
246+
+__ZTISt11range_error
247+
+__ZTSSt11range_error
248+
+__ZNSt12length_errorD1Ev
249+
+__ZTISt12length_error
250+
+__ZTSSt12length_error
251+
+__ZNSt12out_of_rangeD1Ev
252+
+__ZTISt12out_of_range
253+
+__ZTSSt12out_of_range
254+
+
255+
+# Needed by rstan
256+
+__ZN3tbb8internal26task_scheduler_observer_v37observeEb
257+
+
258+
# Assertions (assert.cpp)
259+
__ZN3tbb6detail2r117assertion_failureEPKciS3_S3_
260+

patches/unversioned_libraries.diff

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
--- a/src/tbb/src/tbb/CMakeLists.txt
2+
+++ b/src/tbb/src/tbb/CMakeLists.txt
3+
@@ -90,8 +90,6 @@
4+
# Avoid use of target_link_libraries here as it changes /DEF option to \DEF on Windows.
5+
set_target_properties(tbb PROPERTIES
6+
DEFINE_SYMBOL ""
7+
- VERSION ${TBB_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION}
8+
- SOVERSION ${TBB_BINARY_VERSION}
9+
)
10+
11+
tbb_handle_ipo(tbb)
12+
--- a/src/tbb/src/tbbbind/CMakeLists.txt
13+
+++ b/src/tbb/src/tbbbind/CMakeLists.txt
14+
@@ -53,8 +53,6 @@
15+
# Avoid use of target_link_libraries here as it changes /DEF option to \DEF on Windows.
16+
set_target_properties(${TBBBIND_NAME} PROPERTIES
17+
DEFINE_SYMBOL ""
18+
- VERSION ${TBBBIND_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION}
19+
- SOVERSION ${TBBBIND_BINARY_VERSION}
20+
)
21+
22+
tbb_handle_ipo(${TBBBIND_NAME})
23+
--- a/src/tbb/src/tbbmalloc/CMakeLists.txt
24+
+++ b/src/tbb/src/tbbmalloc/CMakeLists.txt
25+
@@ -70,8 +70,6 @@
26+
# Avoid use of target_link_libraries here as it changes /DEF option to \DEF on Windows.
27+
set_target_properties(tbbmalloc PROPERTIES
28+
DEFINE_SYMBOL ""
29+
- VERSION ${TBBMALLOC_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION}
30+
- SOVERSION ${TBBMALLOC_BINARY_VERSION}
31+
LINKER_LANGUAGE C
32+
)
33+
34+
--- a/src/tbb/src/tbbmalloc_proxy/CMakeLists.txt
35+
+++ b/src/tbb/src/tbbmalloc_proxy/CMakeLists.txt
36+
@@ -54,10 +54,6 @@
37+
${TBB_COMMON_COMPILE_FLAGS}
38+
)
39+
40+
-set_target_properties(tbbmalloc_proxy PROPERTIES
41+
- VERSION ${TBBMALLOC_BINARY_VERSION}.${TBB_BINARY_MINOR_VERSION}
42+
- SOVERSION ${TBBMALLOC_BINARY_VERSION})
43+
-
44+
if (UNIX AND NOT APPLE)
45+
# Avoid use of target_link_libraries here as it changes /DEF option to \DEF on Windows.
46+
set_target_properties(tbbmalloc_proxy PROPERTIES

0 commit comments

Comments
 (0)