I am working on the MASM backend. I do not know what to do about '_write' and '_abort'. They seem to be added to a modules functions as externals even when they are not being used. They cannot just be remove just in case they are being used. What are they there for ? The only options I have are to scan the whole module for uses of them, or to provide library implementations for them. OR to work out where they are being added in the first place and remove them if they are not being used. Any help/guidance would be helpful, Aaron -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20050706/92d5458c/attachment.html>
On Wed, 6 Jul 2005, Aaron Gray wrote:> I am working on the MASM backend. > > I do not know what to do about '_write' and '_abort'. They seem to be > added to a modules functions as externals even when they are not being > used.Why is that a problem?> They cannot just be remove just in case they are being used. What are > they there for ?They are part of the exception handling support.> The only options I have are to scan the whole module for uses of them, > or to provide library implementations for them. OR to work out where > they are being added in the first place and remove them if they are not > being used.Is this actually a problem? Have you actually tried linking the program and received unresolved symbol errors? Having unused dangling labels like that can often occur for many reasons. For example, a similar thing would happen to this program for many compilers: void abort(void); int main() { return 0; } OTOH, I'll note that you're hitting this because you're walking the list of functions in the module, not building a list of external symbols like the PPC backend is doing. It specifically keeps track of external symbols (as the references to them are being emitted) and does basically what you need to do. I would take a look at it if write/abort are really causing a problem. -Chris -- http://nondot.org/sabre/ http://llvm.cs.uiuc.edu/
> Why is that a problem? > > Is this actually a problem? Have you actually tried linking the program > and received unresolved symbol errors? Having unused dangling labels like > that can often occur for many reasons. For example, a similar thing would > happen to this program for many compilers: > > > void abort(void); > int main() { return 0; } > > > OTOH, I'll note that you're hitting this because you're walking the list > of functions in the module, not building a list of external symbols like > the PPC backend is doing. It specifically keeps track of external symbols > (as the references to them are being emitted) and does basically what you > need to do. I would take a look at it if write/abort are really causing a > problem.okay, I have done a simular pre-pass that weeds out the used functions. I have had to do a named structure 'pass' in the doInitialization function simular to the CBackend to deal with MASM's type system. Aaron