Skip to content
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

opt should not be stripped during installation #13516

Closed
llvmbot opened this issue Jun 19, 2012 · 8 comments
Closed

opt should not be stripped during installation #13516

llvmbot opened this issue Jun 19, 2012 · 8 comments
Labels
bugzilla Issues migrated from bugzilla obsolete Issues with old (unsupported) versions of LLVM tools:opt

Comments

@llvmbot
Copy link
Collaborator

llvmbot commented Jun 19, 2012

Bugzilla Link 13144
Version trunk
OS All
Reporter LLVM Bugzilla Contributor

Extended Description

'opt' is stripped in Release builds, but this causes removals of some symbols which can be needed by loaded plugins. In a dynamic build of LLVM this is not a problem but in static builds this might prevent plugin usage. Plugins themselves cannot be statically linked with LLVM libs as this will cause duplicate symbols when loading them into 'opt'.

Solution is not to strip 'opt' in any case (KEEP_SYMBOLS := 1).

I sent a mail to llvmdev about this: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-June/050689.html

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 29, 2012

I see that this problem persists in ToT. Perhaps it bites only those of us who try to dynamically load our own pass libraries under Darwin?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 29, 2012

I never had any problems on linux.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 29, 2012

I never had any problems on linux.

Me either, but I'm writing a cross-platform set of passes that I don't want to try to fold into mainline (they're too specialized to a specific domain). Optimization passes as shared libraries are an awesome idea.

I guess the objection would be that KEEP_SYMBOLS would make the opt executable too big?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 29, 2012

Well, I'm kind of worried that this is a bandaid, and that the fundamental
problem hasn't been understood.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 30, 2012

I do not think this problem is linux-specific, but AFAIR linux builds are shared by default, thus the problem does not show there. For some reason, Darwin builds are static (but can be --enable-shared).

The fundamental problem as I see it is that dynamically loading modules into a statically-build opt (or any other tool for the matter) might not work. Example:

libLLVMxxx.a defines global symbol G.
opt links against libLLVMxxx.a links to use G.
opt is stripped (G is no longer visible in opt).

test_module.so uses G, so it links against libLLVMxxx.a. Now, when opt loads test_module.so, module's "G" is not the same as opt "G", which it should be as it is a global symbol. It will not give duplicated symbols error because opt symbols were stripped, but it might not work properly.

My proposal is not to strip opt, therefore the modules do not need to be linked because "opt" will have all the required symbols. This effectively bundles a shared library containing all LLVM symbols into opt. I do not think there is another way of allowing module loading reliably.

Another option is entirely disabling module loading in opt for static builds.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 30, 2012

On linux opt is also statically linked with the LLVM libraries by default.

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 30, 2012

On linux opt is also statically linked with the LLVM libraries by default.

Ok, I remembered otherwise, haven't build LLVM on linux for a while.

Strange that the problem does not show, then. Are you linking your modules statically against LLVM libraries?

@llvmbot
Copy link
Collaborator Author

llvmbot commented Aug 30, 2012

I have seen this happening with different symbols, but the actual symbol giving problems when I reported the bug can be seen here:

http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-June/050689.html

in point 1).

so, '__ZN4llvm10ModulePass17assignPassManagerERNS_7PMStackENS_15PassManagerTypeE'.

Probably it was not only this one, I would need to replicate the scenario to be sure (now I got a LLVM built with KEEP_SYMBOLS in opt and with gcc instead of clang to avoid the second problem I stated in the mail).

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 3, 2021
@arsenm arsenm closed this as not planned Won't fix, can't repro, duplicate, stale Aug 4, 2023
@EugeneZelenko EugeneZelenko added the obsolete Issues with old (unsupported) versions of LLVM label Aug 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla obsolete Issues with old (unsupported) versions of LLVM tools:opt
Projects
None yet
Development

No branches or pull requests

3 participants