From e9301e762ab6d533f7110d6c9c1dbe8e68e875d7 Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Tue, 17 Apr 2018 13:53:38 +0100 Subject: Resync libiberty sources with master version in GCC repository. 2018-04-13 Rainer Orth PR lto/81968 * simple-object.c (handle_lto_debug_sections): Keep .comment section. 2018-03-02 David Malcolm * cp-demangle.c: Update URL for g++ V3 ABI. 2018-01-20 Eli Zaretskii * simple-object-xcoff.c (simple_object_xcoff_find_sections): Use ulong_type to avoid warning about 32-bit shift. 2018-01-11 Richard Biener Rainer Orth PR lto/81968 * simple-object-common.h (struct simple_object_functions): Change copy_lto_debug_sections callback signature. * simple-object-elf.c (SHN_HIRESERVE, SHT_SYMTAB_SHNDX, SHF_INFO_LINK): Add defines. (simple_object_elf_copy_lto_debug_sections): Instead of leaving not to be copied sections empty unnamed SHT_NULL remove them from the target section headers and adjust section reference everywhere. Handle SHN_XINDEX in the symbol table processing properly. * simple-object.c (handle_lto_debug_sections): Change interface to return a modified string and handle renaming of relocation sections. 2018-01-10 Daniel van Gerpen * argv.c (expandargv): Correct check for dynamically allocated argv. --- libiberty/simple-object.c | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'libiberty/simple-object.c') diff --git a/libiberty/simple-object.c b/libiberty/simple-object.c index 5b95fb2..42aa6ac 100644 --- a/libiberty/simple-object.c +++ b/libiberty/simple-object.c @@ -253,30 +253,43 @@ simple_object_find_section (simple_object_read *sobj, const char *name, /* Callback to identify and rename LTO debug sections by name. Returns 1 if NAME is a LTO debug section, 0 if not. */ -static int -handle_lto_debug_sections (const char **name) +static char * +handle_lto_debug_sections (const char *name) { + char *newname = XCNEWVEC (char, strlen (name) + 1); + /* ??? So we can't use .gnu.lto_ prefixed sections as the assembler complains about bogus section flags. Which means we need to arrange for that to be fixed or .gnu.debuglto_ marked as SHF_EXCLUDE (to make fat lto object tooling work for the fat part). */ - /* ??? For now this handles both .gnu.lto_ and .gnu.debuglto_ prefixed - sections. */ - /* Copy LTO debug sections and rename them to their non-LTO name. */ - if (strncmp (*name, ".gnu.debuglto_", sizeof (".gnu.debuglto_") - 1) == 0) + /* Also include corresponding reloc sections. */ + if (strncmp (name, ".rela", sizeof (".rela") - 1) == 0) { - *name = *name + sizeof (".gnu.debuglto_") - 1; - return 1; + strncpy (newname, name, sizeof (".rela") - 1); + name += sizeof (".rela") - 1; } - else if (strncmp (*name, ".gnu.lto_.debug_", sizeof (".gnu.lto_.debug_") -1) == 0) + else if (strncmp (name, ".rel", sizeof (".rel") - 1) == 0) { - *name = *name + sizeof (".gnu.lto_") - 1; - return 1; + strncpy (newname, name, sizeof (".rel") - 1); + name += sizeof (".rel") - 1; } + /* ??? For now this handles both .gnu.lto_ and .gnu.debuglto_ prefixed + sections. */ + /* Copy LTO debug sections and rename them to their non-LTO name. */ + if (strncmp (name, ".gnu.debuglto_", sizeof (".gnu.debuglto_") - 1) == 0) + return strcat (newname, name + sizeof (".gnu.debuglto_") - 1); + else if (strncmp (name, ".gnu.lto_.debug_", + sizeof (".gnu.lto_.debug_") -1) == 0) + return strcat (newname, name + sizeof (".gnu.lto_") - 1); /* Copy over .note.GNU-stack section under the same name if present. */ - else if (strcmp (*name, ".note.GNU-stack") == 0) - return 1; - return 0; + else if (strcmp (name, ".note.GNU-stack") == 0) + return strcpy (newname, name); + /* Copy over .comment section under the same name if present. Solaris + ld uses them to relax its checking of ELF gABI access rules for + COMDAT sections in objects produced by GCC. */ + else if (strcmp (name, ".comment") == 0) + return strcpy (newname, name); + return NULL; } /* Copy LTO debug sections. */ -- cgit v1.1