This is an archive of the discontinued LLVM Phabricator instance.

Fix lld on GCC 5.1 after the C++14 move
ClosedPublic

Authored by jfb on Aug 15 2019, 10:24 AM.

Details

Summary

libstdc++ in GCC 5.1 has some bugs. The move to C++14 in D66195 triggered one
such bug caused by the new constexpr support in C++14, and the implementation
doing SFINAE wrong with the comparator to std::stable_sort.

Here's a small repro: https://godbolt.org/z/2QC3-n

The fix is to inline the lambdas directly into the llvm::stable_sort call
instead of erasing them through a std::function. The code is more readable as
well.

Diff Detail

Repository
rL LLVM

Event Timeline

jfb created this revision.Aug 15 2019, 10:24 AM
thakis accepted this revision.Aug 15 2019, 10:43 AM

Thanks!

lld/ELF/LinkerScript.cpp
337 ↗(On Diff #215431)

nit: remove, to make Default fall through to None. (No fall through annotation needed for completely empty cases)

This revision is now accepted and ready to land.Aug 15 2019, 10:43 AM
jfb updated this revision to Diff 215437.Aug 15 2019, 10:45 AM
  • Fall through as suggested.
jfb marked an inline comment as done.Aug 15 2019, 10:45 AM
This revision was automatically updated to reflect the committed changes.