[all-commits] [llvm/llvm-project] 165128: [clang] fix generation of .debug_aranges with LTO

Azat Khuzhin via All-commits all-commits at lists.llvm.org
Tue Oct 4 13:03:55 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 16512898956857b13e566165ba9a195be81d325f
      https://github.com/llvm/llvm-project/commit/16512898956857b13e566165ba9a195be81d325f
  Author: Azat Khuzhin <a3at.mail at gmail.com>
  Date:   2022-10-04 (Tue, 04 Oct 2022)

  Changed paths:
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    A clang/test/Driver/debug-options-aranges.c

  Log Message:
  -----------
  [clang] fix generation of .debug_aranges with LTO

Right now in case of LTO the section is not emited:

    $ cat test.c
    void __attribute__((optnone)) bar()
    {
    }
    void __attribute__((optnone)) foo()
    {
            bar();
    }
    int main()
    {
            foo();
    }

    $ clang -flto=thin -gdwarf-aranges -g -O3 test.c
    $ eu-readelf -waranges a.out  | fgrep -c -e foo -e bar
    0

    $ clang -gdwarf-aranges -g -O3 test.c
    $ eu-readelf -waranges a.out  | fgrep -c -e foo -e bar
    2

Fix this by passing explicitly --plugin-opt=-generate-arange-section.

Suggested-by: OCHyams <orlando.hyams at sony.com>

Reviewed By: dblaikie, MaskRay

Differential Revision: https://reviews.llvm.org/D133092




More information about the All-commits mailing list