[PATCH] D55878: [Driver] Use --hash-style=gnu instead of both on FreeBSD

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 21 14:08:38 PST 2018


MaskRay added a comment.

In D55878#1339098 <https://reviews.llvm.org/D55878#1339098>, @emaste wrote:

> I think the arch-change (switching from a whitelist to a MIPS blacklist) is reasonable. What is the motivation for dropping `DT_HASH`, just binary size reduction?


Yes. It saves a few hundreds bytes to a few kilobytes for each EXE/DSO.

See `Linux.cpp`, some Linux distributions default to `--hash-style=gnu` too:

  if (!IsMips && !IsHexagon) {
    if (Distro.IsRedhat() || Distro.IsOpenSUSE() || Distro.IsAlpineLinux() ||
        (Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick) ||
        (IsAndroid && !Triple.isAndroidVersionLT(23)))
      ExtraOpts.push_back("--hash-style=gnu");

This section is only consumed by dynamic loader. It is unfortunate that OpenBSD only ported this a month ago and illumos does not support it at all. The GNU section is superior to the SYSV counterpart, even in term of section sizes (`.hash` does not skip local symbols).


Repository:
  rC Clang

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D55878/new/

https://reviews.llvm.org/D55878





More information about the cfe-commits mailing list