Akshith Gunasekaran via llvm-dev
2021-Jun-08 20:16 UTC
[llvm-dev] Compiling linux with `clang -fbasic-block-sections=labels`
Hi, Here is a public gist with the repro steps: https://gist.github.com/akshithg/e5a58fc7012a65e6ec2e94794d66569f It should have 1) the config i'm using 2) the toolchain version 3) build steps Feel free to shoot more questions if you need more details :) On Tue, Jun 8, 2021 at 7:24 AM Sriraman Tallam <tmsriram at google.com> wrote:> > > 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/5b6240e1/attachment.html>
Sriraman Tallam via llvm-dev
2021-Jun-08 21:56 UTC
[llvm-dev] Compiling linux with `clang -fbasic-block-sections=labels`
On Tue, Jun 8, 2021 at 1:16 PM Akshith Gunasekaran <akshith.573 at gmail.com> wrote:> Hi, > > Here is a public gist with the repro steps: > https://gist.github.com/akshithg/e5a58fc7012a65e6ec2e94794d66569f > It should have 1) the config i'm using 2) the toolchain version 3) build > steps > > Feel free to shoot more questions if you need more details :) >Thanks, in the interests of simplifying this further, would it be possible to give me the preprocessed source and the failing command?> > > On Tue, Jun 8, 2021 at 7:24 AM Sriraman Tallam <tmsriram at google.com> > wrote: > >> >> >> 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 | >> >-- 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/c9c91030/attachment.html>