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.
This commit is contained in:
parent
c924eb67e1
commit
43b64debe3
|
@ -1,3 +1,9 @@
|
||||||
|
2014-11-25 Cary Coutant <ccoutant@google.com>
|
||||||
|
|
||||||
|
* 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.
|
||||||
|
|
||||||
2014-11-25 Cary Coutant <ccoutant@google.com>
|
2014-11-25 Cary Coutant <ccoutant@google.com>
|
||||||
|
|
||||||
PR gold/17639
|
PR gold/17639
|
||||||
|
|
|
@ -235,12 +235,12 @@ Binary_to_elf::sized_convert(const Task* task)
|
||||||
pout += aligned_filesize - filesize;
|
pout += aligned_filesize - filesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->write_symbol<size, big_endian>("", &strtab, 0, 0, &pout);
|
this->write_symbol<size, big_endian>("", &strtab, 0, 0, 0, &pout);
|
||||||
this->write_symbol<size, big_endian>(start_symbol_name, &strtab, 0, 1,
|
this->write_symbol<size, big_endian>(start_symbol_name, &strtab, 0, filesize,
|
||||||
&pout);
|
1, &pout);
|
||||||
this->write_symbol<size, big_endian>(end_symbol_name, &strtab, filesize, 1,
|
this->write_symbol<size, big_endian>(end_symbol_name, &strtab, filesize, 0,
|
||||||
&pout);
|
1, &pout);
|
||||||
this->write_symbol<size, big_endian>(size_symbol_name, &strtab, filesize,
|
this->write_symbol<size, big_endian>(size_symbol_name, &strtab, filesize, 0,
|
||||||
elfcpp::SHN_ABS, &pout);
|
elfcpp::SHN_ABS, &pout);
|
||||||
|
|
||||||
strtab.write_to_buffer(pout, strtab.get_strtab_size());
|
strtab.write_to_buffer(pout, strtab.get_strtab_size());
|
||||||
|
@ -343,6 +343,7 @@ Binary_to_elf::write_symbol(
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const Stringpool* strtab,
|
const Stringpool* strtab,
|
||||||
section_size_type value,
|
section_size_type value,
|
||||||
|
typename elfcpp::Elf_types<32>::Elf_WXword st_size,
|
||||||
unsigned int shndx,
|
unsigned int shndx,
|
||||||
unsigned char** ppout)
|
unsigned char** ppout)
|
||||||
{
|
{
|
||||||
|
@ -351,7 +352,7 @@ Binary_to_elf::write_symbol(
|
||||||
elfcpp::Sym_write<size, big_endian> osym(pout);
|
elfcpp::Sym_write<size, big_endian> osym(pout);
|
||||||
osym.put_st_name(name.empty() ? 0 : strtab->get_offset(name.c_str()));
|
osym.put_st_name(name.empty() ? 0 : strtab->get_offset(name.c_str()));
|
||||||
osym.put_st_value(value);
|
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,
|
osym.put_st_info(name.empty() ? elfcpp::STB_LOCAL : elfcpp::STB_GLOBAL,
|
||||||
elfcpp::STT_NOTYPE);
|
elfcpp::STT_NOTYPE);
|
||||||
osym.put_st_other(elfcpp::STV_DEFAULT, 0);
|
osym.put_st_other(elfcpp::STV_DEFAULT, 0);
|
||||||
|
|
|
@ -95,7 +95,8 @@ class Binary_to_elf
|
||||||
template<int size, bool big_endian>
|
template<int size, bool big_endian>
|
||||||
void
|
void
|
||||||
write_symbol(const std::string&, const Stringpool_template<char>*,
|
write_symbol(const std::string&, const Stringpool_template<char>*,
|
||||||
section_size_type, unsigned int, unsigned char**);
|
section_size_type, typename elfcpp::Elf_types<32>::Elf_WXword,
|
||||||
|
unsigned int, unsigned char**);
|
||||||
|
|
||||||
// The ELF machine code of the file to create.
|
// The ELF machine code of the file to create.
|
||||||
elfcpp::EM elf_machine_;
|
elfcpp::EM elf_machine_;
|
||||||
|
|
Loading…
Reference in New Issue