[llvm-dev] CFI error with binutils 2.27

Artemiy Volkov via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 17 09:31:53 PDT 2016

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

> Thanks for any suggestions.
> -Rich


More information about the llvm-dev mailing list