| 198 | } |
| 199 | |
| 200 | void PatchGnuUnique(const TString& path, IOutputStream& verboseOut) { |
| 201 | TElf elf(path); |
| 202 | |
| 203 | for (Elf64_Shdr* it = elf.GetSectionBegin(), *end = elf.GetSectionEnd(); it != end; ++it) { |
| 204 | if (it->sh_type == SHT_SYMTAB) { |
| 205 | |
| 206 | TSection section{&elf, it}; |
| 207 | verboseOut << "Found symbol section [" << section.GetName() << ']' << Endl; |
| 208 | |
| 209 | for (size_t i = 0, count = section.GetEntryCount(); i < count; ++i) { |
| 210 | Elf64_Sym* symbol = section.GetEntry<Elf64_Sym>(i); |
| 211 | auto& info = symbol->st_info; |
| 212 | |
| 213 | if (ELF64_ST_BIND(info) == STB_GNU_UNIQUE) { |
| 214 | verboseOut << "Found GNU unique symbol #" << i << Endl; |
| 215 | info = ELF64_ST_INFO(STB_GLOBAL, ELF64_ST_TYPE(info)); |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | int main(int argc, char* argv[]) { |
| 223 | bool verbose = false; |
no test coverage detected