Skip to content

Commit 0f50d01

Browse files
committed
Revert RTSanitizerCommonSymbolizerInternal changes
This reverts the following commits: - 5d7b75e [NFC][memprof] Temporarly remove RTSanitizerCommonSymbolizerInternal - edb211c [NFC][memprof] Temporarly remove RTSanitizerCommonSymbolizerInternal - 4d14b4a [sanitizer] Add CMake flag to build with internal symbolizer They break macOS nodes because CMake can't evaluate generator expressions: Error evaluating generator expression: $<TARGET_OBJECTS:RTSanitizerCommonSymbolizerInternal.osx> $<TARGET_OBJECTS:RTSanitizerCommonSymbolizerInternal.ios> $<TARGET_OBJECTS:RTSanitizerCommonSymbolizerInternal.iossim>
1 parent 4bb9024 commit 0f50d01

File tree

8 files changed

+29
-54
lines changed

8 files changed

+29
-54
lines changed

compiler-rt/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -727,9 +727,6 @@ endif()
727727
pythonize_bool(COMPILER_RT_HAS_LLD)
728728
pythonize_bool(COMPILER_RT_TEST_USE_LLD)
729729

730-
option(COMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER "Build Compiler RT linked with in LLVM symbolizer" OFF)
731-
mark_as_advanced(COMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER)
732-
733730
add_subdirectory(lib)
734731

735732
if(COMPILER_RT_INCLUDE_TESTS)

compiler-rt/lib/hwasan/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,6 @@ function(add_hwasan_runtimes arch use_aliases)
164164
RTSanitizerCommonLibc
165165
RTSanitizerCommonCoverage
166166
RTSanitizerCommonSymbolizer
167-
# FIXME: disable tagging when in symbolizer.
168-
# RTSanitizerCommonSymbolizerInternal
169167
RTLSanCommon
170168
RTUbsan
171169
CFLAGS ${hwasan_rtl_flags}
@@ -203,8 +201,6 @@ function(add_hwasan_runtimes arch use_aliases)
203201
RTSanitizerCommonLibc
204202
RTSanitizerCommonCoverage
205203
RTSanitizerCommonSymbolizer
206-
# FIXME: disable tagging when in symbolizer.
207-
# RTSanitizerCommonSymbolizerInternal
208204
RTLSanCommon
209205
RTUbsan
210206
RTUbsan_cxx

compiler-rt/lib/memprof/CMakeLists.txt

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -127,10 +127,7 @@ set(MEMPROF_COMMON_RUNTIME_OBJECT_LIBS
127127
RTSanitizerCommon
128128
RTSanitizerCommonLibc
129129
RTSanitizerCommonCoverage
130-
RTSanitizerCommonSymbolizer
131-
# FIXME: hangs.
132-
# RTSanitizerCommonSymbolizerInternal
133-
)
130+
RTSanitizerCommonSymbolizer)
134131

135132
add_compiler_rt_runtime(clang_rt.memprof
136133
STATIC

compiler-rt/lib/sanitizer_common/CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,7 +362,3 @@ foreach(arch ${SANITIZER_COMMON_SUPPORTED_ARCH})
362362
add_library(RTSanitizerCommonSymbolizerInternal.${arch}
363363
OBJECT IMPORTED GLOBAL)
364364
endforeach()
365-
366-
if (COMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER)
367-
add_subdirectory(symbolizer)
368-
endif()

compiler-rt/lib/sanitizer_common/symbolizer/CMakeLists.txt

Lines changed: 0 additions & 27 deletions
This file was deleted.

compiler-rt/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,34 @@
33
# Run as: CLANG=bin/clang build_symbolizer.sh out.o
44
# zlib can be downloaded from http://www.zlib.net.
55
#
6-
# Script compiles self-contained object file with symbolization code.
6+
# Script compiles self-contained object file with symbolization code and injects
7+
# it into the given set of runtime libraries. Script updates only libraries
8+
# which has unresolved __sanitizer_symbolize_* symbols and matches architecture.
9+
# Object file is be compiled from LLVM sources with dependencies like libc++ and
10+
# zlib. Then it internalizes symbols in the file, so that it can be linked
11+
# into arbitrary programs, avoiding conflicts with the program own symbols and
12+
# avoiding dependencies on any program symbols. The only acceptable dependencies
13+
# are libc and __sanitizer::internal_* from sanitizer runtime.
714
#
815
# Symbols exported by the object file will be used by Sanitizer runtime
916
# libraries to symbolize code/data in-process.
1017
#
18+
# The script will modify the output directory which is given as the first
19+
# argument to the script.
20+
#
1121
# FIXME: We should really be using a simpler approach to building this object
1222
# file, and it should be available as a regular cmake rule. Conceptually, we
1323
# want to be doing "ld -r" followed by "objcopy -G" to create a relocatable
1424
# object file with only our entry points exposed. However, this does not work at
15-
# present, see https://github.com/llvm/llvm-project/issues/30098.
25+
# present, see PR30750.
1626

1727
set -x
1828
set -e
1929
set -u
2030

2131
SCRIPT_DIR=$(cd "$(dirname "$0")" && pwd)
2232
SRC_DIR=$(readlink -f $SCRIPT_DIR/..)
23-
OUTPUT=$(readlink -f $1)
33+
TARGE_DIR=$(readlink -f $1)
2434
COMPILER_RT_SRC=$(readlink -f ${SCRIPT_DIR}/../../../..)
2535
LLVM_SRC=${LLVM_SRC:-${COMPILER_RT_SRC}/../llvm}
2636
LLVM_SRC=$(readlink -f $LLVM_SRC)
@@ -176,6 +186,20 @@ nm -f posix -g symbolizer.o | cut -f 1,2 -d \ | LC_COLLATE=C sort -u > undefine
176186
(diff -u $SCRIPT_DIR/global_symbols.txt undefined.new | grep -E "^\+[^+]") && \
177187
(echo "Failed: unexpected symbols"; exit 1)
178188

179-
cp -f symbolizer.o $OUTPUT
189+
arch() {
190+
objdump -f $1 | grep -m1 -Po "(?<=file format ).*$"
191+
}
192+
193+
SYMBOLIZER_FORMAT=$(arch symbolizer.o)
194+
echo "Injecting $SYMBOLIZER_FORMAT symbolizer..."
195+
for A in $TARGE_DIR/libclang_rt.*san*.a; do
196+
A_FORMAT=$(arch $A)
197+
if [[ "$A_FORMAT" != "$SYMBOLIZER_FORMAT" ]] ; then
198+
continue
199+
fi
200+
(nm -u $A 2>/dev/null | grep -E "__sanitizer_symbolize_code" >/dev/null) || continue
201+
echo "$A"
202+
$AR rcs $A symbolizer.o
203+
done
180204

181205
echo "Success!"

compiler-rt/lib/stats/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ add_compiler_rt_runtime(clang_rt.stats
2929
OBJECT_LIBS RTSanitizerCommon
3030
RTSanitizerCommonLibc
3131
RTSanitizerCommonSymbolizer
32-
RTSanitizerCommonSymbolizerInternal
3332
CFLAGS ${SANITIZER_COMMON_CFLAGS}
3433
LINK_FLAGS ${SANITIZER_COMMON_LINK_FLAGS} ${WEAK_SYMBOL_LINK_FLAGS}
3534
LINK_LIBS ${STATS_LINK_LIBS}

compiler-rt/lib/ubsan/CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ append_list_if(COMPILER_RT_HAS_LIBDL dl UBSAN_DYNAMIC_LIBS)
7171
append_list_if(COMPILER_RT_HAS_LIBLOG log UBSAN_DYNAMIC_LIBS)
7272
append_list_if(COMPILER_RT_HAS_LIBRT rt UBSAN_DYNAMIC_LIBS)
7373
append_list_if(COMPILER_RT_HAS_LIBPTHREAD pthread UBSAN_DYNAMIC_LIBS)
74-
if (COMPILER_RT_ENABLE_INTERNAL_SYMBOLIZER)
75-
append_list_if(COMPILER_RT_HAS_LIBM m UBSAN_DYNAMIC_LIBS)
76-
endif()
7774

7875
add_compiler_rt_component(ubsan)
7976

@@ -207,8 +204,6 @@ else()
207204
RTSanitizerCommonLibc
208205
RTSanitizerCommonCoverage
209206
RTSanitizerCommonSymbolizer
210-
# FIXME: Some wrong with C++ demangling.
211-
# RTSanitizerCommonSymbolizerInternal
212207
RTUbsan
213208
RTUbsan_standalone
214209
RTInterception
@@ -253,8 +248,6 @@ else()
253248
RTSanitizerCommonLibc
254249
RTSanitizerCommonCoverage
255250
RTSanitizerCommonSymbolizer
256-
# FIXME: Some wrong with C++ demangling.
257-
# RTSanitizerCommonSymbolizerInternal
258251
RTUbsan
259252
RTUbsan_cxx
260253
RTUbsan_standalone

0 commit comments

Comments
 (0)