Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(223)

Side by Side Diff: src/IceELFObjectWriter.cpp

Issue 1017373002: Subzero: Assemble calls to constant addresses. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: move test back Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/IceClFlags.h ('k') | src/IceELFSection.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // This file defines the writer for ELF relocatable object files. 10 // This file defines the writer for ELF relocatable object files.
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 77
78 const IceString SymTabName(".symtab"); 78 const IceString SymTabName(".symtab");
79 bool IsELF64 = isELF64(Ctx.getTargetArch()); 79 bool IsELF64 = isELF64(Ctx.getTargetArch());
80 const Elf64_Xword SymTabAlign = IsELF64 ? 8 : 4; 80 const Elf64_Xword SymTabAlign = IsELF64 ? 8 : 4;
81 const Elf64_Xword SymTabEntSize = 81 const Elf64_Xword SymTabEntSize =
82 IsELF64 ? sizeof(Elf64_Sym) : sizeof(Elf32_Sym); 82 IsELF64 ? sizeof(Elf64_Sym) : sizeof(Elf32_Sym);
83 static_assert(sizeof(Elf64_Sym) == 24 && sizeof(Elf32_Sym) == 16, 83 static_assert(sizeof(Elf64_Sym) == 24 && sizeof(Elf32_Sym) == 16,
84 "Elf_Sym sizes cannot be derived from sizeof"); 84 "Elf_Sym sizes cannot be derived from sizeof");
85 SymTab = createSection<ELFSymbolTableSection>(SymTabName, SHT_SYMTAB, 0, 85 SymTab = createSection<ELFSymbolTableSection>(SymTabName, SHT_SYMTAB, 0,
86 SymTabAlign, SymTabEntSize); 86 SymTabAlign, SymTabEntSize);
87 // The first entry in the symbol table should be a NULL entry. 87 SymTab->createNullSymbol(NullSection);
88 const IceString NullSymName("");
89 SymTab->createDefinedSym(NullSymName, STT_NOTYPE, STB_LOCAL, NullSection, 0,
90 0);
91 88
92 const IceString StrTabName(".strtab"); 89 const IceString StrTabName(".strtab");
93 StrTab = 90 StrTab =
94 createSection<ELFStringTableSection>(StrTabName, SHT_STRTAB, 0, 1, 0); 91 createSection<ELFStringTableSection>(StrTabName, SHT_STRTAB, 0, 1, 0);
95 } 92 }
96 93
97 template <typename T> 94 template <typename T>
98 T *ELFObjectWriter::createSection(const IceString &Name, Elf64_Word ShType, 95 T *ELFObjectWriter::createSection(const IceString &Name, Elf64_Word ShType,
99 Elf64_Xword ShFlags, Elf64_Xword ShAddralign, 96 Elf64_Xword ShFlags, Elf64_Xword ShAddralign,
100 Elf64_Xword ShEntsize) { 97 Elf64_Xword ShEntsize) {
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 if (IsELF64) { 614 if (IsELF64) {
618 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(), 615 writeELFHeaderInternal<true>(ShOffset, ShStrTab->getNumber(),
619 AllSections.size()); 616 AllSections.size());
620 } else { 617 } else {
621 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(), 618 writeELFHeaderInternal<false>(ShOffset, ShStrTab->getNumber(),
622 AllSections.size()); 619 AllSections.size());
623 } 620 }
624 } 621 }
625 622
626 } // end of namespace Ice 623 } // end of namespace Ice
OLDNEW
« no previous file with comments | « src/IceClFlags.h ('k') | src/IceELFSection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698