This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Plugin interfaces to do Pettis Hansen style code layout in the gold linker.

Sriraman Tallam <> writes:

> Made the changes and attached the new patch. Please also see function
> get_view in I made the following change to correct the
> detection of whether get_view if called from the claim_file_hook.
> -  if (this->objects_.size() == handle)
> +  if (this->in_claim_file_handler_)
>      {
>        // We are being called from the claim_file hook.

> +  const std::string section_name = obj->section_name(section.shndx);
> +  const char* section_name_c_ptr = section_name.c_str();
> +  *section_name_ptr
> +    = static_cast<char*>(malloc(strlen(section_name_c_ptr) + 1));
> +  strcpy(*section_name_ptr, section_name_c_ptr);
> +  return LDPS_OK;

Change to something like
  const std::string section_name = obj->section_name(section.shndx);
  *section_name_ptr = static_cast<char*>(malloc(section_name.length() + 1));
  memcpy(*section_name_ptr, section_name.c_str(),
         section_name.length() + 1);
  return LDPS_OK;

This is OK with that change.

Thanks, and thanks for your patience with this.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]