ldc icon indicating copy to clipboard operation
ldc copied to clipboard

DMD built for FreeBSD segfaults with -flto=full

Open MoonlightSentinel opened this issue 4 years ago • 1 comments

A dmd binary built on FreeBSD with -flto=full segfaults at runtime. This issue was observed in the nightly build that recently enabled LTO (ENABLE_LTO=1 adds -flto=full for LDC). Previous builds without LTO succeeded without issues.

Relevant part of the log:

Running: gmake -j4 MODEL=64 DMD=../dmd/generated/freebsd/release/64/dmd HOST_DC=/tmp/tmp.x8xWzK/ldc/ldc2-1.28.1-freebsd-x86_64/bin/ldmd2 HOST_DMD=/tmp/tmp.x8xWzK/ldc/ldc2-1.28.1-freebsd-x86_64/bin/ldmd2 ENABLE_RELEASE=1 ENABLE_LTO=1 LATEST=master -f posix.mak

/tmp/tmp.x8xWzK/ldc/ldc2-1.28.1-freebsd-x86_64/bin/ldmd2 -of../generated/build -g build.d
../generated/build OS="freebsd" BUILD="release" MODEL="64" HOST_DMD="/tmp/tmp.x8xWzK/ldc/ldc2-1.28.1-freebsd-x86_64/bin/ldmd2" CXX="c++" AUTO_BOOTSTRAP="" DOCDIR="" STDDOC="" DOC_OUTPUT_DIR="" MAKE="gmake" VERBOSE="" ENABLE_RELEASE="1" ENABLE_DEBUG="" ENABLE_ASSERTS="" ENABLE_UNITTEST="" ENABLE_PROFILE="" ENABLE_COVERAGE="" DFLAGS="" dmd
(TX) VERSION
(TX) SYSCONFDIR
(TX) DMD_CONF
(DC) COMMON
(DC) LEXER
(DC) BACKEND
(DC) DMD
Success

Building Druntime 64-bit

Running: gmake -j4 MODEL=64 DMD=../dmd/generated/freebsd/release/64/dmd HOST_DC=/tmp/tmp.x8xWzK/ldc/ldc2-1.28.1-freebsd-x86_64/bin/ldmd2 HOST_DMD=/tmp/tmp.x8xWzK/ldc/ldc2-1.28.1-freebsd-x86_64/bin/ldmd2 ENABLE_RELEASE=1 ENABLE_LTO=1 LATEST=master -f posix.mak
../dmd/generated/freebsd/release/64/dmd -conf= -c -o- -Isrc -Iimport -Hfimport/core/sync/barrier.di src/core/sync/barrier.d
../dmd/generated/freebsd/release/64/dmd -conf= -c -o- -Isrc -Iimport -Hfimport/core/sync/condition.di src/core/sync/condition.d
../dmd/generated/freebsd/release/64/dmd -conf= -c -o- -Isrc -Iimport -Hfimport/core/sync/config.di src/core/sync/config.d
../dmd/generated/freebsd/release/64/dmd -conf= -c -o- -Isrc -Iimport -Hfimport/core/sync/exception.di src/core/sync/exception.d
gmake: *** [posix.mak:327: import/core/sync/barrier.di] Segmentation fault (core dumped)
gmake: *** Waiting for unfinished jobs....
gmake: *** [posix.mak:327: import/core/sync/condition.di] Segmentation fault (core dumped)
gmake: *** [posix.mak:327: import/core/sync/config.di] Segmentation fault (core dumped)
gmake: *** [posix.mak:327: import/core/sync/exception.di] Segmentation fault (core dumped)

Build information:

  • LDC 1.28.1
  • FreeBSD 12.2 - 64 bit

Unfortunately I don't have a FreeBSD-box to reduce this issue.

MoonlightSentinel avatar Jan 19 '22 11:01 MoonlightSentinel

This is probably https://github.com/ldc-developers/ldc/issues/3786 (fixed after 1.28.1), as FreeBSD uses lld by default AFAIK. If gold is available, -linker=gold might make it work.

kinke avatar Jan 19 '22 12:01 kinke