Revert "Revert "Add option to generate compressed backtrace info.""

This reverts commit 8546cc9aeb05e866e1fb6a9e4130d53ea330baa8.

Change-Id: I676fdf9af27fa3b16fa8921778ff8832ab8c437d
diff --git a/compiler/elf_builder.h b/compiler/elf_builder.h
index 46484b1..3d24d19 100644
--- a/compiler/elf_builder.h
+++ b/compiler/elf_builder.h
@@ -165,10 +165,15 @@
       }
     }
 
-    // Set desired allocation size for .bss section.
-    void SetSize(Elf_Word size) {
-      CHECK_EQ(header_.sh_type, (Elf_Word)SHT_NOBITS);
+    // Write this section as "NOBITS" section. (used for the .bss section)
+    // This means that the ELF file does not contain the initial data for this section
+    // and it will be zero-initialized when the ELF file is loaded in the running program.
+    void WriteNoBitsSection(Elf_Word size) {
+      DCHECK_NE(header_.sh_flags & SHF_ALLOC, 0u);
+      Start();
+      header_.sh_type = SHT_NOBITS;
       header_.sh_size = size;
+      End();
     }
 
     // This function always succeeds to simplify code.
@@ -346,6 +351,12 @@
     other_sections_.push_back(std::move(s));
   }
 
+  // Set where the next section will be allocated in the virtual address space.
+  void SetVirtualAddress(Elf_Addr address) {
+    DCHECK_GE(address, virtual_address_);
+    virtual_address_ = address;
+  }
+
   void Start() {
     // Reserve space for ELF header and program headers.
     // We do not know the number of headers until later, so