[clang] [llvm] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

Florian Hahn via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 10 07:51:53 PDT 2024


fhahn wrote:

It looks like there's still a failure related to this patch on current main AFAICT (MSAN finds a use of uninitialized value): https://lab.llvm.org/buildbot/#/builders/169/builds/852/steps/12/logs/stdio

```
FAIL: Clang :: CodeGen/arm-branch-protection-attr-1.c (3 of 83868)
******************** TEST 'Clang :: CodeGen/arm-branch-protection-attr-1.c' FAILED ********************
Exit Code: 2
Command Output (stderr):
--
RUN: at line 2: /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/clang -cc1 -internal-isystem /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/lib/clang/19/include -nostdsysteminc -triple thumbv7m-unknown-unknown-eabi -emit-llvm /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/test/CodeGen/arm-branch-protection-attr-1.c -o -                                | /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/test/CodeGen/arm-branch-protection-attr-1.c --check-prefix=CHECK
+ /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/clang -cc1 -internal-isystem /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/lib/clang/19/include -nostdsysteminc -triple thumbv7m-unknown-unknown-eabi -emit-llvm /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/test/CodeGen/arm-branch-protection-attr-1.c -o -
+ /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/FileCheck /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/test/CodeGen/arm-branch-protection-attr-1.c --check-prefix=CHECK
==227510==WARNING: MemorySanitizer: use-of-uninitialized-value
    #0 0x55555f411b60 in clang::TargetInfo::BranchProtectionInfo::setFnAttributes(llvm::AttrBuilder&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/include/clang/Basic/TargetInfo.h:1468:11
    #1 0x55555f411931 in clang::TargetInfo::BranchProtectionInfo::setFnAttributes(llvm::Function&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/include/clang/Basic/TargetInfo.h:1455:7
    #2 0x55555f418b20 in (anonymous namespace)::ARMTargetCodeGenInfo::setTargetAttributes(clang::Decl const*, llvm::GlobalValue*, clang::CodeGen::CodeGenModule&) const /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/Targets/ARM.cpp:155:15
    #3 0x55555e980b31 in clang::CodeGen::CodeGenModule::setNonAliasAttributes(clang::GlobalDecl, llvm::GlobalObject*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:2727:26
    #4 0x55555e98fe97 in clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl, llvm::GlobalValue*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:5980:3
    #5 0x55555e9853f4 in clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl, llvm::GlobalValue*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:4141:12
    #6 0x55555e98bfb3 in clang::CodeGen::CodeGenModule::EmitGlobal(clang::GlobalDecl) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:3852:5
    #7 0x55555e982db1 in clang::CodeGen::CodeGenModule::EmitTopLevelDecl(clang::Decl*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/CodeGenModule.cpp:6863:5
    #8 0x55555f1ef187 in (anonymous namespace)::CodeGeneratorImpl::HandleTopLevelDecl(clang::DeclGroupRef) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/ModuleBuilder.cpp:190:18
    #9 0x55555f1e1510 in clang::BackendConsumer::HandleTopLevelDecl(clang::DeclGroupRef) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/CodeGen/CodeGenAction.cpp:199:8
    #10 0x5555616c3460 in clang::ParseAST(clang::Sema&, bool, bool) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Parse/ParseAST.cpp:167:31
    #11 0x55555f6dd91b in clang::FrontendAction::Execute() /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Frontend/FrontendAction.cpp:1078:8
    #12 0x55555f628f29 in clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/Frontend/CompilerInstance.cpp:1061:33
    #13 0x55555f7e7b3d in clang::ExecuteCompilerInvocation(clang::CompilerInstance*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:280:25
    #14 0x55555b0a2b10 in cc1_main(llvm::ArrayRef<char const*>, char const*, void*) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/tools/driver/cc1_main.cpp:276:15
    #15 0x55555b09d0bf in ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/tools/driver/driver.cpp:215:12
    #16 0x55555b09ad69 in clang_main(int, char**, llvm::ToolContext const&) /b/sanitizer-x86_64-linux-fast/build/llvm-project/clang/tools/driver/driver.cpp:256:12
    #17 0x55555b0b8018 in main /b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/tools/clang/tools/driver/clang-driver.cpp:17:10
    #18 0x7ffff7a2814f  (/lib/x86_64-linux-gnu/libc.so.6+0x2814f) (BuildId: 502d55a5e424889ddb2846eb6dbeddaedd75b323)
    #19 0x7ffff7a28208 in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x28208) (BuildId: 502d55a5e424889ddb2846eb6dbeddaedd75b323)
    #20 0x55555b001f64 in _start (/b/sanitizer-x86_64-linux-fast/build/llvm_build_msan/bin/clang-19+0x5aadf64)
```

https://github.com/llvm/llvm-project/pull/82819


More information about the llvm-commits mailing list