AArch64 GCS (Guarded Control Stack) is similar enough to CET that we can re-use the existing code that is guarded by _LIBUNWIND_USE_CET, so long as we also add defines to locate the GCS stack and pop the entries from it. We also need the jumpto function to exit using br instead of ret, to prevent it from popping the GCS stack. GCS support is enabled using the LIBUNWIND_ENABLE_GCS cmake option. This enables -mbranch-protection=standard, which enables GCS. For the places we need to use GCS instructions we use the target attribute, as there's not a command-line option to enable a specific architecture extension. (cherry picked from commit b32aac4358c1f6639de7c453656cd74fbab75d71)
49 lines
1.5 KiB
INI
49 lines
1.5 KiB
INI
#
|
|
# Configuration file for running the libunwind tests against the shared library.
|
|
#
|
|
|
|
lit_config.load_config(config, '@CMAKE_CURRENT_BINARY_DIR@/cmake-bridge.cfg')
|
|
|
|
compile_flags = []
|
|
link_flags = []
|
|
|
|
if @LIBUNWIND_ENABLE_CET@:
|
|
compile_flags.append('-fcf-protection=full')
|
|
|
|
if @LIBUNWIND_ENABLE_GCS@:
|
|
compile_flags.append('-mbranch-protection=standard')
|
|
|
|
# On ELF platforms, link tests with -Wl,--export-dynamic if supported by the linker.
|
|
if len('@CMAKE_EXE_EXPORTS_CXX_FLAG@'):
|
|
link_flags.append('@CMAKE_EXE_EXPORTS_CXX_FLAG@')
|
|
|
|
if '@CMAKE_DL_LIBS@':
|
|
link_flags.append('-l@CMAKE_DL_LIBS@')
|
|
|
|
# Stack unwinding tests need unwinding tables and these are not generated by default on all targets.
|
|
compile_flags.append('-funwind-tables')
|
|
|
|
local_sysroot = '@CMAKE_OSX_SYSROOT@' or '@CMAKE_SYSROOT@'
|
|
config.substitutions.append(('%{flags}',
|
|
'-isysroot {}'.format(local_sysroot) if local_sysroot else ''
|
|
))
|
|
config.substitutions.append(('%{compile_flags}',
|
|
'-nostdinc++ -I %{{include}} {}'.format(' '.join(compile_flags))
|
|
))
|
|
config.substitutions.append(('%{link_flags}',
|
|
'-L %{{lib}} -Wl,-rpath,%{{lib}} -lunwind {}'.format(' '.join(link_flags))
|
|
))
|
|
config.substitutions.append(('%{exec}',
|
|
'%{executor} --execdir %T -- '
|
|
))
|
|
|
|
import os, site
|
|
site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils'))
|
|
import libcxx.test.params, libcxx.test.config
|
|
libcxx.test.config.configure(
|
|
libcxx.test.params.DEFAULT_PARAMETERS,
|
|
libcxx.test.features.DEFAULT_FEATURES,
|
|
config,
|
|
lit_config
|
|
)
|