| OLD | NEW |
| 1 //===-- gold-plugin.cpp - Plugin to gold for Link Time Optimization ------===// | 1 //===-- gold-plugin.cpp - Plugin to gold for Link Time Optimization ------===// |
| 2 // | 2 // |
| 3 // The LLVM Compiler Infrastructure | 3 // The LLVM Compiler Infrastructure |
| 4 // | 4 // |
| 5 // This file is distributed under the University of Illinois Open Source | 5 // This file is distributed under the University of Illinois Open Source |
| 6 // License. See LICENSE.TXT for details. | 6 // License. See LICENSE.TXT for details. |
| 7 // | 7 // |
| 8 //===----------------------------------------------------------------------===// | 8 //===----------------------------------------------------------------------===// |
| 9 // | 9 // |
| 10 // This is a gold plugin for LLVM. It provides an LLVM implementation of the | 10 // This is a gold plugin for LLVM. It provides an LLVM implementation of the |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 extra.push_back(opt); | 145 extra.push_back(opt); |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 } | 148 } |
| 149 | 149 |
| 150 static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file, | 150 static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file, |
| 151 int *claimed); | 151 int *claimed); |
| 152 static ld_plugin_status all_symbols_read_hook(void); | 152 static ld_plugin_status all_symbols_read_hook(void); |
| 153 static ld_plugin_status cleanup_hook(void); | 153 static ld_plugin_status cleanup_hook(void); |
| 154 | 154 |
| 155 extern "C" ld_plugin_status onload(ld_plugin_tv *tv); | 155 extern "C" ld_plugin_status llvm_plugin_onload(ld_plugin_tv *tv); // @LOCALMOD |
| 156 ld_plugin_status onload(ld_plugin_tv *tv) { | 156 ld_plugin_status llvm_plugin_onload(ld_plugin_tv *tv) { // @LOCALMOD |
| 157 // We're given a pointer to the first transfer vector. We read through them | 157 // We're given a pointer to the first transfer vector. We read through them |
| 158 // until we find one where tv_tag == LDPT_NULL. The REGISTER_* tagged values | 158 // until we find one where tv_tag == LDPT_NULL. The REGISTER_* tagged values |
| 159 // contain pointers to functions that we need to call to register our own | 159 // contain pointers to functions that we need to call to register our own |
| 160 // hooks. The others are addresses of functions we can use to call into gold | 160 // hooks. The others are addresses of functions we can use to call into gold |
| 161 // for services. | 161 // for services. |
| 162 | 162 |
| 163 bool registeredClaimFile = false; | 163 bool registeredClaimFile = false; |
| 164 | 164 |
| 165 for (; tv->tv_tag != LDPT_NULL; ++tv) { | 165 for (; tv->tv_tag != LDPT_NULL; ++tv) { |
| 166 switch (tv->tv_tag) { | 166 switch (tv->tv_tag) { |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 static ld_plugin_status cleanup_hook(void) { | 599 static ld_plugin_status cleanup_hook(void) { |
| 600 std::string ErrMsg; | 600 std::string ErrMsg; |
| 601 | 601 |
| 602 for (int i = 0, e = Cleanup.size(); i != e; ++i) | 602 for (int i = 0, e = Cleanup.size(); i != e; ++i) |
| 603 if (Cleanup[i].eraseFromDisk(false, &ErrMsg)) | 603 if (Cleanup[i].eraseFromDisk(false, &ErrMsg)) |
| 604 (*message)(LDPL_ERROR, "Failed to delete '%s': %s", Cleanup[i].c_str(), | 604 (*message)(LDPL_ERROR, "Failed to delete '%s': %s", Cleanup[i].c_str(), |
| 605 ErrMsg.c_str()); | 605 ErrMsg.c_str()); |
| 606 | 606 |
| 607 return LDPS_OK; | 607 return LDPS_OK; |
| 608 } | 608 } |
| OLD | NEW |