[PATCH] D114186: [lld][CMake] Add LLD_DEFAULT_NOSTART_STOP_GC

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 1 12:29:00 PST 2021


MaskRay added a comment.

I had a long chat with @emaste in IRC today.

The evidence I showed includes (the paragraph I am writing below is more detailed):

- https://codesearch.debian.net/search?q=extern.*__stop_.*%5C%5B%5C%5D&literal=0 Only ~20 packages use `__stop_`. Some are duplicates. Most don't use -Wl,--gc-sections in their build system. Some definitely work well now (glibc,binutils,ell,iwd). Many are quite old and existed before GNU ld's 2015-10 switch. They worked with traditional GNU ld and should work with current ld.lld.
- Some distros have tested for quite some time now (ChromeOS, some rolling release toolchain users (speculating: some companies, some projects with tighter connection with llvm-project)). Gentoo Linux got the 13.0.0 package since 2021-10-01. Gentoo has both Clang -fuse-ld=lld and GCC -fuse-ld=lld users.

@jrtc27 and @emaste are both on board that the traditional GNU ld behavior / current 13.0.0 behavior is the future. The transition plan was important and that was in the cracks (sorry!).

We cannot change 13.0.0 now. For origin/main, you may decide to change it, but hope after some justification (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=260159).
(if any, maybe a matter of adding `-z nostart-stop-gc`).

I worry that switching the origin/main default back to `-z nostart-stop-gc` can stimulate new regressions, e.g.

- ldc (compiler), regression in 2016
- Linux kernel has a config `CONFIG_LD_DEAD_CODE_DATA_ELIMINATION` for `--gc-sections`. It does not work for many cases yet, but I hope contributors don't cause new regressions. There are quite few users of origin/main ld.lld.

To add more helpers, we have D114830 <https://reviews.llvm.org/D114830> (which will be nice in 13.0.1). With this users will clearly know what to do.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D114186



More information about the llvm-commits mailing list