Skip to content

[LLVM] Manually prefix ManagedStatic static vars #38488

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from

Conversation

vchuravy
Copy link
Member

@vchuravy vchuravy commented Nov 18, 2020

using Libdl
dlopen("/husr/lib/libLLVM-11.so")

Currently crashes with:

julia> dlopen("/usr/lib/libLLVM-11.so")
julia: /home/vchuravy/src/julia/deps/srccache/llvm-11.0.0/include/llvm/Support/CommandLine.h:851: void llvm:cl:parser<DataType>::addLiteralOption(llvm::StringRef, const DT&, llvm::StringRef) [with DT = llvm::FunctionPass* (*)(); DataType = llvm::FunctionPass* (*)()]: Assertion `findOption(Name) == Values.size() && "Option already exists!"' failed.

signal (6): Aborted
in expression starting at REPL[2]:1
gsignal at /usr/lib/libc.so.6 (unknown line)
abort at /usr/lib/libc.so.6 (unknown line)
__assert_fail_base.cold at /usr/lib/libc.so.6 (unknown line)
__assert_fail at /usr/lib/libc.so.6 (unknown line)
addLiteralOption<llvm::FunctionPass* (*)()> at /home/vchuravy/src/julia/deps/srccache/llvm-11.0.0/include/llvm/Support/CommandLine.h:851
NotifyAdd at /home/vchuravy/src/julia/deps/srccache/llvm-11.0.0/include/llvm/CodeGen/MachinePassRegistry.h:162
unknown function (ip: 0x7f94eabfb608)
call_init.part.0 at /lib64/ld-linux-x86-64.so.2 (unknown line)
_dl_init at /lib64/ld-linux-x86-64.so.2 (unknown line)
_dl_catch_exception at /usr/lib/libc.so.6 (unknown line)
dl_open_worker at /lib64/ld-linux-x86-64.so.2 (unknown line)
_dl_catch_exception at /usr/lib/libc.so.6 (unknown line)
_dl_open at /lib64/ld-linux-x86-64.so.2 (unknown line)
unknown function (ip: 0x7f953494f34b)
_dl_catch_exception at /usr/lib/libc.so.6 (unknown line)
_dl_catch_error at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 0x7f953494fb88)
dlopen at /usr/lib/libdl.so.2 (unknown line)

I have hypothesized that this boils down to static variables being
merged..., they are not exported so they should stay separate, but
somehow we still run into this wonderful issue.

cc: @staticfloat @maleadt

```
using Libdl
dlopen("/husr/lib/libLLVM-11.so")
```

Currently crashes with:

```
julia> dlopen("/usr/lib/libLLVM-11.so")
julia: /home/vchuravy/src/julia/deps/srccache/llvm-11.0.0/include/llvm/Support/CommandLine.h:851: void llvm::cl::parser<DataType>::addLiteralOption(llvm::StringRef, const DT&, llvm::StringRef) [with DT = llvm::FunctionPass* (*)(); DataType = llvm::FunctionPass* (*)()]: Assertion `findOption(Name) == Values.size() && "Option already exists!"' failed.

signal (6): Aborted
in expression starting at REPL[2]:1
gsignal at /usr/lib/libc.so.6 (unknown line)
abort at /usr/lib/libc.so.6 (unknown line)
__assert_fail_base.cold at /usr/lib/libc.so.6 (unknown line)
__assert_fail at /usr/lib/libc.so.6 (unknown line)
addLiteralOption<llvm::FunctionPass* (*)()> at /home/vchuravy/src/julia/deps/srccache/llvm-11.0.0/include/llvm/Support/CommandLine.h:851
NotifyAdd at /home/vchuravy/src/julia/deps/srccache/llvm-11.0.0/include/llvm/CodeGen/MachinePassRegistry.h:162
unknown function (ip: 0x7f94eabfb608)
call_init.part.0 at /lib64/ld-linux-x86-64.so.2 (unknown line)
_dl_init at /lib64/ld-linux-x86-64.so.2 (unknown line)
_dl_catch_exception at /usr/lib/libc.so.6 (unknown line)
dl_open_worker at /lib64/ld-linux-x86-64.so.2 (unknown line)
_dl_catch_exception at /usr/lib/libc.so.6 (unknown line)
_dl_open at /lib64/ld-linux-x86-64.so.2 (unknown line)
unknown function (ip: 0x7f953494f34b)
_dl_catch_exception at /usr/lib/libc.so.6 (unknown line)
_dl_catch_error at /usr/lib/libc.so.6 (unknown line)
unknown function (ip: 0x7f953494fb88)
dlopen at /usr/lib/libdl.so.2 (unknown line)
```

I have hypothesized that this boils down to static variables being
merged..., they are not exported so they should stay separate, but
somehow we still run into this wonderful issue.
@vchuravy
Copy link
Member Author

Opened an upstream bug report to see if this is the right approach. https://bugs.llvm.org/show_bug.cgi?id=48221

@vtjnash
Copy link
Member

vtjnash commented Apr 3, 2021

This was superseded by #39390

@vtjnash vtjnash closed this Apr 3, 2021
@vtjnash vtjnash deleted the vc/prefix_static branch April 3, 2021 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants