[llvm-dev] Compiling linux with `clang -fbasic-block-sections=labels`

Sriraman Tallam via llvm-dev llvm-dev at lists.llvm.org
Tue Jun 8 07:23:33 PDT 2021


On Mon, Jun 7, 2021 at 10:39 PM David Blaikie <dblaikie at gmail.com> wrote:

> BB sections has only been tested/implemented with a fairly narrow set of
> flags so far as I know, and is sufficiently novel that various features
> won't interact correctly with it without some work to support the
> combination of bb sections and those features.
>
> I'd /guess/ BPF, for instance, probably doesn't work with BB sections out
> of the box & may require some work (like some work was needed to support BB
> sections with DWARF) - I believe BPF is mandatory/used by default when
> building the Linux kernel? So maybe that's what's being tripped over here.
> But could something else entirely - that's just my first guess.
>

Right, we have not tried to build the linux kernel with these flags but it
is something we would like to test and fix.


>
>
> On Mon, Jun 7, 2021 at 9:15 PM A G via llvm-dev <llvm-dev at lists.llvm.org>
> wrote:
>
>> Hi,
>> I'm trying to build the linux kernel with *`clang
>> -fbasic-block-sections=labels`.*
>>
>
Labels does not actually generate sections and it must be a simpler step as
it only adds metadata to the binary.


>
>> I ran into this error:
>>
>> /tmp/main-81886d.s: Assembler messages:
>> /tmp/main-81886d.s: Error: .size expression for .BB.set_reset_devices
>> does not evaluate to a constant
>> /tmp/main-81886d.s: Error: .size expression for .BB.debug_kernel does not
>> evaluate to a constant
>> /tmp/main-81886d.s: Error: .size expression for .BB.quiet_kernel does not
>> evaluate to a constant
>> /tmp/main-81886d.s: Error: .size expression for .BB.loglevel does not
>> evaluate to a constant
>>
>

Would you be able to give us a smaller repro for this, we can take a look.
Basic block labels uses size expressions when generating metadata and it
looks like we are not doing this right under some circumstances.



>
>> make kernelversion
>> 5.10.0
>>
>> clang version 11.1.0 (g... at github.com:llvm/llvm-project.git
>> 1fdec59bffc11ae37eb51a1b9869f0696bfd5312)
>> Target: x86_64-unknown-linux-gnu
>>
>>
>> 1. Can someone help me understand what this error means?
>> 2. Is *clang-built-linux* a better place to ask this question?
>> 3. Is there a workaround for this?
>>
>> Thanks
>> Akshith
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> llvm-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
>>
>

-- 

Sri    Tallam |

Software Engineer |

tmsriram at google.com |
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20210608/43e64f0c/attachment.html>


More information about the llvm-dev mailing list