On 20 October 2015 at 13:27, John Baldwin <j...@freebsd.org> wrote:
>
> If '-gdwarf-4' works then you can just set that in the DEBUG makeoptions as a
> test, otherwise try hacking kern.mk to disable this bit:
>
> #
> # Add -gdwarf-2 when compiling -g. The default starting in clang v3.4
> # and gcc 4.8 is to generate DWARF version 4. However, our tools don't
> # cope well with DWARF 4, so force it to genereate DWARF2, which they
> # understand. Do this unconditionally as it is harmless when not needed,
> # but critical for these newer versions.
> #
> .if ${CFLAGS:M-g} != "" && ${CFLAGS:M-gdwarf*} == ""
> CFLAGS+=        -gdwarf-2
> .endif

Note that Clang defaults to DWARF 2 on FreeBSD, so removing the
override in kern.mk isn't sufficient.

>From contrib/llvm/tools/clang/lib/Driver/Tools.cpp:
    else if (!A->getOption().matches(options::OPT_g0) &&
             !A->getOption().matches(options::OPT_ggdb0)) {
      // Default is dwarf-2 for Darwin, OpenBSD, FreeBSD and Solaris.
      const llvm::Triple &Triple = getToolChain().getTriple();
      if (Triple.isOSDarwin() || Triple.getOS() == llvm::Triple::OpenBSD ||
          Triple.getOS() == llvm::Triple::FreeBSD ||
          Triple.getOS() == llvm::Triple::Solaris)
        CmdArgs.push_back("-gdwarf-2");
      else
        CmdArgs.push_back("-g");
    }

It may be time for us to remove this default from Clang.
_______________________________________________
freebsd-toolchain@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-toolchain
To unsubscribe, send any mail to "freebsd-toolchain-unsubscr...@freebsd.org"

Reply via email to