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

Azat Khuzhin via All-commits all-commits at lists.llvm.org
Tue Sep 13 15:34:18 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 6bf6730ac55e064edf46915ebba02e9c716f48e8
      https://github.com/llvm/llvm-project/commit/6bf6730ac55e064edf46915ebba02e9c716f48e8
  Author: Azat Khuzhin <a3at.mail at gmail.com>
  Date:   2022-09-13 (Tue, 13 Sep 2022)

  Changed paths:
    M clang/lib/Driver/ToolChains/CommonArgs.cpp
    M clang/test/Driver/debug-options.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 -mllvm -generate-arange-section.

P.S. although this looks like a hack, since none of -mllvm was passed to
the lld before.

Signed-off-by: Azat Khuzhin <a.khuzhin at semrush.com>
Suggested-by: OCHyams <orlando.hyams at sony.com>

Reviewed By: dblaikie

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




More information about the All-commits mailing list