[LLVMbugs] [Bug 1318] NEW: Options in loadable modules are not available
bugzilla-daemon at cs.uiuc.edu
bugzilla-daemon at cs.uiuc.edu
Mon Apr 9 12:34:10 PDT 2007
http://llvm.org/bugs/show_bug.cgi?id=1318
Summary: Options in loadable modules are not available
Product: libraries
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P2
Component: Support Libraries
AssignedTo: unassignedbugs at nondot.org
ReportedBy: rspencer at x10sys.com
This is related to bug 1317.
When a loadable module is loaded its command line options are not available
until the loaded module has been processed. This is a bit of a chicken-and-egg
problem:
1. Option values aren't available until after ParseCommandLineOptions
2. A -load option doesn't get processed until after ParseCommandLineOptions
3. Options in the loaded module can't been seen by ParseCommandLineOptions
4. Unrecognized option errors are generated by ParseCommandLineOptions because
the module hasn't been loaded yet.
Consequently, you get errors about the names of optimization passes. I'm not
sure how this ever worked or if its a result of the recent changes to CommandLine.
There are several things we could do to rectify this:
1. Make a formal API for "foreign passes". That is, when we dlopen the shared
object we look for a function of a particular name, add its address to a
table of foreign passes, invoke that function to initialize, etc. This
API could do many other things (like build a PassManager full of passes).
2. Incorporate the --load option into CommandLine. It would become a new type
of option that contains a list of function addresses. The functions are
obtained by dlopen/dlsym on the shared object. The function (in the
shared object) is invoked to *properly* register any command line options.
This implies that static option objects are not permitted in such objects.
3. We might want to add something to Support library that could be used (but
not linked into) the loadable module. This would be an interface to make
"LLVM compatible loadable modules" that takes care of many of the details.
I.e. it provides a cleaner client side interface for the module writer.
This lib would be linked into all tools that support --load.
------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.
More information about the llvm-bugs
mailing list