aboutsummaryrefslogtreecommitdiff
path: root/gold/binary.cc
diff options
context:
space:
mode:
authorCary Coutant <ccoutant@google.com>2014-11-25 14:33:51 -0800
committerCary Coutant <ccoutant@google.com>2014-11-25 14:33:51 -0800
commit43b64debe3577c6923ca9f16ec91451bb47f5f65 (patch)
tree0c80e597d31b882f7efe1f96cc6760553ac50187 /gold/binary.cc
parentc924eb67e143722e4098d84c1cb91123a51c988f (diff)
downloadgdb-43b64debe3577c6923ca9f16ec91451bb47f5f65.zip
gdb-43b64debe3577c6923ca9f16ec91451bb47f5f65.tar.gz
gdb-43b64debe3577c6923ca9f16ec91451bb47f5f65.tar.bz2
Add file size to ELF symbol labelling start of a binary file.
gold/ * binary.cc (Binary_to_elf::sized_convert): Add size to _start symbol. (Binary_to_elf::write_symbol): Add st_size parameter. * binary.h (Binary_to_elf::write_symbol): Add st_size parameter.
Diffstat (limited to 'gold/binary.cc')
-rw-r--r--gold/binary.cc15
1 files changed, 8 insertions, 7 deletions
diff --git a/gold/binary.cc b/gold/binary.cc
index 4dab52c..a933b2d 100644
--- a/gold/binary.cc
+++ b/gold/binary.cc
@@ -235,12 +235,12 @@ Binary_to_elf::sized_convert(const Task* task)
pout += aligned_filesize - filesize;
}
- this->write_symbol<size, big_endian>("", &strtab, 0, 0, &pout);
- this->write_symbol<size, big_endian>(start_symbol_name, &strtab, 0, 1,
- &pout);
- this->write_symbol<size, big_endian>(end_symbol_name, &strtab, filesize, 1,
- &pout);
- this->write_symbol<size, big_endian>(size_symbol_name, &strtab, filesize,
+ this->write_symbol<size, big_endian>("", &strtab, 0, 0, 0, &pout);
+ this->write_symbol<size, big_endian>(start_symbol_name, &strtab, 0, filesize,
+ 1, &pout);
+ this->write_symbol<size, big_endian>(end_symbol_name, &strtab, filesize, 0,
+ 1, &pout);
+ this->write_symbol<size, big_endian>(size_symbol_name, &strtab, filesize, 0,
elfcpp::SHN_ABS, &pout);
strtab.write_to_buffer(pout, strtab.get_strtab_size());
@@ -343,6 +343,7 @@ Binary_to_elf::write_symbol(
const std::string& name,
const Stringpool* strtab,
section_size_type value,
+ typename elfcpp::Elf_types<32>::Elf_WXword st_size,
unsigned int shndx,
unsigned char** ppout)
{
@@ -351,7 +352,7 @@ Binary_to_elf::write_symbol(
elfcpp::Sym_write<size, big_endian> osym(pout);
osym.put_st_name(name.empty() ? 0 : strtab->get_offset(name.c_str()));
osym.put_st_value(value);
- osym.put_st_size(0);
+ osym.put_st_size(st_size);
osym.put_st_info(name.empty() ? elfcpp::STB_LOCAL : elfcpp::STB_GLOBAL,
elfcpp::STT_NOTYPE);
osym.put_st_other(elfcpp::STV_DEFAULT, 0);