diff --git a/gold/layout.cc b/gold/layout.cc index 5f25faea55..22f5ffbe53 100644 --- a/gold/layout.cc +++ b/gold/layout.cc @@ -1198,7 +1198,7 @@ Layout::layout(Sized_relobj_file* object, unsigned int shndx, elfcpp::Elf_Xword flags = this->get_output_section_flags(shdr.get_sh_flags()); - const char* os_name = it->second->name; + const char* os_name = it->second->name.c_str(); Stringpool::Key name_key; os_name = this->namepool_.add(os_name, true, &name_key); os = this->get_output_section(os_name, name_key, sh_type, flags, diff --git a/gold/layout.h b/gold/layout.h index 15ee924678..a5e331b942 100644 --- a/gold/layout.h +++ b/gold/layout.h @@ -541,7 +541,7 @@ class Layout { // Identifier for the segment. ELF segments don't have names. This // is used as the name of the output section mapped to the segment. - const char* name; + std::string name; // Additional segment flags. uint64_t flags; // Segment alignment.