return false;
}
+// Sometimes we compress sections. This is typically done for
+// sections that are not part of normal program execution (such as
+// .debug_* sections), and where the readers of these sections know
+// how to deal with compressed sections. This routine doesn't say for
+// certain whether we'll compress -- it depends on commandline options
+// as well -- just whether this section is a candidate for compression.
+// (The Output_compressed_section class decides whether to compress
+// a given section, and picks the name of the compressed section.)
+
+static bool
+is_compressible_debug_section(const char* secname)
+{
+ return (is_prefix_of(".debug", secname));
+}
+
+// We may see compressed debug sections in input files. Return TRUE
+// if this is the name of a compressed debug section.
+
+bool
+is_compressed_debug_section(const char* secname)
+{
+ return (is_prefix_of(".zdebug", secname));
+}
+
// Whether to include this section in the link.
template<int size, bool big_endian>
// FIXME: Handle SHF_OS_NONCONFORMING somewhere.
+ size_t len = strlen(name);
+ char* uncompressed_name = NULL;
+
+ // Compressed debug sections should be mapped to the corresponding
+ // uncompressed section.
+ if (is_compressed_debug_section(name))
+ {
+ uncompressed_name = new char[len];
+ uncompressed_name[0] = '.';
+ gold_assert(name[0] == '.' && name[1] == 'z');
+ strncpy(&uncompressed_name[1], &name[2], len - 2);
+ uncompressed_name[len - 1] = '\0';
+ len -= 1;
+ name = uncompressed_name;
+ }
+
// Turn NAME from the name of the input section into the name of the
// output section.
-
- size_t len = strlen(name);
if (is_input_section
&& !this->script_options_->saw_sections_clause()
&& !parameters->options().relocatable())
Stringpool::Key name_key;
name = this->namepool_.add_with_length(name, len, true, &name_key);
+ if (uncompressed_name != NULL)
+ delete[] uncompressed_name;
+
// Find or make the output section. The output section is selected
// based on the section name, type, and flags.
return this->get_output_section(name, name_key, type, flags, order, is_relro);
return ret;
}
-// Sometimes we compress sections. This is typically done for
-// sections that are not part of normal program execution (such as
-// .debug_* sections), and where the readers of these sections know
-// how to deal with compressed sections. This routine doesn't say for
-// certain whether we'll compress -- it depends on commandline options
-// as well -- just whether this section is a candidate for compression.
-// (The Output_compressed_section class decides whether to compress
-// a given section, and picks the name of the compressed section.)
-
-static bool
-is_compressible_debug_section(const char* secname)
-{
- return (is_prefix_of(".debug", secname));
-}
-
-// We may see compressed debug sections in input files. Return TRUE
-// if this is the name of a compressed debug section.
-
-bool
-is_compressed_debug_section(const char* secname)
-{
- return (is_prefix_of(".zdebug", secname));
-}
-
// Make a new Output_section, and attach it to segments as
// appropriate. ORDER is the order in which this section should
// appear in the output segment. IS_RELRO is true if this is a relro
}
}
- // Compressed debug sections should be mapped to the corresponding
- // uncompressed section.
- if (is_compressed_debug_section(name))
- {
- size_t len = strlen(name);
- char* uncompressed_name = new char[len];
- uncompressed_name[0] = '.';
- gold_assert(name[0] == '.' && name[1] == 'z');
- strncpy(&uncompressed_name[1], &name[2], len - 2);
- uncompressed_name[len - 1] = '\0';
- *plen = len - 1;
- return uncompressed_name;
- }
-
return name;
}