From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 126797 invoked by alias); 7 Nov 2016 22:51:04 -0000 Mailing-List: contact archer-commits-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: Received: (qmail 126761 invoked by uid 9674); 7 Nov 2016 22:51:03 -0000 Date: Mon, 07 Nov 2016 22:51:00 -0000 Message-ID: <20161107225103.126727.qmail@sourceware.org> From: jkratoch@sourceware.org To: archer-commits@sourceware.org Subject: [SCM] users/jkratoch/dwarf5gcc: Merge remote-tracking branch 'gdb/master' into dwarf5gcc X-Git-Refname: refs/heads/users/jkratoch/dwarf5gcc X-Git-Reftype: branch X-Git-Oldrev: db2060bfd45fedf12db5495376c2bee5526acc6c X-Git-Newrev: 3e11dd8696f156b8e79f5b2188be1cf8f894e85b X-SW-Source: 2016-q4/txt/msg00012.txt.bz2 List-Id: The branch, users/jkratoch/dwarf5gcc has been updated via 3e11dd8696f156b8e79f5b2188be1cf8f894e85b (commit) via 7a34932bce1342c970a03128bbccc5a81ae3da6b (commit) via e680a6b69b4bd173a180419e973a9bf18a000151 (commit) via 9af89fbaecca21b2ca34c142584165066807fb10 (commit) via b93bfa1980fa4d1229874067dd36acd9ac5685cd (commit) from db2060bfd45fedf12db5495376c2bee5526acc6c (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 3e11dd8696f156b8e79f5b2188be1cf8f894e85b Merge: db2060b 7a34932 Author: Jan Kratochvil Date: Mon Nov 7 21:58:39 2016 +0100 Merge remote-tracking branch 'gdb/master' into dwarf5gcc commit 7a34932bce1342c970a03128bbccc5a81ae3da6b Author: Loïc Yhuel Date: Mon Nov 7 08:00:21 2016 -0800 Add missing '$' in configure.ac. 2016-11-04 Loïc Yhuel gold/ * configure.ac: add missing '$'. * configure: Regenerate. commit e680a6b69b4bd173a180419e973a9bf18a000151 Author: Nick Clifton Date: Mon Nov 7 15:05:34 2016 +0000 Fix infinite loop when processing rpath tokens. PR ld/20784 * emultempl/elf32.em (search_needed): Fix infinite loop when unable to process a token. Add support for curly braced enclosed tokens. * ld.texinfo (--rpath-link): Document supprot for $ORIGIN and $LIB. commit 9af89fbaecca21b2ca34c142584165066807fb10 Author: Nick Clifton Date: Mon Nov 7 12:28:16 2016 +0000 Note that the linker's --compress-debug-sections option overrides the compression status of any input debug sections. * ld.texinfo (--compress-debug-sections): Expand documentation of this option. commit b93bfa1980fa4d1229874067dd36acd9ac5685cd Author: GDB Administrator Date: Mon Nov 7 00:00:23 2016 +0000 Automatic date update in version.in ----------------------------------------------------------------------- Summary of changes: bfd/version.h | 2 +- gold/ChangeLog | 5 +++ gold/configure | 2 +- gold/configure.ac | 2 +- ld/ChangeLog | 14 +++++++++ ld/emultempl/elf32.em | 75 +++++++++++++++++++++++++++++++----------------- ld/ld.texinfo | 43 +++++++++++++++++++++------- 7 files changed, 102 insertions(+), 41 deletions(-) First 500 lines of diff: diff --git a/bfd/version.h b/bfd/version.h index f2750d9..fd3d5fd 100644 --- a/bfd/version.h +++ b/bfd/version.h @@ -1,4 +1,4 @@ -#define BFD_VERSION_DATE 20161106 +#define BFD_VERSION_DATE 20161107 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@ diff --git a/gold/ChangeLog b/gold/ChangeLog index 08b4a0a..0013288 100644 --- a/gold/ChangeLog +++ b/gold/ChangeLog @@ -1,3 +1,8 @@ +2016-11-04 Loïc Yhuel + + * configure.ac: add missing '$'. + * configure: Regenerate. + 2016-10-21 Gergely Nagy PR gold/17704 diff --git a/gold/configure b/gold/configure index 343a407..a3ed5c9 100755 --- a/gold/configure +++ b/gold/configure @@ -3266,7 +3266,7 @@ fi sysroot_relocatable=0 if test -n "$sysroot"; then - case "sysroot" in + case "$sysroot" in "${prefix}" | "${prefix}/"* | \ "${exec_prefix}" | "${exec_prefix}/"* | \ '${prefix}' | '${prefix}/'*| \ diff --git a/gold/configure.ac b/gold/configure.ac index de3b630..ff9f1fd 100644 --- a/gold/configure.ac +++ b/gold/configure.ac @@ -49,7 +49,7 @@ fi sysroot_relocatable=0 if test -n "$sysroot"; then - case "sysroot" in + case "$sysroot" in "${prefix}" | "${prefix}/"* | \ "${exec_prefix}" | "${exec_prefix}/"* | \ '${prefix}' | '${prefix}/'*| \ diff --git a/ld/ChangeLog b/ld/ChangeLog index 0513d2e..9d04123 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,17 @@ +2016-11-07 Nick Clifton + + PR ld/20784 + * emultempl/elf32.em (search_needed): Fix infinite loop when + unable to process a token. Add support for curly braced enclosed + tokens. + * ld.texinfo (--rpath-link): Document supprot for $ORIGIN and + $LIB. + +2016-11-07 Nick Clifton + + * ld.texinfo (--compress-debug-sections): Expand documentation of + this option. + 2016-11-04 Nick Clifton * emultempl/elf32.em (search_needed): Remove use of getauxval and diff --git a/ld/emultempl/elf32.em b/ld/emultempl/elf32.em index 57252da..8c63638 100644 --- a/ld/emultempl/elf32.em +++ b/ld/emultempl/elf32.em @@ -495,6 +495,7 @@ gld${EMULATION_NAME}_search_needed (const char *path, len = strlen (name); while (1) { + unsigned offset = 0; char * var; char *filename, *sset; @@ -527,8 +528,10 @@ gld${EMULATION_NAME}_search_needed (const char *path, /* PR 20535: Support the same pseudo-environment variables that are supported by ld.so. Namely, $ORIGIN, $LIB and $PLATFORM. Since there can be more than one occurrence of these tokens in - the path we loop until no more are found. */ - while ((var = strchr (filename, '$')) != NULL) + the path we loop until no more are found. Since we might not + be able to substitute some of the tokens we maintain an offset + into the filename for where we should begin our scan. */ + while ((var = strchr (filename + offset, '$')) != NULL) { /* The ld.so manual page does not say, but I am going to assume that these tokens are terminated by a directory seperator character @@ -536,13 +539,14 @@ gld${EMULATION_NAME}_search_needed (const char *path, $ORIGIN should only be used at the start of a path, but that is not enforced here. - FIXME: The ld.so manual page also states that it allows ${ORIGIN} - ${LIB} and ${PLATFORM}. We should support these variants too. + The ld.so manual page also states that it allows ${ORIGIN}, + ${LIB} and ${PLATFORM}, so these are supported as well. FIXME: The code could be a lot cleverer about allocating space for the processed string. */ char * end = strchr (var, '/'); char * replacement = NULL; + char * v = var + 1; char * freeme = NULL; unsigned flen = strlen (filename); @@ -550,16 +554,27 @@ gld${EMULATION_NAME}_search_needed (const char *path, /* Temporarily terminate the filename at the end of the token. */ * end = 0; - switch (var[1]) + if (*v == '{') + ++ v; + switch (*v++) { case 'O': - if (strcmp (var + 2, "RIGIN") == 0) + if (strcmp (v, "RIGIN") == 0 || strcmp (v, "RIGIN}") == 0) { /* ORIGIN - replace with the full path to the directory containing the program or shared object. */ if (needed.by == NULL) - break; - replacement = bfd_get_filename (needed.by); + { + if (link_info.output_bfd == NULL) + { + break; + } + else + replacement = bfd_get_filename (link_info.output_bfd); + } + else + replacement = bfd_get_filename (needed.by); + if (replacement) { char * slash; @@ -582,7 +597,7 @@ gld${EMULATION_NAME}_search_needed (const char *path, break; case 'L': - if (strcmp (var + 2, "IB") == 0) + if (strcmp (v, "IB") == 0 || strcmp (v, "IB}") == 0) { /* LIB - replace with "lib" in 32-bit environments and "lib64" in 64-bit environments. */ @@ -603,17 +618,12 @@ gld${EMULATION_NAME}_search_needed (const char *path, break; case 'P': - if (strcmp (var + 2, "LATFORM") == 0) - { - /* Supporting $PLATFORM in a cross-hosted environment is not - possible. Supporting it in a native environment involves - loading the header file which loads the - system header file, which conflicts with the - "include/elf/mips.h" header file. */ - replacement = NULL; - } - break; - + /* Supporting $PLATFORM in a cross-hosted environment is not + possible. Supporting it in a native environment involves + loading the header file which loads the + system header file, which conflicts with the + "include/elf/mips.h" header file. */ + /* Fall through. */ default: break; } @@ -623,14 +633,20 @@ gld${EMULATION_NAME}_search_needed (const char *path, char * filename2 = xmalloc (flen + strlen (replacement)); if (end) - sprintf (filename2, "%.*s%s/%s", - (int)(var - filename), filename, - replacement, end + 1); + { + sprintf (filename2, "%.*s%s/%s", + (int)(var - filename), filename, + replacement, end + 1); + offset = (var - filename) + 1 + strlen (replacement); + } else - sprintf (filename2, "%.*s%s", - (int)(var - filename), filename, - replacement); - + { + sprintf (filename2, "%.*s%s", + (int)(var - filename), filename, + replacement); + offset = var - filename + strlen (replacement); + } + free (filename); filename = filename2; /* There is no need to restore the path separator (when @@ -647,12 +663,17 @@ gld${EMULATION_NAME}_search_needed (const char *path, if (end) /* Restore the path separator. */ * end = '/'; + + /* PR 20784: Make sure that we resume the scan + *after* the token that we could not replace. */ + offset = (var + 1) - filename; } free (freeme); } needed.name = filename; + if (gld${EMULATION_NAME}_try_needed (&needed, force)) return TRUE; diff --git a/ld/ld.texinfo b/ld/ld.texinfo index 500fda6..d4f33b7 100644 --- a/ld/ld.texinfo +++ b/ld/ld.texinfo @@ -1865,6 +1865,16 @@ specifies the first set of directories to search. The either by specifying a list of names separated by colons, or by appearing multiple times. +The tokens @var{$ORIGIN} and @var{$LIB} can appear in these search +directories. They will be replaced by the full path to the directory +containing the program or shared object in the case of @var{$ORIGIN} +and either @samp{lib} - for 32-bit binaries - or @samp{lib64} - for +64-bit binaries - in the case of @var{$LIB}. + +The alternative form of these tokens - @var{$@{ORIGIN@}} and +@var{$@{LIB@}} can also be used. The token @var{$PLATFORM} is not +supported. + This option should be used with caution as it overrides the search path that may have been hard compiled into a shared library. In such a case it is possible to use unintentionally a different search path than the @@ -2319,17 +2329,28 @@ hash tables. The default is @code{sysv}. @itemx --compress-debug-sections=zlib @itemx --compress-debug-sections=zlib-gnu @itemx --compress-debug-sections=zlib-gabi -On ELF platforms , these options control how DWARF debug sections are -compressed using zlib. @option{--compress-debug-sections=none} doesn't -compress DWARF debug sections. -@option{--compress-debug-sections=zlib-gnu} compresses DWARF debug -sections and rename debug section names to begin with @samp{.zdebug} -instead of @samp{.debug}. @option{--compress-debug-sections=zlib} -and @option{--compress-debug-sections=zlib-gabi} -compress DWARF debug sections with SHF_COMPRESSED from the ELF ABI. -The default behaviour varies depending upon the target involved and -the configure options used to build the toolchain. The default can be -determined by examing the output from the linker's @option{--help} option. +On ELF platforms, these options control how DWARF debug sections are +compressed using zlib. + +@option{--compress-debug-sections=none} doesn't compress DWARF debug +sections. @option{--compress-debug-sections=zlib-gnu} compresses +DWARF debug sections and renames them to begin with @samp{.zdebug} +instead of @samp{.debug}. @option{--compress-debug-sections=zlib-gabi} +also compresses DWARF debug sections, but rather than renaming them it +sets the SHF_COMPRESSED flag in the sections' headers. + +The @option{--compress-debug-sections=zlib} option is an alias for +@option{--compress-debug-sections=zlib-gabi}. + +Note that this option overrides any compression in input debug +sections, so if a binary is linked with @option{--compress-debug-sections=none} +for example, then any compressed debug sections in input files will be +uncompressed before they are copied into the output binary. + +The default compression behaviour varies depending upon the target +involved and the configure options used to build the toolchain. The +default can be determined by examining the output from the linker's +@option{--help} option. @kindex --reduce-memory-overheads @item --reduce-memory-overheads hooks/post-receive -- Repository for Project Archer.