summaryrefslogtreecommitdiffstats
path: root/binutils-2.25/gold/dwp.cc
diff options
context:
space:
mode:
authorHan Shen <shenhan@google.com>2015-11-17 16:29:47 -0800
committerHan Shen <shenhan@google.com>2015-11-19 17:29:00 -0800
commit8bfb6b2bf11cfbc445239158ec28d0988f8fa947 (patch)
tree64baf9be2b2d76eb0d3d83ec6acf3d5ddd452b64 /binutils-2.25/gold/dwp.cc
parent932d71b859239e834651fdee549dc661cda82fe8 (diff)
downloadtoolchain_binutils-8bfb6b2bf11cfbc445239158ec28d0988f8fa947.tar.gz
toolchain_binutils-8bfb6b2bf11cfbc445239158ec28d0988f8fa947.tar.bz2
toolchain_binutils-8bfb6b2bf11cfbc445239158ec28d0988f8fa947.zip
Create an unified binutils source tree for both Android and ChromiumOS.
About source code - The base version of this binutils is newer than that of aosp/binutils-2.25, it is based on the binutils that is used to build google products and ChromiumOS. And it contains *all* local Android patches as well as all patches that are cherry-picked from upstream for aosp/binutils-2.25 tree (up to Nov. 5 - 932d71b85). You may find the detailed development history for this binutils tree here - https://chromium.googlesource.com/chromiumos/third_party/binutils/+log/unification (This CL is a combination of all the CLs in it. After this CL is submitted the tree will be identical to https://chromium.googlesource.com/chromiumos/third_party/binutils/+log/unification at 2865a3615d80bd5f82d14d7e0484e84dc052596a) About testing - We tested this binutils for both ChromiumOS and Android. For android, we tested building N4, N5X, N6, N7, N9 using new binutils, we also did a full-build of toolchain (by build.py) and built a N5X image; for ChromiumOS - it passed ChromiumOS toolchain release tests on all 4 platforms (x86, x86_64, arm32 and arm64). Change-Id: I2bb2cf579f9458d0a8bc9612331dc7d5043e3d82
Diffstat (limited to 'binutils-2.25/gold/dwp.cc')
-rw-r--r--binutils-2.25/gold/dwp.cc74
1 files changed, 28 insertions, 46 deletions
diff --git a/binutils-2.25/gold/dwp.cc b/binutils-2.25/gold/dwp.cc
index d5e19ef0..121f37b1 100644
--- a/binutils-2.25/gold/dwp.cc
+++ b/binutils-2.25/gold/dwp.cc
@@ -1,6 +1,6 @@
// dwp.cc -- DWARF packaging utility
-// Copyright (C) 2012-2015 Free Software Foundation, Inc.
+// Copyright (C) 2012-2014 Free Software Foundation, Inc.
// Written by Cary Coutant <ccoutant@google.com>.
// This file is part of dwp, the DWARF packaging utility.
@@ -284,14 +284,6 @@ class Sized_relobj_dwo : public Sized_relobj<size, big_endian>
const unsigned char*
do_section_contents(unsigned int, section_size_type*, bool);
- // Return a view of the uncompressed contents of a section. Set *PLEN
- // to the size. Set *IS_NEW to true if the contents need to be deleted
- // by the caller.
- const unsigned char*
- do_decompressed_section_contents(unsigned int shndx,
- section_size_type* plen,
- bool* is_new);
-
// The following virtual functions are abstract in the base classes,
// but are not used here.
@@ -781,9 +773,36 @@ template <int size, bool big_endian>
void
Sized_relobj_dwo<size, big_endian>::setup()
{
+ const int shdr_size = elfcpp::Elf_sizes<size>::shdr_size;
+ const off_t shoff = this->elf_file_.shoff();
const unsigned int shnum = this->elf_file_.shnum();
+
this->set_shnum(shnum);
this->section_offsets().resize(shnum);
+
+ // Read the section headers.
+ const unsigned char* const pshdrs = this->get_view(shoff, shnum * shdr_size,
+ true, false);
+
+ // Read the section names.
+ const unsigned char* pshdrnames =
+ pshdrs + this->elf_file_.shstrndx() * shdr_size;
+ typename elfcpp::Shdr<size, big_endian> shdrnames(pshdrnames);
+ if (shdrnames.get_sh_type() != elfcpp::SHT_STRTAB)
+ this->error(_("section name section has wrong type: %u"),
+ static_cast<unsigned int>(shdrnames.get_sh_type()));
+ section_size_type section_names_size =
+ convert_to_section_size_type(shdrnames.get_sh_size());
+ const unsigned char* namesu = this->get_view(shdrnames.get_sh_offset(),
+ section_names_size, false,
+ false);
+ const char* names = reinterpret_cast<const char*>(namesu);
+
+ Compressed_section_map* compressed_sections =
+ build_compressed_section_map<size, big_endian>(
+ pshdrs, this->shnum(), names, section_names_size, this, true);
+ if (compressed_sections != NULL && !compressed_sections->empty())
+ this->set_compressed_sections(compressed_sections);
}
// Return a view of the contents of a section.
@@ -805,43 +824,6 @@ Sized_relobj_dwo<size, big_endian>::do_section_contents(
return this->get_view(loc.file_offset, *plen, true, cache);
}
-// Return a view of the uncompressed contents of a section. Set *PLEN
-// to the size. Set *IS_NEW to true if the contents need to be deleted
-// by the caller.
-
-template <int size, bool big_endian>
-const unsigned char*
-Sized_relobj_dwo<size, big_endian>::do_decompressed_section_contents(
- unsigned int shndx,
- section_size_type* plen,
- bool* is_new)
-{
- section_size_type buffer_size;
- const unsigned char* buffer = this->do_section_contents(shndx, &buffer_size,
- false);
-
- std::string sect_name = this->do_section_name(shndx);
- if (!is_prefix_of(".zdebug_", sect_name.c_str()))
- {
- *plen = buffer_size;
- *is_new = false;
- return buffer;
- }
-
- section_size_type uncompressed_size = get_uncompressed_size(buffer,
- buffer_size);
- unsigned char* uncompressed_data = new unsigned char[uncompressed_size];
- if (!decompress_input_section(buffer,
- buffer_size,
- uncompressed_data,
- uncompressed_size))
- this->error(_("could not decompress section %s"),
- this->section_name(shndx).c_str());
- *plen = uncompressed_size;
- *is_new = true;
- return uncompressed_data;
-}
-
// Class Dwo_file.
Dwo_file::~Dwo_file()