Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 505862 Details for
Bug 617154
sys-devel/llvm Vulkan causes LLVM CommandLine Error: Option 'asan-instrument-assembly' registered more than once!
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Attempted-unsuccessful patch
0001-cl-Try-to-prevent-unloading-libraries-defining-comma.patch (text/plain), 3.82 KB, created by
Michał Górny
on 2017-11-22 21:35:01 UTC
(
hide
)
Description:
Attempted-unsuccessful patch
Filename:
MIME Type:
Creator:
Michał Górny
Created:
2017-11-22 21:35:01 UTC
Size:
3.82 KB
patch
obsolete
>From cddf2038ff6a2302cd32f36e4937b7e345373b0f Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= <mgorny@gentoo.org> >Date: Wed, 22 Nov 2017 00:12:47 +0100 >Subject: [PATCH] [cl] Try to prevent unloading libraries defining command-line > options > >The LLVM command-line support library relies on defining option >instances as static variables whose constructors implicitly propagate >the options to the global option parser instance. This means that >whenever a shared library is loaded, its options are added to the option >parser. While this might be convenient, it is remarkably fragile. > >In particular, the API does not provide any way to remove the options >when the library providing them is unloaded. If that happens, the parser >is left with dangling option pointers. In the best case, the library is >loaded again and LLVM terminates due to duplicate options. In the worst, >someone tries to use the parser. > >This could happen on glibc when someone uses dlopen() to load a library, >and then dlclose(). While we could argue about this behavior, glibc >jumps through a lot of hoops to try to unload some libraries while >keeping others in memory. Currently, the library containing option >parser instance is kept while the library providing options may be >unloaded. > >In order to try to prevent those horrible things from happening, attempt >to prevent glibc from unloading any library that provides command-line >options. According to the GCC documentation, libraries are not unloaded >when symbols using STB_GNU_UNIQUE binding are used. Make sure such >a symbol is generated when cl::opt template is being used. > >While this is a hack, it is the lowest cost solution that prevents >horrible things from happening. The alternative is to either redesign >LLVM command-line option parsing library not to rely on cross-library >global state (which is currently listed as an advantage of it), or to >stop other programs from unloading the library -- which is simply >impossible to achieve long-term. >--- > include/llvm/Support/CommandLine.h | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > >diff --git a/include/llvm/Support/CommandLine.h b/include/llvm/Support/CommandLine.h >index d1901db7c68..1b78399af0f 100644 >--- a/include/llvm/Support/CommandLine.h >+++ b/include/llvm/Support/CommandLine.h >@@ -260,6 +260,18 @@ class Option { > unsigned Position = 0; // Position of last occurrence of the option > unsigned AdditionalVals = 0; // Greater than 0 for multi-valued option. > >+protected: >+ // This is a hack to emit a symbol with STB_GNU_UNIQUE binding >+ // which prevents the library from being unloaded via dlclose(). >+ // This is necessary because the option is registered with the option >+ // parser, and if the library is unloaded the parser is left with >+ // dangling reference. Since we can't reliably remove the options >+ // when unloading the library, let's at least to prevent the latter. >+ static inline char preventUnload() { >+ static unsigned char v; >+ return ++v; >+ } >+ > public: > StringRef ArgStr; // The argument string itself (ex: "help", "o") > StringRef HelpStr; // The descriptive text message for -help >@@ -1337,6 +1349,7 @@ class opt : public Option, > void done() { > addArgument(); > Parser.initialize(); >+ preventUnload(); > } > > public: >@@ -1514,6 +1527,7 @@ class list : public Option, public list_storage<DataType, StorageClass> { > void done() { > addArgument(); > Parser.initialize(); >+ preventUnload(); > } > > public: >@@ -1657,6 +1671,7 @@ class bits : public Option, public bits_storage<DataType, Storage> { > void done() { > addArgument(); > Parser.initialize(); >+ preventUnload(); > } > > public: >@@ -1717,6 +1732,7 @@ class alias : public Option { > error("cl::alias must have an cl::aliasopt(option) specified!"); > Subs = AliasFor->Subs; > addArgument(); >+ preventUnload(); > } > > public: >-- >2.15.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 617154
:
471384
|
471386
|
505594
| 505862 |
506574