This is the required plumbing needed to run the LTO passes.
Now the global constructor is (correctly) stripped away from the produced shared library.
Details
Diff Detail
- Repository
- rL LLVM
Event Timeline
ELF/SymbolTable.cpp | ||
---|---|---|
114 ↗ | (On Diff #50900) | instead of bool Optimized do const char *Suffix or StringRef Suffix or something. |
143 ↗ | (On Diff #50900) | Can you mention the relation to the code in gold-plugin.cpp? Something like "For now, we follow what gold-plugin.cpp does" maybe? |
test/ELF/lto/ctors.ll | ||
15 ↗ | (On Diff #50900) | This kind of defeats the original purpose of this test. Can you put a volatile asm in @ctor (so it is kept) and also some piece of trivially dead code. We can do -save-temps and check that the optimized output does not have the trivially dead code without having to remove the original check. |
Addressed Sean's comments.
- The original test was augmented with an asm inline statement so that the global constructor doesn't get reclaimed.
- I added another test to ensure the optimizer strips the unused global constructor (similarly to what I did before in my previous patch).
This is just sanity checking, we may want to test other stuff in the future.
Rafael, Sean, you OK with this?
LGTM with a nit.
test/ELF/lto/ltopasses-basic.ll | ||
---|---|---|
14 ↗ | (On Diff #50965) | I would describe the situation more like: "@ctor doesn't do anything and so the optimizer should kill it, leaving no ctors" |
ELF/SymbolTable.cpp | ||
---|---|---|
144 ↗ | (On Diff #50965) | I think we should keep doing what gold does. What I would have a FIXME for is refactoring this to avoid code duplication. |
145 ↗ | (On Diff #50965) | You don't need this. |
146 ↗ | (On Diff #50965) | Start variables with an upper case letter. |
147 ↗ | (On Diff #50965) | This line is too long. Please run git-clang-format. |
test/ELF/lto/ltopasses-basic.ll | ||
3 ↗ | (On Diff #50965) | Please use -save-temps. That way you test it and it is a more direct check aynway. |
15 ↗ | (On Diff #50965) | I agree with silvas' wording. |