[compiler-rt] [tsan] Replace ALIGNED with alignas (PR #98959)
Fangrui Song via llvm-commits
llvm-commits at lists.llvm.org
Tue Jul 16 14:37:23 PDT 2024
MaskRay wrote:
> Hi, we started to see build errors on our mac bots after this patch was landed
>
> Error message:
>
> ```
> FAILED: compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan_osx_dynamic.dir/tsan_platform_mac.cpp.o
> /Volumes/Work/s/w/ir/x/w/llvm_build/./bin/clang++ --target=x86_64-apple-darwin22.6.0 --sysroot=/Volumes/Work/s/w/ir/cache/macos_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -DCOMPILER_RT_SHARED_LIB -D_DEBUG -D_GLIBCXX_ASSERTIONS -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -Dclang_rt_tsan_osx_dynamic_EXPORTS -I/Volumes/Work/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/tsan/rtl/../.. -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffile-prefix-map=/Volumes/Work/s/w/ir/x/w/llvm_build/runtimes/runtimes-bins=../../../llvm-llvm-project -ffile-prefix-map=/Volumes/Work/s/w/ir/x/w/llvm-llvm-project/= -no-canonical-prefixes -Wall -Wno-unused-parameter -O3 -DNDEBUG -std=c++17 -arch arm64 -arch x86_64 -isysroot /Volumes/Work/s/w/ir/cache/macos_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fPIC -stdlib=libc++ -mmacosx-version-min=10.13 -isysroot /Volumes/Work/s/w/ir/cache/macos_sdk/XCode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk -fno-lto -fPIC -fno-builtin -fno-exceptions -funwind-tables -fno-stack-protector -fno-sanitize=safe-stack -fvisibility=hidden -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -g -Wno-gnu -Wno-variadic-macros -Wno-c99-extensions -ftrivial-auto-var-init=pattern -nostdinc++ -fPIE -fno-rtti -msse4.2 -Wframe-larger-than=530 -Wglobal-constructors -MD -MT compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan_osx_dynamic.dir/tsan_platform_mac.cpp.o -MF compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan_osx_dynamic.dir/tsan_platform_mac.cpp.o.d -o compiler-rt/lib/tsan/rtl/CMakeFiles/clang_rt.tsan_osx_dynamic.dir/tsan_platform_mac.cpp.o -c /Volumes/Work/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
> /Volumes/Work/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp:49:52: error: 'alignas' attribute cannot be applied to types
> 49 | static char main_thread_state[sizeof(ThreadState)] alignas(
> | ^
> /Volumes/Work/s/w/ir/x/w/llvm-llvm-project/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp:252:3: warning: missing field 'start' initializer [-Wmissing-designated-field-initializers]
> 252 | };
> | ^
> 1 warning and 1 error generated.
> ```
>
> Could you take a look please? If it takes a bit of time could you revert it first?
Sorry. The `tsan_platform_mac.cpp` issue was due to the placement of `alignas`. Unlike `__attribute__((align(...)))`, `alignas` must precede `static`.
I've fixed tsan_platform_mac.cpp in a separate commit and reland this PR without modifying tsan_platform_mac.cpp
https://github.com/llvm/llvm-project/pull/98959
More information about the llvm-commits
mailing list