|
| 1 | +name: Nightly memory sanitizer with origins check |
| 2 | +# owner: Steven6798 |
| 3 | + |
| 4 | +on: |
| 5 | + # pull_request: {} # Uncomment only to test this WF file update. |
| 6 | + # schedule: |
| 7 | + # - cron: '0 7 * * *' # Runs daily at 1:00 AM CST |
| 8 | + workflow_dispatch: # Allows manual triggering |
| 9 | + |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: write |
| 13 | +jobs: |
| 14 | + build-and-runtest-with-msan-origins: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + if: github.repository == 'qualcomm/eld' |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Set up Clang 22 |
| 20 | + uses: egor-tensin/setup-clang@23bc15cd4207e45f1566447deb48f4ff3ef932cb #v2.3 |
| 21 | + with: |
| 22 | + version: "22" |
| 23 | + platform: x64 |
| 24 | + |
| 25 | + - name: Install libc++ and libc++abi |
| 26 | + run: | |
| 27 | + sudo apt update |
| 28 | + sudo apt install -y clang-22 lld-22 ninja-build libc++-22-dev libc++abi-22-dev ccache libclang-rt-22-dev libunwind-22-dev |
| 29 | + echo "PATH=/usr/lib/llvm-22/bin:$PATH" >> $GITHUB_ENV |
| 30 | + echo "LD_LIBRARY_PATH=/usr/lib/llvm-22/lib:$PATH" >> $GITHUB_ENV |
| 31 | +
|
| 32 | + - name: Build and Test with Clang and show versions |
| 33 | + run: | |
| 34 | + echo "clang version" |
| 35 | + clang --version |
| 36 | + echo "clang++ version" |
| 37 | + clang++ -stdlib=libc++ --version |
| 38 | + echo "ld.lld version" |
| 39 | + ld.lld --version |
| 40 | + echo '#include <iostream>' > test.cpp |
| 41 | + echo 'int main() { std::cout << "Hello, Clang on Ubuntu 24.04!" << std::endl; return 0; }' >> test.cpp |
| 42 | + clang++ -std=c++17 -stdlib=libc++ test.cpp -o test_clang |
| 43 | + ./test_clang |
| 44 | +
|
| 45 | + - name: Checkout llvm-project |
| 46 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 47 | + with: |
| 48 | + repository: llvm/llvm-project |
| 49 | + path: ./llvm-project/ |
| 50 | + ref: main |
| 51 | + |
| 52 | + - name: Checkout eld |
| 53 | + if: github.event_name != 'pull_request' |
| 54 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 55 | + with: |
| 56 | + repository: qualcomm/eld |
| 57 | + path: ./llvm-project/llvm/tools/eld |
| 58 | + ref: ${{ github.ref_name }} |
| 59 | + fetch-depth: 1 |
| 60 | + |
| 61 | + - name: Checkout eld PR branch |
| 62 | + if: github.event_name == 'pull_request' |
| 63 | + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 |
| 64 | + with: |
| 65 | + repository: ${{ github.event.pull_request.head.repo.full_name }} |
| 66 | + path: ./llvm-project/llvm/tools/eld |
| 67 | + ref: ${{ github.event.pull_request.head.ref }} |
| 68 | + fetch-depth: 1 |
| 69 | + |
| 70 | + - name: Configure workflow environment variables |
| 71 | + uses: ./llvm-project//llvm/tools/eld/.github/workflows/ConfigureBuildWorkflowENV |
| 72 | + |
| 73 | + - name: Restore ccache |
| 74 | + id: cache-ccache |
| 75 | + uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0 |
| 76 | + with: |
| 77 | + path: ${{ github.workspace }}/obj/ccache |
| 78 | + key: memory-sanitizer-ccache-${{ runner.os }}-${{ github.run_id }} |
| 79 | + restore-keys: | |
| 80 | + memory-sanitizer-ccache-${{ runner.os }}- |
| 81 | +
|
| 82 | + - name: Record pre-build entry |
| 83 | + if: github.event_name == 'schedule' |
| 84 | + uses: ./llvm-project//llvm/tools/eld/.github/workflows/BuildStatusDataRecorder |
| 85 | + with: |
| 86 | + enabled: true |
| 87 | + project: "./llvm-project//llvm/tools/eld" |
| 88 | + stage: "pre-" |
| 89 | + workflow-name: "memory-sanitizer-with-origins" |
| 90 | + record-mode: "record" |
| 91 | + status: "fail" |
| 92 | + run-id: ${{github.run_id}} |
| 93 | + arch-name: "all" |
| 94 | + branch-name: "${{env.BUILD_BRANCH}}" |
| 95 | + |
| 96 | + - name: Run CMake |
| 97 | + run: | |
| 98 | + mkdir -p obj |
| 99 | + cd obj |
| 100 | + cmake -G Ninja \ |
| 101 | + -DCMAKE_BUILD_TYPE=Release \ |
| 102 | + -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON \ |
| 103 | + -DLLVM_USE_SANITIZER="MemoryWithOrigins" \ |
| 104 | + -DCMAKE_CXX_FLAGS:STRING="-stdlib=libc++" \ |
| 105 | + -DCMAKE_C_COMPILER:STRING=`which clang` \ |
| 106 | + -DCMAKE_CXX_COMPILER:STRING=`which clang++` \ |
| 107 | + -DLLVM_TARGETS_TO_BUILD:STRING="ARM;AArch64;RISCV;Hexagon;X86" \ |
| 108 | + -DLLVM_CCACHE_BUILD:BOOL=ON \ |
| 109 | + -DLLVM_CCACHE_DIR:STRING=$PWD/ccache/ \ |
| 110 | + -DLLVM_OPTIMIZED_TABLEGEN:BOOL=ON \ |
| 111 | + -DLLVM_ENABLE_SPHINX=OFF \ |
| 112 | + -DUSE_LLVM_UTILS_FROM_INSTALL:BOOL=ON \ |
| 113 | + -DLLVM_USE_LINKER=lld \ |
| 114 | + ../llvm-project/llvm |
| 115 | +
|
| 116 | + - name: Build Project |
| 117 | + run: | |
| 118 | + cd obj |
| 119 | + ninja ld.eld |
| 120 | +
|
| 121 | + - name: Prune ccache before save |
| 122 | + if: always() |
| 123 | + env: |
| 124 | + CCACHE_DIR: ${{ github.workspace }}/obj/ccache |
| 125 | + run: ccache --evict-older-than 7200s |
| 126 | + |
| 127 | + - name: Save ccache |
| 128 | + if: always() |
| 129 | + uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 #v6.1.0 |
| 130 | + with: |
| 131 | + path: ${{ github.workspace }}/obj/ccache |
| 132 | + key: memory-sanitizer-ccache-${{ runner.os }}-${{ github.run_id }} |
| 133 | + |
| 134 | + - name: Fetch nightly toolset |
| 135 | + uses: ./llvm-project//llvm/tools/eld/.github/workflows/FetchNightlyToolset |
| 136 | + |
| 137 | + - name: Run tests |
| 138 | + run: | |
| 139 | + cd obj |
| 140 | + ninja check-eld |
| 141 | +
|
| 142 | + - name: Update build entry |
| 143 | + if: github.event_name == 'schedule' |
| 144 | + uses: ./llvm-project//llvm/tools/eld/.github/workflows/BuildStatusDataRecorder |
| 145 | + with: |
| 146 | + enabled: true |
| 147 | + project: "./llvm-project//llvm/tools/eld" |
| 148 | + stage: "post-" |
| 149 | + workflow-name: "memory-sanitizer-with-origins" |
| 150 | + record-mode: "update" |
| 151 | + status: "pass" |
| 152 | + run-id: ${{github.run_id}} |
| 153 | + arch-name: "all" |
| 154 | + branch-name: "${{env.BUILD_BRANCH}}" |
| 155 | + |
| 156 | + - name: Clean up nightly toolset |
| 157 | + if: always() |
| 158 | + run: | |
| 159 | + rm -rf ${{ github.workspace }}/inst |
| 160 | + rm -f ${{ github.workspace }}/install-nightly-toolchain.tar.xz |
| 161 | + if [ -d "${{ github.workspace }}/inst" ] || [ -f "${{ github.workspace }}/install-nightly-toolchain.tar.xz" ]; then |
| 162 | + echo "Warning: Failed to clean up nightly toolset" |
| 163 | + else |
| 164 | + echo "Successfully cleaned up nightly toolset" |
| 165 | + fi |
0 commit comments