[PATCH] D31011: recommend using llvm-ar when finding undefined references and empty archives

Bob Haarman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 15 16:47:23 PDT 2017


inglorion added a comment.

@ruiu: Yes, that would be a lot simpler. Let me explain why I did it the way I did it, and then I'll be happy to simplify it if you still feel that's better.

I thought about emitting the message from Relocations.cpp, but then I thought about ErrorLimit. If I emit the note about empty archives after the undefined symbols, it is quite likely that it would not be emitted because the error limit is reached before getting to that point. If I emit the note first, it's easily missed because there may be a whole bunch of undefined reference errors after it. Thinking about that some, I thought it would be most useful if the note is emitted just before lld exits - and that this is actually something that may be more generically useful. That's why I added support for this to Errors. Using this new mechanism, the note is not affected by ErrorLimit and is emitted last, where it should be most effective.

I also thought about reporting the names of the archives in which we found no or empty indices, but my guess is that there isn't a lot of value to that; the most important thing is that this situation may be affecting your build, and switching ar implementations will fix the problem if that's the case. Having the list of file names is more text on the screen, and more memory usage to carry them around, and I didn't feel the benefits outweigh the cost, so I went with a simple boolean.


https://reviews.llvm.org/D31011





More information about the llvm-commits mailing list