Uploaded image for project: 'RHEL'
  1. RHEL
  2. RHEL-93213

annocheck "notes" test fails for clang_rt.crtbegin.o and clang_rt.crtend.o [rhel-10]

Linking RHIVOS CVEs to...Migration: Automation ...SWIFT: POC ConversionSync from "Extern...XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • rhel-10.1
    • rhel-10.1
    • annobin
    • None
    • annobin-12.93-3.el10
    • No
    • Low
    • 1
    • rhel-sst-pt-llvm-rust-go
    • ssg_platform_tools
    • 1
    • False
    • False
    • Hide

      None

      Show
      None
    • No
    • PT LLVMRustGo 2025 S8
    • Unspecified Release Note Type - Unknown
    • Unspecified
    • Unspecified
    • Unspecified
    • None

      Although both annobin and the clang plugin have been rebuilt against LLVM 20 (RHEL-82000), the following files still fail the notes test. Here's the result for clang_rt.crtbegin.o on aarch64 for reference:

      Command: annocheck --ignore-unknown --verbose --profile=el10 /usr/lib/clang/20/lib/aarch64-redhat-linux-gnu/clang_rt.crtbegin.o
      Exit Code: 1
      [...]
      Hardened: /usr/lib/clang/20/lib/aarch64-redhat-linux-gnu/clang_rt.crtbegin.o: FAIL: notes test because annobin notes were not found Hardened: /usr/lib/clang/20/lib/aarch64-redhat-linux-gnu/clang_rt.crtbegin.o: info: For more information visit: https://sourceware.org/annobin/annobin.html/Test-notes.html
      [...]
      

      Tested with llvm-20.1.4-1.el10. Reviewing the build logs, it appears that no annobin plugin is being passed when building crtbegin and crtend:

      [126/413] cd /builddir/build/BUILD/llvm-project-20.1.4.src/llvm/redhat-linux-build/runtimes/builtins-bins && /builddir/build/BUILD/llvm-project-20.1.4.src/llvm/redhat-linux-build/bin/clang -O2 -flto=thin -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS --config=/usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -mbranch-protection=standard -fasynchronous-unwind-tables -D_DEFAULT_SOURCE -Dasm=__asm__ -march=armv8-a -fno-lto -std=c11 -DCRT_HAS_INITFINI_ARRAY -DEH_USE_FRAME_REGISTRY -fPIC -Wno-pedantic --target=aarch64-redhat-linux-gnu -o /builddir/build/BUILD/llvm-project-20.1.4.src/llvm/redhat-linux-build/./lib/../bin/../../../lib/clang/20/lib/aarch64-redhat-linux-gnu/clang_rt.crtbegin.o -c /builddir/build/BUILD/llvm-project-20.1.4.src/compiler-rt/lib/builtins/crtbegin.c
      [127/413] cd /builddir/build/BUILD/llvm-project-20.1.4.src/llvm/redhat-linux-build/runtimes/builtins-bins && /builddir/build/BUILD/llvm-project-20.1.4.src/llvm/redhat-linux-build/bin/clang -O2 -flto=thin -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS --config=/usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -mbranch-protection=standard -fasynchronous-unwind-tables -D_DEFAULT_SOURCE -Dasm=__asm__ -march=armv8-a -fno-lto -std=c11 -DCRT_HAS_INITFINI_ARRAY -DEH_USE_FRAME_REGISTRY -fPIC -Wno-pedantic --target=aarch64-redhat-linux-gnu -o /builddir/build/BUILD/llvm-project-20.1.4.src/llvm/redhat-linux-build/./lib/../bin/../../../lib/clang/20/lib/aarch64-redhat-linux-gnu/clang_rt.crtend.o -c /builddir/build/BUILD/llvm-project-20.1.4.src/compiler-rt/lib/builtins/crtend.c
      

      Additionally, only annobin-plugin-gcc-12.93-2.el10 is installed during the build. annobin-plugin-clang-12.93-2.el10 is missing.

      I did a quick test to check if just building with the plugin would solve the issue.

      # rpm -q annobin-annocheck annobin-plugin-clang clang
      annobin-annocheck-12.93-2.el10.ppc64le
      annobin-plugin-clang-12.93-2.el10.ppc64le
      clang-20.1.2-1.el10.ppc64le
      # curl https://raw.githubusercontent.com/llvm/llvm-project/refs/tags/llvmorg-20.1.4/compiler-rt/lib/builtins/crtbegin.c > crtbegin.c
      # clang -O2 -fplugin=/usr/lib64/clang/plugins/annobin-for-clang.so -flto=thin -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS --config=/usr/lib/rpm/redhat/redhat-hardened-clang.cfg -fstack-protector-strong -m64 -mcpu=power9 -mtune=power10 -fasynchronous-unwind-tables -fstack-clash-protection -D_DEFAULT_SOURCE -Dasm=__asm__ -m64 -fno-lto -std=c11 -DCRT_HAS_INITFINI_ARRAY -DEH_USE_FRAME_REGISTRY -fPIC -Wno-pedantic --target=ppc64le-redhat-linux-gnu -o clang_rt.crtbegin.o -c crtbegin.c
      # annocheck --ignore-unknown --verbose --profile=el10 clang_rt.crtbegin.o
      annocheck: Version 12.93.
      [ ... ]
      Hardened: clang_rt.crtbegin.o: MAYB: test: lto, reason: a region of code compiled without LTO was detected
      Hardened: clang_rt.crtbegin.o: info: For more information visit: https://sourceware.org/annobin/annobin.html/Test-lto.html
      Hardened: clang_rt.crtbegin.o: PASS: notes test because no negative result detected
      [ ... ]
      Hardened: clang_rt.crtbegin.o: Overall: FAIL (due to MAYB results).
      

      Building with the plugin will yield a MAYB result on the lto inspection, but that's expected as we're passing -fno-lto.

              rh-ee-tmachado Tulio Magno Quites Machado Filho
              rhn-support-jchecahi Jesus Checa Hidalgo
              Thomas Stellard Thomas Stellard
              Vaclav Kadlcik Vaclav Kadlcik
              Votes:
              0 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated: