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

Unified Diff: src/IceELFObjectWriter.cpp

Issue 948943004: Handle ffunction-sections w/ filetype=obj. (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: one dash Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/elf_function_sections.ll » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/IceELFObjectWriter.cpp
diff --git a/src/IceELFObjectWriter.cpp b/src/IceELFObjectWriter.cpp
index 6fbf1dfe50bf7b013b41c36979090f706497a424..4e56d858289591877eb3cc3b5cb17cf970c6f661 100644
--- a/src/IceELFObjectWriter.cpp
+++ b/src/IceELFObjectWriter.cpp
@@ -218,9 +218,11 @@ void ELFObjectWriter::writeFunctionCode(const IceString &FuncName,
assert(!SectionNumbersAssigned);
ELFTextSection *Section = nullptr;
ELFRelocationSection *RelSection = nullptr;
- if (TextSections.empty()) {
- // TODO(jvoung): handle ffunction-sections.
+ const bool FunctionSections = Ctx.getFlags().getFunctionSections();
+ if (TextSections.empty() || FunctionSections) {
IceString SectionName = ".text";
+ if (FunctionSections)
+ SectionName += "." + FuncName;
bool IsELF64 = isELF64(Ctx.getTargetArch());
const Elf64_Xword ShFlags = SHF_ALLOC | SHF_EXECINSTR;
// TODO(jvoung): Should be bundle size. Grab it from that target?
@@ -254,9 +256,8 @@ void ELFObjectWriter::writeFunctionCode(const IceString &FuncName,
OffsetInSection, SymbolSize);
StrTab->add(FuncName);
- // Create a relocation section for the text section if needed, and copy the
- // fixup information from per-function Assembler memory to the object
- // writer's memory, for writing later.
+ // Copy the fixup information from per-function Assembler memory to the
+ // object writer's memory, for writing later.
if (!Asm->fixups().empty()) {
RelSection->addRelocations(OffsetInSection, Asm->fixups());
}
« no previous file with comments | « no previous file | tests_lit/llvm2ice_tests/elf_function_sections.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698