Richard Pennington via llvm-dev
2016-Aug-06 16:39 UTC
[llvm-dev] CFI error with binutils 2.27
Hi, :If I compile this file with debugging enabled (clang/LLVM TOT) int main() { } I get the error Error: inconsistent uses of .cfi_sections From the 2.27 binutils assemblers. It seems that 2.27 doesn't like the .cfi_sections .debug_frame directive following previous .cfi directives. The assemblers seem to be happy if the .cfi_sections directive precedes any other .cfi directive. Is this a bug in binutils or LLVM? It looks as if a fix might be to move the generation of the .cfi_sections directive from endModule() to somewhere else (maybe a non-existant beginModule()?). Could someone give me some hints about what the right approach might be? It looks as if the ARM code generator might need special handling also since it appears to emit the .cfi_sections directive itself. Thanks for any suggestions. -Rich
Richard Pennington via llvm-dev
2016-Aug-07 03:32 UTC
[llvm-dev] CFI error with binutils 2.27
On 08/06/2016 11:39 AM, Richard Pennington via llvm-dev wrote:> Hi, > > :If I compile this file with debugging enabled (clang/LLVM TOT) > > int main() > { > } > > I get the error > > Error: inconsistent uses of .cfi_sections > > From the 2.27 binutils assemblers. It seems that 2.27 doesn't like the > > .cfi_sections .debug_frame > > directive following previous .cfi directives. The assemblers seem to > be happy if the .cfi_sections directive precedes any other .cfi > directive. Is this a bug in binutils or LLVM? It looks as if a fix > might be to move the generation of the .cfi_sections directive from > endModule() to somewhere else (maybe a non-existant beginModule()?). > > Could someone give me some hints about what the right approach might > be? It looks as if the ARM code generator might need special handling > also since it appears to emit the .cfi_sections directive itself. > > Thanks for any suggestions. > > -RichAs a work-around I modified DwarfCFIException.cpp and ARMException.cpp to send the .cfi_sections directive before the first function is processed. Seems to work. -Rich
Martin J. O'Riordan via llvm-dev
2016-Aug-09 21:07 UTC
[llvm-dev] CFI error with binutils 2.27
Was there any determination as to whether this is an LLVM bug or a Binutils bug? I am using Binutils v2.26 plus some subsequent custom mods, and hoping to update to v2.27 soon so that I can ditch the mods and it would be good to know what I should expect. Thanks, MartinO -----Original Message----- From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Richard Pennington via llvm-dev Sent: 06 August 2016 17:40 To: llvm-dev at lists.llvm.org Subject: [llvm-dev] CFI error with binutils 2.27 Hi, :If I compile this file with debugging enabled (clang/LLVM TOT) int main() { } I get the error Error: inconsistent uses of .cfi_sections From the 2.27 binutils assemblers. It seems that 2.27 doesn't like the .cfi_sections .debug_frame directive following previous .cfi directives. The assemblers seem to be happy if the .cfi_sections directive precedes any other .cfi directive. Is this a bug in binutils or LLVM? It looks as if a fix might be to move the generation of the .cfi_sections directive from endModule() to somewhere else (maybe a non-existant beginModule()?). Could someone give me some hints about what the right approach might be? It looks as if the ARM code generator might need special handling also since it appears to emit the .cfi_sections directive itself. Thanks for any suggestions. -Rich _______________________________________________ LLVM Developers mailing list llvm-dev at lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
Richard Pennington via llvm-dev
2016-Aug-10 03:25 UTC
[llvm-dev] CFI error with binutils 2.27
Without any other feedback I went under the assumption that it was an LLVM error. The patch I made was pretty trivial and I'm happily using 2.27, but I'm waiting to see where people think the real bug is. -Rich On 08/09/2016 04:07 PM, Martin J. O'Riordan via llvm-dev wrote:> Was there any determination as to whether this is an LLVM bug or a Binutils bug? > > I am using Binutils v2.26 plus some subsequent custom mods, and hoping to update to v2.27 soon so that I can ditch the mods and it would be good to know what I should expect. > > Thanks, > > MartinO > > -----Original Message----- > From: llvm-dev [mailto:llvm-dev-bounces at lists.llvm.org] On Behalf Of Richard Pennington via llvm-dev > Sent: 06 August 2016 17:40 > To: llvm-dev at lists.llvm.org > Subject: [llvm-dev] CFI error with binutils 2.27 > > Hi, > > :If I compile this file with debugging enabled (clang/LLVM TOT) > > int main() > { > } > > I get the error > > Error: inconsistent uses of .cfi_sections > > From the 2.27 binutils assemblers. It seems that 2.27 doesn't like the > > .cfi_sections .debug_frame > > directive following previous .cfi directives. The assemblers seem to be happy if the .cfi_sections directive precedes any other .cfi directive. > Is this a bug in binutils or LLVM? It looks as if a fix might be to move the generation of the .cfi_sections directive from endModule() to somewhere else (maybe a non-existant beginModule()?). > > Could someone give me some hints about what the right approach might be? > It looks as if the ARM code generator might need special handling also since it appears to emit the .cfi_sections directive itself. > > Thanks for any suggestions. > > -Rich > > > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev > > _______________________________________________ > LLVM Developers mailing list > llvm-dev at lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev >
On Sat, Aug 6, 2016 at 7:39 PM, Richard Pennington via llvm-dev <llvm-dev at lists.llvm.org> wrote:> Hi, > > :If I compile this file with debugging enabled (clang/LLVM TOT) > > int main() > { > } > > I get the error > > Error: inconsistent uses of .cfi_sections > > From the 2.27 binutils assemblers. It seems that 2.27 doesn't like the > > .cfi_sections .debug_frame > > directive following previous .cfi directives. The assemblers seem to be > happy if the .cfi_sections directive precedes any other .cfi directive. Is > this a bug in binutils or LLVM? It looks as if a fix might be to move the > generation of the .cfi_sections directive from endModule() to somewhere else > (maybe a non-existant beginModule()?). > > Could someone give me some hints about what the right approach might be? It > looks as if the ARM code generator might need special handling also since it > appears to emit the .cfi_sections directive itself.It doesn't seem like a GAS problem to me since they are adhering to their documentation (https://sourceware.org/binutils/docs/as/CFI-directives.html) that says that all .cfi_sections directives must precede the first .cfi_startproc directive. The check for this rule was introduced to GAS in commit bd5608dcc6a76876db06b1af1852252a4282aa2f on Feb 11 2016 (binutils 2.26+) and LLVM doesn't work for me when using any version of binutils that contains this commit. I went ahead and filed a bug for this with the LLVM bugzilla, it can be found at https://llvm.org/bugs/show_bug.cgi?id=29017.> > Thanks for any suggestions. > > -Rich >Thanks, Artemiy