| OLD | NEW |
| 1 //===- subzero/src/IceELFObjectWriter.cpp - ELF object file writer --------===// | 1 //===- subzero/src/IceELFObjectWriter.cpp - ELF object file writer --------===// |
| 2 // | 2 // |
| 3 // The Subzero Code Generator | 3 // The Subzero Code Generator |
| 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 /// \file | 10 /// \file |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 if (IsInternal && !Ctx.getFlags().getDisableInternal()) { | 249 if (IsInternal && !Ctx.getFlags().getDisableInternal()) { |
| 250 SymbolType = STT_NOTYPE; | 250 SymbolType = STT_NOTYPE; |
| 251 SymbolBinding = STB_LOCAL; | 251 SymbolBinding = STB_LOCAL; |
| 252 } else { | 252 } else { |
| 253 SymbolType = STT_FUNC; | 253 SymbolType = STT_FUNC; |
| 254 SymbolBinding = STB_GLOBAL; | 254 SymbolBinding = STB_GLOBAL; |
| 255 } | 255 } |
| 256 SymTab->createDefinedSym(FuncName, SymbolType, SymbolBinding, Section, | 256 SymTab->createDefinedSym(FuncName, SymbolType, SymbolBinding, Section, |
| 257 OffsetInSection, SymbolSize); | 257 OffsetInSection, SymbolSize); |
| 258 StrTab->add(FuncName); | 258 StrTab->add(FuncName); |
| 259 for (const auto &InternalReloc : Asm->getInternalRelocations()) { | |
| 260 const IceString &RelocName = InternalReloc.first; | |
| 261 constexpr uint8_t RelocSymbolType = STT_NOTYPE; | |
| 262 constexpr uint8_t RelocSymbolBinding = STB_LOCAL; | |
| 263 const SizeT RelocOffsetInSection = OffsetInSection + InternalReloc.second; | |
| 264 SymTab->createDefinedSym(RelocName, RelocSymbolType, RelocSymbolBinding, | |
| 265 Section, RelocOffsetInSection, SymbolSize); | |
| 266 StrTab->add(RelocName); | |
| 267 } | |
| 268 | 259 |
| 269 // Copy the fixup information from per-function Assembler memory to the | 260 // Copy the fixup information from per-function Assembler memory to the |
| 270 // object writer's memory, for writing later. | 261 // object writer's memory, for writing later. |
| 271 if (!Asm->fixups().empty()) { | 262 if (!Asm->fixups().empty()) { |
| 272 RelSection->addRelocations(OffsetInSection, Asm->fixups()); | 263 RelSection->addRelocations(OffsetInSection, Asm->fixups()); |
| 273 } | 264 } |
| 274 } | 265 } |
| 275 | 266 |
| 276 namespace { | 267 namespace { |
| 277 | 268 |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 if (ELF64) { | 680 if (ELF64) { |
| 690 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), | 681 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), |
| 691 AllSections.size()); | 682 AllSections.size()); |
| 692 } else { | 683 } else { |
| 693 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), | 684 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), |
| 694 AllSections.size()); | 685 AllSections.size()); |
| 695 } | 686 } |
| 696 } | 687 } |
| 697 | 688 |
| 698 } // end of namespace Ice | 689 } // end of namespace Ice |
| OLD | NEW |