[llvm] MCFragment: Use trailing data for fixed-size part (PR #150846)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 6 17:50:30 PDT 2025


MaskRay wrote:

> The new test is failing on Linaro's 32-bit builders:
> 
> ```
> ******************** TEST 'LLVM :: MC/ELF/many-instructions.s' FAILED ********************
> Exit Code: 1
> Command Output (stderr):
> --
> /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/MC/ELF/many-instructions.s -o /dev/null -debug-only=mc-dump 2>&1 | grep -E -o '[0-9]+ Data Size:[0-9]+' | /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/MC/ELF/many-instructions.s # RUN: at line 2
> + /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/llvm-mc -filetype=obj -triple=x86_64 /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/MC/ELF/many-instructions.s -o /dev/null -debug-only=mc-dump
> + grep -E -o '[0-9]+ Data Size:[0-9]+'
> + /home/tcwg-buildbot/worker/clang-armv7-global-isel/stage1/bin/FileCheck /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/MC/ELF/many-instructions.s
> /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/MC/ELF/many-instructions.s:5:10: error: CHECK: expected string not found in input
> # CHECK: 0 Data Size:16220
>          ^
> <stdin>:1:1: note: scanning from here
> 0 Data Size:16240
> ^
> Input file: <stdin>
> Check file: /home/tcwg-buildbot/worker/clang-armv7-global-isel/llvm/llvm/test/MC/ELF/many-instructions.s
> -dump-input=help explains the following input dump.
> Input was:
> <<<<<<
>          1: 0 Data Size:16240 
> check:5     X~~~~~~~~~~~~~~~~~ error: no match found
>          2: 16240 Data Size:140 
> check:5     ~~~~~~~~~~~~~~~~~~~~
> >>>>>>
> --
> ```
> 
> [lab.llvm.org/buildbot#/builders/39/builds/7363](https://lab.llvm.org/buildbot/#/builders/39/builds/7363) is one example.
> 
> I think these stats are the size of structures inside of MC, which would mean they could change size if the ABI is different? (we only have 32-bit Arm builds, not 32-bit x86 so idk if it's a problem there)

Yes. sizeof(MCFragment) differences can change the fragment splitting behavior. We should add an REQUIRES that this is only for 64-bit platforms for simplicity.

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


More information about the llvm-commits mailing list