diff options
author | emaste <emaste@FreeBSD.org> | 2016-05-20 17:24:34 +0000 |
---|---|---|
committer | emaste <emaste@FreeBSD.org> | 2016-05-20 17:24:34 +0000 |
commit | e1afa8a66332bcb42ea042ec5dfb59de5b33ee08 (patch) | |
tree | 53f16cf467b740bb55f778ee1a5c3b117e43c2e0 /contrib/elftoolchain/libelftc | |
parent | 1860a225caf7329b3bc2038750624b9d0b47139a (diff) | |
parent | db27a04d331bc804aa12a4a70e9e0d939f3773c0 (diff) | |
download | FreeBSD-src-e1afa8a66332bcb42ea042ec5dfb59de5b33ee08.zip FreeBSD-src-e1afa8a66332bcb42ea042ec5dfb59de5b33ee08.tar.gz |
Update to ELF Tool Chain r3475
Improvements include:
* Add support for reporting and handling a number of new constants in
various tools, including:
* CloudABI OSABI
* DT_TLSDESC_*
* i386, MIPS, SPARC and amd64 relocations
* C++ demangler bug fixes
* Man page updates
* Improved input validation in several tools
This update also reduces diffs against upstream as a number of fixes
included in upstream were previously cherry-picked into FreeBSD.
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'contrib/elftoolchain/libelftc')
-rw-r--r-- | contrib/elftoolchain/libelftc/Makefile | 4 | ||||
-rw-r--r-- | contrib/elftoolchain/libelftc/elftc_reloc_type_str.3 | 72 | ||||
-rw-r--r-- | contrib/elftoolchain/libelftc/elftc_reloc_type_str.c | 684 | ||||
-rw-r--r-- | contrib/elftoolchain/libelftc/libelftc.h | 3 | ||||
-rw-r--r-- | contrib/elftoolchain/libelftc/libelftc_dem_arm.c | 6 | ||||
-rw-r--r-- | contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c | 10 | ||||
-rw-r--r-- | contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c | 32 | ||||
-rwxr-xr-x | contrib/elftoolchain/libelftc/make-toolchain-version | 26 |
8 files changed, 801 insertions, 36 deletions
diff --git a/contrib/elftoolchain/libelftc/Makefile b/contrib/elftoolchain/libelftc/Makefile index 4af496b..6e38a87 100644 --- a/contrib/elftoolchain/libelftc/Makefile +++ b/contrib/elftoolchain/libelftc/Makefile @@ -1,4 +1,4 @@ -# $Id: Makefile 3292 2016-01-06 21:46:32Z jkoshy $ +# $Id: Makefile 3418 2016-02-19 20:04:42Z emaste $ TOP= ${.CURDIR}/.. @@ -7,6 +7,7 @@ LIB= elftc SRCS= elftc_bfdtarget.c \ elftc_copyfile.c \ elftc_demangle.c \ + elftc_reloc_type_str.c \ elftc_set_timestamps.c \ elftc_string_table.c \ elftc_version.c \ @@ -34,6 +35,7 @@ MAN= elftc.3 \ elftc_bfd_find_target.3 \ elftc_copyfile.3 \ elftc_demangle.3 \ + elftc_reloc_type_str.3 \ elftc_set_timestamps.3 \ elftc_string_table_create.3 \ elftc_version.3 diff --git a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.3 b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.3 new file mode 100644 index 0000000..5cd08a6 --- /dev/null +++ b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.3 @@ -0,0 +1,72 @@ +.\" Copyright (c) 2016 The FreeBSD Foundation. All rights reserved. +.\" +.\" This documentation was written by Ed Maste under sponsorship of +.\" the FreeBSD Foundation. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" This software is provided by the author and contributors ``as is'' and +.\" any express or implied warranties, including, but not limited to, the +.\" implied warranties of merchantability and fitness for a particular purpose +.\" are disclaimed. In no event shall the author or contributors be liable +.\" for any direct, indirect, incidental, special, exemplary, or consequential +.\" damages (including, but not limited to, procurement of substitute goods +.\" or services; loss of use, data, or profits; or business interruption) +.\" however caused and on any theory of liability, whether in contract, strict +.\" liability, or tort (including negligence or otherwise) arising in any way +.\" out of the use of this software, even if advised of the possibility of +.\" such damage. +.\" +.\" $Id$ +.\" +.Dd February 19, 2016 +.Os +.Dt ELFTC_RELOC_TYPE_STR 3 +.Sh NAME +.Nm elftc_reloc_type_str +.Nd return the type name for an ELF relocation +.Sh LIBRARY +.Lb libelftc +.Sh SYNOPSIS +.In libelftc.h +.Ft const char * +.Fo elftc_reloc_type_str +.Fa "unsigned int mach" +.Fa "unsigned int type" +.Fc +.Sh DESCRIPTION +Function +.Fn elftc_reloc_type_str +returns the name for specified relocation type. +.Pp +Argument +.Ar mach +specifies the machine (architecture) type. +Argument +.Ar type +specifies the relocation value. +.Sh RETURN VALUE +Function +.Fn elftc_program_version +returns a pointer to a string constant, or to an internal character buffer +if the relocation type is unknown. +.Sh EXAMPLES +To print ARM relocation type 7, use: +.Bd -literal -offset indent +#include <sys/types.h> +#include <libelftc.h> +#include <stdio.h> + +(void) printf("%s\en", elftc_reloc_type_str(EM_ARM, 7)); +.Ed +.Sh ERRORS +Function +.Fn elftc_reloc_type_str +always succeeds. diff --git a/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c new file mode 100644 index 0000000..a22a1be --- /dev/null +++ b/contrib/elftoolchain/libelftc/elftc_reloc_type_str.c @@ -0,0 +1,684 @@ +/*- + * Copyright (c) 2009-2015 Kai Wang + * Copyright (c) 2016 The FreeBSD Foundation + * All rights reserved. + * + * Portions of this software were developed by Ed Maste under sponsorship + * of the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include <libelftc.h> +#include <stdio.h> + +const char * +elftc_reloc_type_str(unsigned int mach, unsigned int type) +{ + static char s_type[32]; + + switch(mach) { + case EM_386: + case EM_IAMCU: + switch(type) { + case 0: return "R_386_NONE"; + case 1: return "R_386_32"; + case 2: return "R_386_PC32"; + case 3: return "R_386_GOT32"; + case 4: return "R_386_PLT32"; + case 5: return "R_386_COPY"; + case 6: return "R_386_GLOB_DAT"; + case 7: return "R_386_JUMP_SLOT"; + case 8: return "R_386_RELATIVE"; + case 9: return "R_386_GOTOFF"; + case 10: return "R_386_GOTPC"; + case 11: return "R_386_32PLT"; /* Not in psabi */ + case 14: return "R_386_TLS_TPOFF"; + case 15: return "R_386_TLS_IE"; + case 16: return "R_386_TLS_GOTIE"; + case 17: return "R_386_TLS_LE"; + case 18: return "R_386_TLS_GD"; + case 19: return "R_386_TLS_LDM"; + case 20: return "R_386_16"; + case 21: return "R_386_PC16"; + case 22: return "R_386_8"; + case 23: return "R_386_PC8"; + case 24: return "R_386_TLS_GD_32"; + case 25: return "R_386_TLS_GD_PUSH"; + case 26: return "R_386_TLS_GD_CALL"; + case 27: return "R_386_TLS_GD_POP"; + case 28: return "R_386_TLS_LDM_32"; + case 29: return "R_386_TLS_LDM_PUSH"; + case 30: return "R_386_TLS_LDM_CALL"; + case 31: return "R_386_TLS_LDM_POP"; + case 32: return "R_386_TLS_LDO_32"; + case 33: return "R_386_TLS_IE_32"; + case 34: return "R_386_TLS_LE_32"; + case 35: return "R_386_TLS_DTPMOD32"; + case 36: return "R_386_TLS_DTPOFF32"; + case 37: return "R_386_TLS_TPOFF32"; + case 38: return "R_386_SIZE32"; + case 39: return "R_386_TLS_GOTDESC"; + case 40: return "R_386_TLS_DESC_CALL"; + case 41: return "R_386_TLS_DESC"; + case 42: return "R_386_IRELATIVE"; + case 43: return "R_386_GOT32X"; + } + break; + case EM_AARCH64: + switch(type) { + case 0: return "R_AARCH64_NONE"; + case 257: return "R_AARCH64_ABS64"; + case 258: return "R_AARCH64_ABS32"; + case 259: return "R_AARCH64_ABS16"; + case 260: return "R_AARCH64_PREL64"; + case 261: return "R_AARCH64_PREL32"; + case 262: return "R_AARCH64_PREL16"; + case 263: return "R_AARCH64_MOVW_UABS_G0"; + case 264: return "R_AARCH64_MOVW_UABS_G0_NC"; + case 265: return "R_AARCH64_MOVW_UABS_G1"; + case 266: return "R_AARCH64_MOVW_UABS_G1_NC"; + case 267: return "R_AARCH64_MOVW_UABS_G2"; + case 268: return "R_AARCH64_MOVW_UABS_G2_NC"; + case 269: return "R_AARCH64_MOVW_UABS_G3"; + case 270: return "R_AARCH64_MOVW_SABS_G0"; + case 271: return "R_AARCH64_MOVW_SABS_G1"; + case 272: return "R_AARCH64_MOVW_SABS_G2"; + case 273: return "R_AARCH64_LD_PREL_LO19"; + case 274: return "R_AARCH64_ADR_PREL_LO21"; + case 275: return "R_AARCH64_ADR_PREL_PG_HI21"; + case 276: return "R_AARCH64_ADR_PREL_PG_HI21_NC"; + case 277: return "R_AARCH64_ADD_ABS_LO12_NC"; + case 278: return "R_AARCH64_LDST8_ABS_LO12_NC"; + case 279: return "R_AARCH64_TSTBR14"; + case 280: return "R_AARCH64_CONDBR19"; + case 282: return "R_AARCH64_JUMP26"; + case 283: return "R_AARCH64_CALL26"; + case 284: return "R_AARCH64_LDST16_ABS_LO12_NC"; + case 285: return "R_AARCH64_LDST32_ABS_LO12_NC"; + case 286: return "R_AARCH64_LDST64_ABS_LO12_NC"; + case 287: return "R_AARCH64_MOVW_PREL_G0"; + case 288: return "R_AARCH64_MOVW_PREL_G0_NC"; + case 289: return "R_AARCH64_MOVW_PREL_G1"; + case 290: return "R_AARCH64_MOVW_PREL_G1_NC"; + case 291: return "R_AARCH64_MOVW_PREL_G2"; + case 292: return "R_AARCH64_MOVW_PREL_G2_NC"; + case 293: return "R_AARCH64_MOVW_PREL_G3"; + case 299: return "R_AARCH64_LDST128_ABS_LO12_NC"; + case 300: return "R_AARCH64_MOVW_GOTOFF_G0"; + case 301: return "R_AARCH64_MOVW_GOTOFF_G0_NC"; + case 302: return "R_AARCH64_MOVW_GOTOFF_G1"; + case 303: return "R_AARCH64_MOVW_GOTOFF_G1_NC"; + case 304: return "R_AARCH64_MOVW_GOTOFF_G2"; + case 305: return "R_AARCH64_MOVW_GOTOFF_G2_NC"; + case 306: return "R_AARCH64_MOVW_GOTOFF_G3"; + case 307: return "R_AARCH64_GOTREL64"; + case 308: return "R_AARCH64_GOTREL32"; + case 309: return "R_AARCH64_GOT_LD_PREL19"; + case 310: return "R_AARCH64_LD64_GOTOFF_LO15"; + case 311: return "R_AARCH64_ADR_GOT_PAGE"; + case 312: return "R_AARCH64_LD64_GOT_LO12_NC"; + case 313: return "R_AARCH64_LD64_GOTPAGE_LO15"; + case 560: return "R_AARCH64_TLSDESC_LD_PREL19"; + case 561: return "R_AARCH64_TLSDESC_ADR_PREL21"; + case 562: return "R_AARCH64_TLSDESC_ADR_PAGE21"; + case 563: return "R_AARCH64_TLSDESC_LD64_LO12"; + case 564: return "R_AARCH64_TLSDESC_ADD_LO12"; + case 565: return "R_AARCH64_TLSDESC_OFF_G1"; + case 566: return "R_AARCH64_TLSDESC_OFF_G0_NC"; + case 567: return "R_AARCH64_TLSDESC_LDR"; + case 568: return "R_AARCH64_TLSDESC_ADD"; + case 569: return "R_AARCH64_TLSDESC_CALL"; + case 1024: return "R_AARCH64_COPY"; + case 1025: return "R_AARCH64_GLOB_DAT"; + case 1026: return "R_AARCH64_JUMP_SLOT"; + case 1027: return "R_AARCH64_RELATIVE"; + case 1028: return "R_AARCH64_TLS_DTPREL64"; + case 1029: return "R_AARCH64_TLS_DTPMOD64"; + case 1030: return "R_AARCH64_TLS_TPREL64"; + case 1031: return "R_AARCH64_TLSDESC"; + case 1032: return "R_AARCH64_IRELATIVE"; + } + break; + case EM_ARM: + switch(type) { + case 0: return "R_ARM_NONE"; + case 1: return "R_ARM_PC24"; /* Deprecated */ + case 2: return "R_ARM_ABS32"; + case 3: return "R_ARM_REL32"; + case 4: return "R_ARM_LDR_PC_G0"; /* Also R_ARM_PC13 */ + case 5: return "R_ARM_ABS16"; + case 6: return "R_ARM_ABS12"; + case 7: return "R_ARM_THM_ABS5"; + case 8: return "R_ARM_ABS8"; + case 9: return "R_ARM_SBREL32"; + case 10: return "R_ARM_THM_CALL"; /* Also R_ARM_THM_PC22 */ + case 11: return "R_ARM_THM_PC8"; + case 12: return "R_ARM_BREL_ADJ"; /* Also R_ARM_AMP_VCALL9 */ + case 13: return "R_ARM_TLS_DESC"; /* Also R_ARM_SWI24 */ + case 14: return "R_ARM_THM_SWI8"; /* Obsolete */ + case 15: return "R_ARM_XPC25"; /* Obsolete */ + case 16: return "R_ARM_THM_XPC22"; /* Obsolete */ + case 17: return "R_ARM_TLS_DTPMOD32"; + case 18: return "R_ARM_TLS_DTPOFF32"; + case 19: return "R_ARM_TLS_TPOFF32"; + case 20: return "R_ARM_COPY"; + case 21: return "R_ARM_GLOB_DAT"; + case 22: return "R_ARM_JUMP_SLOT"; + case 23: return "R_ARM_RELATIVE"; + case 24: return "R_ARM_GOTOFF32"; /* Also R_ARM_GOTOFF */ + case 25: return "R_ARM_BASE_PREL"; /* GNU R_ARM_GOTPC */ + case 26: return "R_ARM_GOT_BREL"; /* GNU R_ARM_GOT32 */ + case 27: return "R_ARM_PLT32"; /* Deprecated */ + case 28: return "R_ARM_CALL"; + case 29: return "R_ARM_JUMP24"; + case 30: return "R_ARM_THM_JUMP24"; + case 31: return "R_ARM_BASE_ABS"; + case 32: return "R_ARM_ALU_PCREL_7_0"; /* Obsolete */ + case 33: return "R_ARM_ALU_PCREL_15_8"; /* Obsolete */ + case 34: return "R_ARM_ALU_PCREL_23_15"; /* Obsolete */ + case 35: return "R_ARM_LDR_SBREL_11_0_NC"; /* Deprecated */ + case 36: return "R_ARM_ALU_SBREL_19_12_NC"; /* Deprecated */ + case 37: return "R_ARM_ALU_SBREL_27_20_CK"; /* Deprecated */ + case 38: return "R_ARM_TARGET1"; + case 39: return "R_ARM_SBREL31"; /* Deprecated. */ + case 40: return "R_ARM_V4BX"; + case 41: return "R_ARM_TARGET2"; + case 42: return "R_ARM_PREL31"; + case 43: return "R_ARM_MOVW_ABS_NC"; + case 44: return "R_ARM_MOVT_ABS"; + case 45: return "R_ARM_MOVW_PREL_NC"; + case 46: return "R_ARM_MOVT_PREL"; + case 47: return "R_ARM_THM_MOVW_ABS_NC"; + case 48: return "R_ARM_THM_MOVT_ABS"; + case 49: return "R_ARM_THM_MOVW_PREL_NC"; + case 50: return "R_ARM_THM_MOVT_PREL"; + case 51: return "R_ARM_THM_JUMP19"; + case 52: return "R_ARM_THM_JUMP6"; + case 53: return "R_ARM_THM_ALU_PREL_11_0"; + case 54: return "R_ARM_THM_PC12"; + case 55: return "R_ARM_ABS32_NOI"; + case 56: return "R_ARM_REL32_NOI"; + case 57: return "R_ARM_ALU_PC_G0_NC"; + case 58: return "R_ARM_ALU_PC_G0"; + case 59: return "R_ARM_ALU_PC_G1_NC"; + case 60: return "R_ARM_ALU_PC_G1"; + case 61: return "R_ARM_ALU_PC_G2"; + case 62: return "R_ARM_LDR_PC_G1"; + case 63: return "R_ARM_LDR_PC_G2"; + case 64: return "R_ARM_LDRS_PC_G0"; + case 65: return "R_ARM_LDRS_PC_G1"; + case 66: return "R_ARM_LDRS_PC_G2"; + case 67: return "R_ARM_LDC_PC_G0"; + case 68: return "R_ARM_LDC_PC_G1"; + case 69: return "R_ARM_LDC_PC_G2"; + case 70: return "R_ARM_ALU_SB_G0_NC"; + case 71: return "R_ARM_ALU_SB_G0"; + case 72: return "R_ARM_ALU_SB_G1_NC"; + case 73: return "R_ARM_ALU_SB_G1"; + case 74: return "R_ARM_ALU_SB_G2"; + case 75: return "R_ARM_LDR_SB_G0"; + case 76: return "R_ARM_LDR_SB_G1"; + case 77: return "R_ARM_LDR_SB_G2"; + case 78: return "R_ARM_LDRS_SB_G0"; + case 79: return "R_ARM_LDRS_SB_G1"; + case 80: return "R_ARM_LDRS_SB_G2"; + case 81: return "R_ARM_LDC_SB_G0"; + case 82: return "R_ARM_LDC_SB_G1"; + case 83: return "R_ARM_LDC_SB_G2"; + case 84: return "R_ARM_MOVW_BREL_NC"; + case 85: return "R_ARM_MOVT_BREL"; + case 86: return "R_ARM_MOVW_BREL"; + case 87: return "R_ARM_THM_MOVW_BREL_NC"; + case 88: return "R_ARM_THM_MOVT_BREL"; + case 89: return "R_ARM_THM_MOVW_BREL"; + case 90: return "R_ARM_TLS_GOTDESC"; + case 91: return "R_ARM_TLS_CALL"; + case 92: return "R_ARM_TLS_DESCSEQ"; + case 93: return "R_ARM_THM_TLS_CALL"; + case 94: return "R_ARM_PLT32_ABS"; + case 95: return "R_ARM_GOT_ABS"; + case 96: return "R_ARM_GOT_PREL"; + case 97: return "R_ARM_GOT_BREL12"; + case 98: return "R_ARM_GOTOFF12"; + case 99: return "R_ARM_GOTRELAX"; + case 100: return "R_ARM_GNU_VTENTRY"; + case 101: return "R_ARM_GNU_VTINHERIT"; + case 102: return "R_ARM_THM_JUMP11"; /* Also R_ARM_THM_PC11 */ + case 103: return "R_ARM_THM_JUMP8"; /* Also R_ARM_THM_PC9 */ + case 104: return "R_ARM_TLS_GD32"; + case 105: return "R_ARM_TLS_LDM32"; + case 106: return "R_ARM_TLS_LDO32"; + case 107: return "R_ARM_TLS_IE32"; + case 108: return "R_ARM_TLS_LE32"; + case 109: return "R_ARM_TLS_LDO12"; + case 110: return "R_ARM_TLS_LE12"; + case 111: return "R_ARM_TLS_IE12GP"; + /* 112-127 R_ARM_PRIVATE_<n> */ + case 128: return "R_ARM_ME_TOO"; /* Obsolete */ + case 129: return "R_ARM_THM_TLS_DESCSEQ16"; + case 130: return "R_ARM_THM_TLS_DESCSEQ32"; + case 131: return "R_ARM_THM_GOT_BREL12"; + case 132: return "R_ARM_THM_ALU_ABS_G0_NC"; + case 133: return "R_ARM_THM_ALU_ABS_G1_NC"; + case 134: return "R_ARM_THM_ALU_ABS_G2_NC"; + case 135: return "R_ARM_THM_ALU_ABS_G3"; + /* 136-159 Reserved for future allocation. */ + case 160: return "R_ARM_IRELATIVE"; + /* 161-255 Reserved for future allocation. */ + case 249: return "R_ARM_RXPC25"; + case 250: return "R_ARM_RSBREL32"; + case 251: return "R_ARM_THM_RPC22"; + case 252: return "R_ARM_RREL32"; + case 253: return "R_ARM_RABS32"; + case 254: return "R_ARM_RPC24"; + case 255: return "R_ARM_RBASE"; + } + break; + case EM_IA_64: + switch(type) { + case 0: return "R_IA_64_NONE"; + case 33: return "R_IA_64_IMM14"; + case 34: return "R_IA_64_IMM22"; + case 35: return "R_IA_64_IMM64"; + case 36: return "R_IA_64_DIR32MSB"; + case 37: return "R_IA_64_DIR32LSB"; + case 38: return "R_IA_64_DIR64MSB"; + case 39: return "R_IA_64_DIR64LSB"; + case 42: return "R_IA_64_GPREL22"; + case 43: return "R_IA_64_GPREL64I"; + case 44: return "R_IA_64_GPREL32MSB"; + case 45: return "R_IA_64_GPREL32LSB"; + case 46: return "R_IA_64_GPREL64MSB"; + case 47: return "R_IA_64_GPREL64LSB"; + case 50: return "R_IA_64_LTOFF22"; + case 51: return "R_IA_64_LTOFF64I"; + case 58: return "R_IA_64_PLTOFF22"; + case 59: return "R_IA_64_PLTOFF64I"; + case 62: return "R_IA_64_PLTOFF64MSB"; + case 63: return "R_IA_64_PLTOFF64LSB"; + case 67: return "R_IA_64_FPTR64I"; + case 68: return "R_IA_64_FPTR32MSB"; + case 69: return "R_IA_64_FPTR32LSB"; + case 70: return "R_IA_64_FPTR64MSB"; + case 71: return "R_IA_64_FPTR64LSB"; + case 72: return "R_IA_64_PCREL60B"; + case 73: return "R_IA_64_PCREL21B"; + case 74: return "R_IA_64_PCREL21M"; + case 75: return "R_IA_64_PCREL21F"; + case 76: return "R_IA_64_PCREL32MSB"; + case 77: return "R_IA_64_PCREL32LSB"; + case 78: return "R_IA_64_PCREL64MSB"; + case 79: return "R_IA_64_PCREL64LSB"; + case 82: return "R_IA_64_LTOFF_FPTR22"; + case 83: return "R_IA_64_LTOFF_FPTR64I"; + case 84: return "R_IA_64_LTOFF_FPTR32MSB"; + case 85: return "R_IA_64_LTOFF_FPTR32LSB"; + case 86: return "R_IA_64_LTOFF_FPTR64MSB"; + case 87: return "R_IA_64_LTOFF_FPTR64LSB"; + case 92: return "R_IA_64_SEGREL32MSB"; + case 93: return "R_IA_64_SEGREL32LSB"; + case 94: return "R_IA_64_SEGREL64MSB"; + case 95: return "R_IA_64_SEGREL64LSB"; + case 100: return "R_IA_64_SECREL32MSB"; + case 101: return "R_IA_64_SECREL32LSB"; + case 102: return "R_IA_64_SECREL64MSB"; + case 103: return "R_IA_64_SECREL64LSB"; + case 108: return "R_IA_64_REL32MSB"; + case 109: return "R_IA_64_REL32LSB"; + case 110: return "R_IA_64_REL64MSB"; + case 111: return "R_IA_64_REL64LSB"; + case 116: return "R_IA_64_LTV32MSB"; + case 117: return "R_IA_64_LTV32LSB"; + case 118: return "R_IA_64_LTV64MSB"; + case 119: return "R_IA_64_LTV64LSB"; + case 121: return "R_IA_64_PCREL21BI"; + case 122: return "R_IA_64_PCREL22"; + case 123: return "R_IA_64_PCREL64I"; + case 128: return "R_IA_64_IPLTMSB"; + case 129: return "R_IA_64_IPLTLSB"; + case 133: return "R_IA_64_SUB"; + case 134: return "R_IA_64_LTOFF22X"; + case 135: return "R_IA_64_LDXMOV"; + case 145: return "R_IA_64_TPREL14"; + case 146: return "R_IA_64_TPREL22"; + case 147: return "R_IA_64_TPREL64I"; + case 150: return "R_IA_64_TPREL64MSB"; + case 151: return "R_IA_64_TPREL64LSB"; + case 154: return "R_IA_64_LTOFF_TPREL22"; + case 166: return "R_IA_64_DTPMOD64MSB"; + case 167: return "R_IA_64_DTPMOD64LSB"; + case 170: return "R_IA_64_LTOFF_DTPMOD22"; + case 177: return "R_IA_64_DTPREL14"; + case 178: return "R_IA_64_DTPREL22"; + case 179: return "R_IA_64_DTPREL64I"; + case 180: return "R_IA_64_DTPREL32MSB"; + case 181: return "R_IA_64_DTPREL32LSB"; + case 182: return "R_IA_64_DTPREL64MSB"; + case 183: return "R_IA_64_DTPREL64LSB"; + case 186: return "R_IA_64_LTOFF_DTPREL22"; + } + break; + case EM_MIPS: + switch(type) { + case 0: return "R_MIPS_NONE"; + case 1: return "R_MIPS_16"; + case 2: return "R_MIPS_32"; + case 3: return "R_MIPS_REL32"; + case 4: return "R_MIPS_26"; + case 5: return "R_MIPS_HI16"; + case 6: return "R_MIPS_LO16"; + case 7: return "R_MIPS_GPREL16"; + case 8: return "R_MIPS_LITERAL"; + case 9: return "R_MIPS_GOT16"; + case 10: return "R_MIPS_PC16"; + case 11: return "R_MIPS_CALL16"; + case 12: return "R_MIPS_GPREL32"; + case 16: return "R_MIPS_SHIFT5"; + case 17: return "R_MIPS_SHIFT6"; + case 18: return "R_MIPS_64"; + case 19: return "R_MIPS_GOT_DISP"; + case 20: return "R_MIPS_GOT_PAGE"; + case 21: return "R_MIPS_GOT_OFST"; + case 22: return "R_MIPS_GOT_HI16"; + case 23: return "R_MIPS_GOT_LO16"; + case 24: return "R_MIPS_SUB"; + case 30: return "R_MIPS_CALLHI16"; + case 31: return "R_MIPS_CALLLO16"; + case 37: return "R_MIPS_JALR"; + case 38: return "R_MIPS_TLS_DTPMOD32"; + case 39: return "R_MIPS_TLS_DTPREL32"; + case 40: return "R_MIPS_TLS_DTPMOD64"; + case 41: return "R_MIPS_TLS_DTPREL64"; + case 42: return "R_MIPS_TLS_GD"; + case 43: return "R_MIPS_TLS_LDM"; + case 44: return "R_MIPS_TLS_DTPREL_HI16"; + case 45: return "R_MIPS_TLS_DTPREL_LO16"; + case 46: return "R_MIPS_TLS_GOTTPREL"; + case 47: return "R_MIPS_TLS_TPREL32"; + case 48: return "R_MIPS_TLS_TPREL64"; + case 49: return "R_MIPS_TLS_TPREL_HI16"; + case 50: return "R_MIPS_TLS_TPREL_LO16"; + } + break; + case EM_PPC: + switch(type) { + case 0: return "R_PPC_NONE"; + case 1: return "R_PPC_ADDR32"; + case 2: return "R_PPC_ADDR24"; + case 3: return "R_PPC_ADDR16"; + case 4: return "R_PPC_ADDR16_LO"; + case 5: return "R_PPC_ADDR16_HI"; + case 6: return "R_PPC_ADDR16_HA"; + case 7: return "R_PPC_ADDR14"; + case 8: return "R_PPC_ADDR14_BRTAKEN"; + case 9: return "R_PPC_ADDR14_BRNTAKEN"; + case 10: return "R_PPC_REL24"; + case 11: return "R_PPC_REL14"; + case 12: return "R_PPC_REL14_BRTAKEN"; + case 13: return "R_PPC_REL14_BRNTAKEN"; + case 14: return "R_PPC_GOT16"; + case 15: return "R_PPC_GOT16_LO"; + case 16: return "R_PPC_GOT16_HI"; + case 17: return "R_PPC_GOT16_HA"; + case 18: return "R_PPC_PLTREL24"; + case 19: return "R_PPC_COPY"; + case 20: return "R_PPC_GLOB_DAT"; + case 21: return "R_PPC_JMP_SLOT"; + case 22: return "R_PPC_RELATIVE"; + case 23: return "R_PPC_LOCAL24PC"; + case 24: return "R_PPC_UADDR32"; + case 25: return "R_PPC_UADDR16"; + case 26: return "R_PPC_REL32"; + case 27: return "R_PPC_PLT32"; + case 28: return "R_PPC_PLTREL32"; + case 29: return "R_PPC_PLT16_LO"; + case 30: return "R_PPC_PLT16_HI"; + case 31: return "R_PPC_PLT16_HA"; + case 32: return "R_PPC_SDAREL16"; + case 33: return "R_PPC_SECTOFF"; + case 34: return "R_PPC_SECTOFF_LO"; + case 35: return "R_PPC_SECTOFF_HI"; + case 36: return "R_PPC_SECTOFF_HA"; + case 67: return "R_PPC_TLS"; + case 68: return "R_PPC_DTPMOD32"; + case 69: return "R_PPC_TPREL16"; + case 70: return "R_PPC_TPREL16_LO"; + case 71: return "R_PPC_TPREL16_HI"; + case 72: return "R_PPC_TPREL16_HA"; + case 73: return "R_PPC_TPREL32"; + case 74: return "R_PPC_DTPREL16"; + case 75: return "R_PPC_DTPREL16_LO"; + case 76: return "R_PPC_DTPREL16_HI"; + case 77: return "R_PPC_DTPREL16_HA"; + case 78: return "R_PPC_DTPREL32"; + case 79: return "R_PPC_GOT_TLSGD16"; + case 80: return "R_PPC_GOT_TLSGD16_LO"; + case 81: return "R_PPC_GOT_TLSGD16_HI"; + case 82: return "R_PPC_GOT_TLSGD16_HA"; + case 83: return "R_PPC_GOT_TLSLD16"; + case 84: return "R_PPC_GOT_TLSLD16_LO"; + case 85: return "R_PPC_GOT_TLSLD16_HI"; + case 86: return "R_PPC_GOT_TLSLD16_HA"; + case 87: return "R_PPC_GOT_TPREL16"; + case 88: return "R_PPC_GOT_TPREL16_LO"; + case 89: return "R_PPC_GOT_TPREL16_HI"; + case 90: return "R_PPC_GOT_TPREL16_HA"; + case 101: return "R_PPC_EMB_NADDR32"; + case 102: return "R_PPC_EMB_NADDR16"; + case 103: return "R_PPC_EMB_NADDR16_LO"; + case 104: return "R_PPC_EMB_NADDR16_HI"; + case 105: return "R_PPC_EMB_NADDR16_HA"; + case 106: return "R_PPC_EMB_SDAI16"; + case 107: return "R_PPC_EMB_SDA2I16"; + case 108: return "R_PPC_EMB_SDA2REL"; + case 109: return "R_PPC_EMB_SDA21"; + case 110: return "R_PPC_EMB_MRKREF"; + case 111: return "R_PPC_EMB_RELSEC16"; + case 112: return "R_PPC_EMB_RELST_LO"; + case 113: return "R_PPC_EMB_RELST_HI"; + case 114: return "R_PPC_EMB_RELST_HA"; + case 115: return "R_PPC_EMB_BIT_FLD"; + case 116: return "R_PPC_EMB_RELSDA"; + } + break; + case EM_RISCV: + switch(type) { + case 0: return "R_RISCV_NONE"; + case 1: return "R_RISCV_32"; + case 2: return "R_RISCV_64"; + case 3: return "R_RISCV_RELATIVE"; + case 4: return "R_RISCV_COPY"; + case 5: return "R_RISCV_JUMP_SLOT"; + case 6: return "R_RISCV_TLS_DTPMOD32"; + case 7: return "R_RISCV_TLS_DTPMOD64"; + case 8: return "R_RISCV_TLS_DTPREL32"; + case 9: return "R_RISCV_TLS_DTPREL64"; + case 10: return "R_RISCV_TLS_TPREL32"; + case 11: return "R_RISCV_TLS_TPREL64"; + case 16: return "R_RISCV_BRANCH"; + case 17: return "R_RISCV_JAL"; + case 18: return "R_RISCV_CALL"; + case 19: return "R_RISCV_CALL_PLT"; + case 20: return "R_RISCV_GOT_HI20"; + case 21: return "R_RISCV_TLS_GOT_HI20"; + case 22: return "R_RISCV_TLS_GD_HI20"; + case 23: return "R_RISCV_PCREL_HI20"; + case 24: return "R_RISCV_PCREL_LO12_I"; + case 25: return "R_RISCV_PCREL_LO12_S"; + case 26: return "R_RISCV_HI20"; + case 27: return "R_RISCV_LO12_I"; + case 28: return "R_RISCV_LO12_S"; + case 29: return "R_RISCV_TPREL_HI20"; + case 30: return "R_RISCV_TPREL_LO12_I"; + case 31: return "R_RISCV_TPREL_LO12_S"; + case 32: return "R_RISCV_TPREL_ADD"; + case 33: return "R_RISCV_ADD8"; + case 34: return "R_RISCV_ADD16"; + case 35: return "R_RISCV_ADD32"; + case 36: return "R_RISCV_ADD64"; + case 37: return "R_RISCV_SUB8"; + case 38: return "R_RISCV_SUB16"; + case 39: return "R_RISCV_SUB32"; + case 40: return "R_RISCV_SUB64"; + case 41: return "R_RISCV_GNU_VTINHERIT"; + case 42: return "R_RISCV_GNU_VTENTRY"; + case 43: return "R_RISCV_ALIGN"; + case 44: return "R_RISCV_RVC_BRANCH"; + case 45: return "R_RISCV_RVC_JUMP"; + } + break; + case EM_SPARC: + case EM_SPARCV9: + switch(type) { + case 0: return "R_SPARC_NONE"; + case 1: return "R_SPARC_8"; + case 2: return "R_SPARC_16"; + case 3: return "R_SPARC_32"; + case 4: return "R_SPARC_DISP8"; + case 5: return "R_SPARC_DISP16"; + case 6: return "R_SPARC_DISP32"; + case 7: return "R_SPARC_WDISP30"; + case 8: return "R_SPARC_WDISP22"; + case 9: return "R_SPARC_HI22"; + case 10: return "R_SPARC_22"; + case 11: return "R_SPARC_13"; + case 12: return "R_SPARC_LO10"; + case 13: return "R_SPARC_GOT10"; + case 14: return "R_SPARC_GOT13"; + case 15: return "R_SPARC_GOT22"; + case 16: return "R_SPARC_PC10"; + case 17: return "R_SPARC_PC22"; + case 18: return "R_SPARC_WPLT30"; + case 19: return "R_SPARC_COPY"; + case 20: return "R_SPARC_GLOB_DAT"; + case 21: return "R_SPARC_JMP_SLOT"; + case 22: return "R_SPARC_RELATIVE"; + case 23: return "R_SPARC_UA32"; + case 24: return "R_SPARC_PLT32"; + case 25: return "R_SPARC_HIPLT22"; + case 26: return "R_SPARC_LOPLT10"; + case 27: return "R_SPARC_PCPLT32"; + case 28: return "R_SPARC_PCPLT22"; + case 29: return "R_SPARC_PCPLT10"; + case 30: return "R_SPARC_10"; + case 31: return "R_SPARC_11"; + case 32: return "R_SPARC_64"; + case 33: return "R_SPARC_OLO10"; + case 34: return "R_SPARC_HH22"; + case 35: return "R_SPARC_HM10"; + case 36: return "R_SPARC_LM22"; + case 37: return "R_SPARC_PC_HH22"; + case 38: return "R_SPARC_PC_HM10"; + case 39: return "R_SPARC_PC_LM22"; + case 40: return "R_SPARC_WDISP16"; + case 41: return "R_SPARC_WDISP19"; + case 42: return "R_SPARC_GLOB_JMP"; + case 43: return "R_SPARC_7"; + case 44: return "R_SPARC_5"; + case 45: return "R_SPARC_6"; + case 46: return "R_SPARC_DISP64"; + case 47: return "R_SPARC_PLT64"; + case 48: return "R_SPARC_HIX22"; + case 49: return "R_SPARC_LOX10"; + case 50: return "R_SPARC_H44"; + case 51: return "R_SPARC_M44"; + case 52: return "R_SPARC_L44"; + case 53: return "R_SPARC_REGISTER"; + case 54: return "R_SPARC_UA64"; + case 55: return "R_SPARC_UA16"; + case 56: return "R_SPARC_TLS_GD_HI22"; + case 57: return "R_SPARC_TLS_GD_LO10"; + case 58: return "R_SPARC_TLS_GD_ADD"; + case 59: return "R_SPARC_TLS_GD_CALL"; + case 60: return "R_SPARC_TLS_LDM_HI22"; + case 61: return "R_SPARC_TLS_LDM_LO10"; + case 62: return "R_SPARC_TLS_LDM_ADD"; + case 63: return "R_SPARC_TLS_LDM_CALL"; + case 64: return "R_SPARC_TLS_LDO_HIX22"; + case 65: return "R_SPARC_TLS_LDO_LOX10"; + case 66: return "R_SPARC_TLS_LDO_ADD"; + case 67: return "R_SPARC_TLS_IE_HI22"; + case 68: return "R_SPARC_TLS_IE_LO10"; + case 69: return "R_SPARC_TLS_IE_LD"; + case 70: return "R_SPARC_TLS_IE_LDX"; + case 71: return "R_SPARC_TLS_IE_ADD"; + case 72: return "R_SPARC_TLS_LE_HIX22"; + case 73: return "R_SPARC_TLS_LE_LOX10"; + case 74: return "R_SPARC_TLS_DTPMOD32"; + case 75: return "R_SPARC_TLS_DTPMOD64"; + case 76: return "R_SPARC_TLS_DTPOFF32"; + case 77: return "R_SPARC_TLS_DTPOFF64"; + case 78: return "R_SPARC_TLS_TPOFF32"; + case 79: return "R_SPARC_TLS_TPOFF64"; + } + break; + case EM_X86_64: + switch(type) { + case 0: return "R_X86_64_NONE"; + case 1: return "R_X86_64_64"; + case 2: return "R_X86_64_PC32"; + case 3: return "R_X86_64_GOT32"; + case 4: return "R_X86_64_PLT32"; + case 5: return "R_X86_64_COPY"; + case 6: return "R_X86_64_GLOB_DAT"; + case 7: return "R_X86_64_JUMP_SLOT"; + case 8: return "R_X86_64_RELATIVE"; + case 9: return "R_X86_64_GOTPCREL"; + case 10: return "R_X86_64_32"; + case 11: return "R_X86_64_32S"; + case 12: return "R_X86_64_16"; + case 13: return "R_X86_64_PC16"; + case 14: return "R_X86_64_8"; + case 15: return "R_X86_64_PC8"; + case 16: return "R_X86_64_DTPMOD64"; + case 17: return "R_X86_64_DTPOFF64"; + case 18: return "R_X86_64_TPOFF64"; + case 19: return "R_X86_64_TLSGD"; + case 20: return "R_X86_64_TLSLD"; + case 21: return "R_X86_64_DTPOFF32"; + case 22: return "R_X86_64_GOTTPOFF"; + case 23: return "R_X86_64_TPOFF32"; + case 24: return "R_X86_64_PC64"; + case 25: return "R_X86_64_GOTOFF64"; + case 26: return "R_X86_64_GOTPC32"; + case 27: return "R_X86_64_GOT64"; + case 28: return "R_X86_64_GOTPCREL64"; + case 29: return "R_X86_64_GOTPC64"; + case 30: return "R_X86_64_GOTPLT64"; + case 31: return "R_X86_64_PLTOFF64"; + case 32: return "R_X86_64_SIZE32"; + case 33: return "R_X86_64_SIZE64"; + case 34: return "R_X86_64_GOTPC32_TLSDESC"; + case 35: return "R_X86_64_TLSDESC_CALL"; + case 36: return "R_X86_64_TLSDESC"; + case 37: return "R_X86_64_IRELATIVE"; + case 38: return "R_X86_64_RELATIVE64"; + case 41: return "R_X86_64_GOTPCRELX"; + case 42: return "R_X86_64_REX_GOTPCRELX"; + } + break; + } + + snprintf(s_type, sizeof(s_type), "<unknown: %#x>", type); + return (s_type); +} diff --git a/contrib/elftoolchain/libelftc/libelftc.h b/contrib/elftoolchain/libelftc/libelftc.h index e3adaf2..6c2b57a 100644 --- a/contrib/elftoolchain/libelftc/libelftc.h +++ b/contrib/elftoolchain/libelftc/libelftc.h @@ -24,7 +24,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: users/kaiwang27/elftc/libelftc.h 392 2009-05-31 19:17:46Z kaiwang27 $ - * $Id: libelftc.h 3309 2016-01-10 09:10:51Z kaiwang27 $ + * $Id: libelftc.h 3418 2016-02-19 20:04:42Z emaste $ */ #ifndef _LIBELFTC_H_ @@ -75,6 +75,7 @@ unsigned int elftc_bfd_target_machine(Elftc_Bfd_Target *_tgt); int elftc_copyfile(int _srcfd, int _dstfd); int elftc_demangle(const char *_mangledname, char *_buffer, size_t _bufsize, unsigned int _flags); +const char *elftc_reloc_type_str(unsigned int mach, unsigned int type); int elftc_set_timestamps(const char *_filename, struct stat *_sb); Elftc_String_Table *elftc_string_table_create(int _hint); void elftc_string_table_destroy(Elftc_String_Table *_table); diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_arm.c b/contrib/elftoolchain/libelftc/libelftc_dem_arm.c index e850b8b..012819e 100644 --- a/contrib/elftoolchain/libelftc/libelftc_dem_arm.c +++ b/contrib/elftoolchain/libelftc/libelftc_dem_arm.c @@ -37,7 +37,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_dem_arm.c 2065 2011-10-26 15:24:47Z jkoshy $"); +ELFTC_VCSID("$Id: libelftc_dem_arm.c 3447 2016-05-03 13:32:23Z emaste $"); /** * @file cpp_demangle_arm.c @@ -1171,8 +1171,8 @@ read_type(struct demangle_data *d) break; default : break; - }; - }; + } + } if (ELFTC_ISDIGIT(*d->p)) return (read_class(d)); diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c b/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c index 4fe141b..5dff1ca 100644 --- a/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c +++ b/contrib/elftoolchain/libelftc/libelftc_dem_gnu2.c @@ -37,7 +37,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_dem_gnu2.c 2065 2011-10-26 15:24:47Z jkoshy $"); +ELFTC_VCSID("$Id: libelftc_dem_gnu2.c 3447 2016-05-03 13:32:23Z emaste $"); /** * @file cpp_demangle_gnu2.c @@ -135,7 +135,7 @@ cpp_demangle_gnu2(const char *org) case ENCODE_OP_TI : case ENCODE_OP_VT : goto flat; - }; + } if (*d.p == 'F') ++d.p; @@ -315,7 +315,7 @@ is_cpp_mangled_gnu2(const char *org) rtn |= true; break; - }; + } } } @@ -1308,8 +1308,8 @@ read_type(struct demangle_data *d) break; default : break; - }; - }; + } + } if (ELFTC_ISDIGIT(*d->p)) return (read_class(d)); diff --git a/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c b/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c index f5ca7b3..7409363 100644 --- a/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c +++ b/contrib/elftoolchain/libelftc/libelftc_dem_gnu3.c @@ -36,7 +36,7 @@ #include "_libelftc.h" -ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3291 2016-01-04 02:36:38Z emaste $"); +ELFTC_VCSID("$Id: libelftc_dem_gnu3.c 3447 2016-05-03 13:32:23Z emaste $"); /** * @file cpp_demangle.c @@ -553,7 +553,7 @@ cpp_demangle_push_type_qualifier(struct cpp_demangle_data *ddata, free(buf); ++e_idx; break; - }; + } --idx; } @@ -714,7 +714,7 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata) return (cpp_demangle_push_str(ddata, "true", 4)); default: return (0); - }; + } case 'd': ++ddata->cur; @@ -764,7 +764,7 @@ cpp_demangle_read_expr_primary(struct cpp_demangle_data *ddata) default: return (0); - }; + } } static int @@ -1039,14 +1039,14 @@ cpp_demangle_read_expression(struct cpp_demangle_data *ddata) /* operator sizeof */ ddata->cur += 2; return (cpp_demangle_read_expression_unary(ddata, "sizeof", 6)); - }; + } switch (*ddata->cur) { case 'L': return (cpp_demangle_read_expr_primary(ddata)); case 'T': return (cpp_demangle_read_tmpl_param(ddata)); - }; + } return (0); } @@ -1421,7 +1421,7 @@ cpp_demangle_read_encoding(struct cpp_demangle_data *ddata) if (*ddata->cur == '\0') return (0); break; - }; + } return (cpp_demangle_read_name(ddata)); } @@ -1493,7 +1493,7 @@ cpp_demangle_read_name(struct cpp_demangle_data *ddata) return (cpp_demangle_read_nested_name(ddata)); case 'Z': return (cpp_demangle_read_local_name(ddata)); - }; + } if (!vector_str_init(&v)) return (0); @@ -1594,7 +1594,7 @@ cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata) case 'K': ddata->mem_cst = true; break; - }; + } ++ddata->cur; } @@ -1622,7 +1622,7 @@ cpp_demangle_read_nested_name(struct cpp_demangle_data *ddata) default: if (!cpp_demangle_read_uqname(ddata)) goto clean; - }; + } if ((subst_str = vector_str_substr(output, p_idx, output->size - 1, &subst_str_len)) == NULL) @@ -1947,7 +1947,7 @@ cpp_demangle_read_subst(struct cpp_demangle_data *ddata) case SIMPLE_HASH('S', 't'): /* std:: */ return (cpp_demangle_read_subst_std(ddata)); - }; + } if (*(++ddata->cur) == '\0') return (0); @@ -2095,7 +2095,7 @@ cpp_demangle_read_tmpl_arg(struct cpp_demangle_data *ddata) return (cpp_demangle_read_expr_primary(ddata)); case 'X': return (cpp_demangle_read_expression(ddata)); - }; + } return (cpp_demangle_read_type(ddata, 0)); } @@ -2576,7 +2576,7 @@ again: goto clean; ++ddata->cur; goto rtn; - }; + } if (!cpp_demangle_read_name(ddata)) goto clean; @@ -3040,7 +3040,7 @@ cpp_demangle_read_uqname(struct cpp_demangle_data *ddata) return (0); ddata->cur += 2; return (1); - }; + } /* vendor extened operator */ if (*ddata->cur == 'v' && ELFTC_ISDIGIT(*(ddata->cur + 1))) { @@ -3086,7 +3086,7 @@ cpp_demangle_read_uqname(struct cpp_demangle_data *ddata) return (0); ddata->cur +=2; return (1); - }; + } /* source name */ if (ELFTC_ISDIGIT(*ddata->cur) != 0) @@ -3449,7 +3449,7 @@ hex_to_dec(char c) return (15); default: return (-1); - }; + } } /** diff --git a/contrib/elftoolchain/libelftc/make-toolchain-version b/contrib/elftoolchain/libelftc/make-toolchain-version index 8891258..0cdf370 100755 --- a/contrib/elftoolchain/libelftc/make-toolchain-version +++ b/contrib/elftoolchain/libelftc/make-toolchain-version @@ -3,7 +3,7 @@ # This script generates a project-wide version identifier for use by # the `elftc_version()' API. # -# $Id: make-toolchain-version 3299 2016-01-09 19:58:46Z jkoshy $ +# $Id: make-toolchain-version 3414 2016-02-16 22:55:28Z jkoshy $ # # Defaults. @@ -64,19 +64,25 @@ done curdir=`pwd` cd ${top} || usage "ERROR: Cannot change directory to \"${top}\"." -if [ -d .svn -o -d ../.svn ]; then # FreeBSD and SF.Net sources. - versionstring=" svn:"$(svnversion) -elif [ -d CVS ]; then # NetBSD. +if [ -d CVS ]; then # Look for CVS (NetBSD). versionstring=" cvs:unknown" -else # DragonFlyBSD. - versionstring=" git:"$(git describe --all --dirty --long 2> /dev/null) - - # Cannot determine an in-tree version number. - if [ $? -ne 0 ]; then - versionstring="" +else # Try git (DragonFlyBSD). + gitversion="$(git describe --all --dirty --long 2> /dev/null)" + if [ -n "${gitversion}" ]; then + versionstring=" git:${gitversion}" + else # Assume an SVN checkout (SourceForge or FreeBSD). + svnversion="$(svnversion)" + if [ -n "${svnversion}" ]; then + versionstring=" svn:$(svnversion)" + fi fi fi +if [ -z "${versionstring}" ]; then + echo "ERROR: cannot determine a revision number." 1>&2 + exit 1 +fi + cd ${curdir} || usage "Cannot change back to ${curdir}." # |