Skip to content

Please backport r319105 to 5.0.1: [cmake] Pass -Wl,-z,nodelete on Linux to prevent unloading #34794

@llvmbot

Description

@llvmbot
Bugzilla Link 35446
Resolution WONTFIX
Resolved on Aug 28, 2019 07:50
Version 5.0
OS Linux
Blocks #33840
Reporter LLVM Bugzilla Contributor
CC @llvm-beanz,@zmodem,@tstellar

Extended Description

This has no effect on most of LLVM installs (static & dylib) but it's very important for BUILD_SHARED_LIBS=ON installs as it unbreaks mesa plugins.

commit 937b23b
Author: Michal Gorny mgorny@gentoo.org
Date: Mon Nov 27 23:23:09 2017

[cmake] Pass -Wl,-z,nodelete on Linux to prevent unloading

Prevent unloading shared libraries on Linux when dlclose() is called.
This is necessary since command-line option parsing API relies on
registering the global option instances in the option parser instance
which can be loaded in a different shared library.

Given that we can't reliably remove those options when a library is
unloaded, the parser ends up containing dangling references. Since glibc
has relatively complex library unloading rules, some of the LLVM
libraries can be unloaded while others (including the Support library)
stay loaded causing quite a mayhem. To reliably prevent that, just
forbid unloading all libraries -- it's a very bad idea anyway.

While the issue arguably happens only with BUILD_SHARED_LIBS, it may
affect any library reusing llvm::cl interface.

Based on patch provided Ross Hayward on https://bugs.gentoo.org/617154.
Previously hit by Fedora back in Feb 2016:
https://lists.freedesktop.org/archives/mesa-dev/2016-February/107242.html

Differential Revision: https://reviews.llvm.org/D40459

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319105 91177308-0d34-0410-b5e6-96231b3b80d8

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugzillaIssues migrated from bugzillawontfixIssue is real, but we can't or won't fix it. Not invalid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions