aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2018-08-29[MIPS/GAS] Split Loongson CAM Instructions from loongson3aChenghua Xu2-0/+6
bfd/ * elfxx-mips.c (print_mips_ases): Add CAM extension. binutils/ * readelf.c (print_mips_ases): Add CAM extension. gas/ * NEWS: Mention Loongson Content Address Memory (CAM) support. * config/tc-mips.c (options): Add OPTION_LOONGSON_CAM and OPTION_NO_LOONGSON_CAM. (md_longopts): Likewise. (mips_ases): Define availability for CAM. (mips_convert_ase_flags): Map ASE_LOONGSON_CAM to AFL_ASE_LOONGSON_CAM. (mips_cpu_info_table): Add ASE_LOONGSON_CAM for loongson3a. (md_show_usage): Add help for -mloongson-cam and -mno-loongson-cam. * doc/as.texi: Document -mloongson-cam, -mno-loongson-cam. * doc/c-mips.texi: Document -mloongson-cam, -mno-loongson-cam, .set loongson-cam and .set noloongson-cam. * testsuite/gas/mips/loongson-3a-2.d: Move cam test to ... * testsuite/gas/mips/loongson-cam.d: Here. Add ISA/ASE flag verification. * testsuite/gas/mips/loongson-3a-2.s: Move cam test to ... * testsuite/gas/mips/loongson-cam.s: Here. * testsuite/gas/mips/loongson-3a-mmi.d: Add ASE flag. * testsuite/gas/mips/mips.exp: Run loongson-cam test. include/ * elf/mips.h (AFL_ASE_LOONGSON_CAM): New macro. (AFL_ASE_MASK): Update to include AFL_ASE_LOONGSON_CAM. * opcode/mips.h (ASE_LOONGSON_CAM): New macro. opcodes/ * mips-dis.c (mips_arch_choices): Add CAM to loongson3a descriptors. (parse_mips_ase_option): Handle -M loongson-cam option. (print_mips_disassembler_options): Document -M loongson-cam. * mips-opc.c (LCAM): New macro. (mips_opcodes): Replace IL2F|IL3A marking with LCAM for CAM instructions.
2018-08-29Automatic date update in version.inGDB Administrator1-1/+1
2018-08-28Automatic date update in version.inGDB Administrator1-1/+1
2018-08-27x86: Don't mask out the GNU_PROPERTY_X86_UINT32_VALID bitH.J. Lu2-4/+6
Since only the GNU_PROPERTY_X86_UINT32_VALID bit may be set in data-only relocatable objects which don't contain any instructions, linker shouldn't mask out the GNU_PROPERTY_X86_UINT32_VALID bit when merging GNU_PROPERTY_X86_XXX bits. Otherwise, linker output doesn't contain GNU_PROPERTY_X86_XXX property with any data-only relocatable inputs. This patch keeps the GNU_PROPERTY_X86_UINT32_VALID bit and updates readelf to print "<None>" if GNU_PROPERTY_X86_XXX property only has the GNU_PROPERTY_X86_UINT32_VALID bit. bfd/ * elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Don't mask out the GNU_PROPERTY_X86_UINT32_VALID bit. binutils/ * readelf.c (decode_x86_isa): Print <None> if bitmask only contains the GNU_PROPERTY_X86_UINT32_VALID bit. (decode_x86_feature_1): Likewise. (decode_x86_feature_2): Likewise. (print_gnu_property_note): Don't mask out the GNU_PROPERTY_X86_UINT32_VALID bit. * testsuite/binutils-all/i386/pr21231b.d: Updated. * testsuite/binutils-all/x86-64/pr21231b.d: Likewise. gas/ * testsuite/gas/i386/i386.exp: Run property-1 and x86-64-property-1. * testsuite/gas/i386/property-1.d: New file. * testsuite/gas/i386/property-1.s: Likewise. * testsuite/gas/i386/x86-64-property-1.d: Likewise. ld/ * testsuite/ld-i386/i386.exp: Run property-x86-5. * testsuite/ld-i386/property-x86-5.d: New file. * testsuite/ld-x86-64/property-x86-5-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-5.d: Likewise. * testsuite/ld-x86-64/property-x86-5a.s: Likewise. * testsuite/ld-x86-64/property-x86-5b.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run property-x86-5 and property-x86-5-x32.
2018-08-27Automatic date update in version.inGDB Administrator1-1/+1
2018-08-26Automatic date update in version.inGDB Administrator1-1/+1
2018-08-25elf: Check for corrupt symbol version infoH.J. Lu2-1/+7
The BFD linker with PR ld/23499 may generate shared libraries with corrupt symbol version info which leads to linker error when the corrupt shared library is used: /usr/bin/ld: bin/libKF5Service.so.5.49.0: _edata: invalid version 21 (max 0) /usr/bin/ld: bin/libKF5Service.so.5.49.0: error adding symbols: bad value Add check for corrupt symbol version info to objdump: 00000000000af005 g D .data 0000000000000000 <corrupt> _edata and readelf: 728: 00000000000af005 0 NOTYPE GLOBAL DEFAULT 25 _edata@<corrupt> (5) bfd/ PR ld/23499 * elf.c (_bfd_elf_get_symbol_version_string): Return _("<corrupt>") for corrupt symbol version info. binutils/ PR ld/23499 * readelf.c (get_symbol_version_string): Return _("<corrupt>") for corrupt symbol version info.
2018-08-25Automatic date update in version.inGDB Administrator1-1/+1
2018-08-24x86: Update GNU_PROPERTY_X86_XXX macrosH.J. Lu2-60/+92
This patch updates GNU_PROPERTY_X86_XXX macros: 1. GNU_PROPERTY_X86_UINT32_AND_XXX: A 4-byte unsigned integer property. A bit is set if it is set in all relocatable inputs: #define GNU_PROPERTY_X86_UINT32_AND_LO 0xc0000002 #define GNU_PROPERTY_X86_UINT32_AND_HI 0xc0007fff 2. GNU_PROPERTY_X86_UINT32_OR_XXX: A 4-byte unsigned integer property. A bit is set if it is set in any relocatable inputs: #define GNU_PROPERTY_X86_UINT32_OR_LO 0xc0008000 #define GNU_PROPERTY_X86_UINT32_OR_HI 0xc000ffff 3. GNU_PROPERTY_X86_UINT32_OR_AND_XXX: A 4-byte unsigned integer property. A bit is set if it is set in any relocatable inputs and the property is present in all relocatable inputs: #define GNU_PROPERTY_X86_UINT32_OR_AND_LO 0xc0010000 #define GNU_PROPERTY_X86_UINT32_OR_AND_HI 0xc0017fff 4. GNU_PROPERTY_X86_FEATURE_2_NEEDED, GNU_PROPERTY_X86_FEATURE_2_USED and GNU_PROPERTY_X86_FEATURE_2_XXX bits. GNU_PROPERTY_X86_FEATURE_1_AND is unchanged. GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED are updated to better support targeted processors since GNU_PROPERTY_X86_ISA_1_?86 aren't isn't very useful. A new set of GNU_PROPERTY_X86_ISA_1_XXX bits are defined. The previous GNU_PROPERTY_X86_ISA_1_XXX macros are deprecated and renamed to GNU_PROPERTY_X86_COMPAT_ISA_1_XXX. bfd/ * elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Handle X86_COMPAT_ISA_1_USED, X86_COMPAT_ISA_1_NEEDED, X86_UINT32_AND_LO, X86_UINT32_AND_HI, X86_UINT32_OR_LO, X86_UINT32_OR_HI, X86_UINT32_OR_AND_LO and X86_UINT32_OR_AND_HI instead of X86_ISA_1_USED, X86_ISA_1_NEEDED and X86_FEATURE_1_AND. (_bfd_x86_elf_merge_gnu_properties): Likewise. (_bfd_x86_elf_link_setup_gnu_properties): Add X86_FEATURE_2_NEEDED instead of X86_ISA_1_NEEDED. (_bfd_x86_elf_link_fixup_gnu_properties): Handle X86_COMPAT_ISA_1_USED, X86_COMPAT_ISA_1_NEEDED, X86_UINT32_AND_LO, X86_UINT32_AND_HI, X86_UINT32_OR_LO, X86_UINT32_OR_HI, X86_UINT32_OR_AND_LO and X86_UINT32_OR_AND_HI instead of X86_ISA_1_USED, X86_ISA_1_NEEDED and X86_FEATURE_1_AND. binutils/ * readelf.c (decode_x86_compat_isa): New function. (decode_x86_feature_2): Likewise. (decode_x86_isa): Updated for new X86_ISA_1_XXX bits. (decode_x86_feature): Renamed to ... (decode_x86_feature_1): This. Remove the type argument. (print_gnu_property_note): Handle X86_COMPAT_ISA_1_USED, X86_COMPAT_ISA_1_NEEDED, X86_UINT32_AND_LO, X86_UINT32_AND_HI, X86_UINT32_OR_LO, X86_UINT32_OR_HI, X86_UINT32_OR_AND_LO and X86_UINT32_OR_AND_HI instead of X86_ISA_1_USED, X86_ISA_1_NEEDED and X86_FEATURE_1_AND. * testsuite/binutils-all/i386/pr21231b.s: Updated to the current GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED values. * testsuite/binutils-all/x86-64/pr21231b.s: Likewise. * testsuite/binutils-all/x86-64/pr23494a.s: Likewise. * testsuite/binutils-all/x86-64/pr23494b.s: Likewise. * testsuite/binutils-all/x86-64/pr23494c.s: Likewise. * testsuite/binutils-all/i386/pr21231b.d: Updated. * testsuite/binutils-all/x86-64/pr21231b.d: Likewise. * testsuite/binutils-all/x86-64/pr23494a-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494a.d: Likewise. * testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494c.d: Likewise. * testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494d.d: Likewise. * testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494e.d: Likewise. include/ * elf/common.h (GNU_PROPERTY_X86_ISA_1_USED): Renamed to ... (GNU_PROPERTY_X86_COMPAT_ISA_1_USED): This. (GNU_PROPERTY_X86_ISA_1_NEEDED): Renamed to ... (GNU_PROPERTY_X86_COMPAT_ISA_1_NEEDED): This. (GNU_PROPERTY_X86_ISA_1_XXX): Renamed to ... (GNU_PROPERTY_X86_COMPAT_ISA_1_XXX): This. (GNU_PROPERTY_X86_UINT32_AND_LO): New. (GNU_PROPERTY_X86_UINT32_AND_HI): Likewise. (GNU_PROPERTY_X86_UINT32_OR_LO): Likewise. (GNU_PROPERTY_X86_UINT32_OR_HI): Likewise. (GNU_PROPERTY_X86_UINT32_OR_AND_LO): Likewise. (GNU_PROPERTY_X86_UINT32_OR_AND_HI): Likewise. (GNU_PROPERTY_X86_ISA_1_CMOV): Likewise. (GNU_PROPERTY_X86_ISA_1_SSE): Likewise. (GNU_PROPERTY_X86_ISA_1_SSE2): Likewise. (GNU_PROPERTY_X86_ISA_1_SSE3): Likewise. (GNU_PROPERTY_X86_ISA_1_SSSE3): Likewise. (GNU_PROPERTY_X86_ISA_1_SSE4_1): Likewise. (GNU_PROPERTY_X86_ISA_1_SSE4_2): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX2): Likewise. (GNU_PROPERTY_X86_ISA_1_FMA): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512F): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512CD): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512ER): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512PF): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512VL): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512DQ): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512BW): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512_4FMAPS): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512_4VNNIW): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512_BITALG): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512_IFMA): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512_VBMI): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512_VBMI2): Likewise. (GNU_PROPERTY_X86_ISA_1_AVX512_VNNI): Likewise. (GNU_PROPERTY_X86_FEATURE_2_X86): Likewise. (GNU_PROPERTY_X86_FEATURE_2_X87): Likewise. (GNU_PROPERTY_X86_FEATURE_2_MMX): Likewise. (GNU_PROPERTY_X86_FEATURE_2_XMM): Likewise. (GNU_PROPERTY_X86_FEATURE_2_YMM): Likewise. (GNU_PROPERTY_X86_FEATURE_2_ZMM): Likewise. (GNU_PROPERTY_X86_FEATURE_2_FXSR): Likewise. (GNU_PROPERTY_X86_FEATURE_2_XSAVE): Likewise. (GNU_PROPERTY_X86_FEATURE_2_XSAVEOPT): Likewise. (GNU_PROPERTY_X86_FEATURE_2_XSAVEC): Likewise. (GNU_PROPERTY_X86_FEATURE_1_AND): Updated to (GNU_PROPERTY_X86_UINT32_AND_LO + 0). (GNU_PROPERTY_X86_ISA_1_NEEDED): Defined to (GNU_PROPERTY_X86_UINT32_OR_LO + 0). (GNU_PROPERTY_X86_FEATURE_2_NEEDED): New. Defined to (GNU_PROPERTY_X86_UINT32_OR_LO + 1). (GNU_PROPERTY_X86_ISA_1_USED): Defined to (GNU_PROPERTY_X86_UINT32_OR_AND_LO + 0). (GNU_PROPERTY_X86_FEATURE_2_USED): New. Defined to (GNU_PROPERTY_X86_UINT32_OR_AND_LO + 1). ld/ * testsuite/ld-i386/i386.exp: Run pr23372c, pr23372d, pr23486c and pr23486d. * testsuite/ld-i386/pr23372a.s: Update comments. * testsuite/ld-i386/pr23372b.s: Likewise. * testsuite/ld-i386/pr23372c.s: Likewise. * testsuite/ld-x86-64/pr23372a.s: Likewise. * testsuite/ld-x86-64/pr23372b.s: Likewise. * testsuite/ld-x86-64/pr23372c.s: Likewise. * testsuite/ld-x86-64/pr23486a.s: Likewise. * testsuite/ld-x86-64/pr23486b.s: Likewise. * testsuite/ld-i386/pr23372c.d: New file. * testsuite/ld-i386/pr23372d.d: Likewise. * testsuite/ld-i386/pr23486c.d: Likewise. * testsuite/ld-i386/pr23486d.d: Likewise. * testsuite/ld-x86-64/pr23372c-x32.d: Likewise. * testsuite/ld-x86-64/pr23372c.d: Likewise. * testsuite/ld-x86-64/pr23372d-x32.d: Likewise. * testsuite/ld-x86-64/pr23372d.d: Likewise. * testsuite/ld-x86-64/pr23372d.s: Likewise. * testsuite/ld-x86-64/pr23372e.s: Likewise. * testsuite/ld-x86-64/pr23372f.s: Likewise. * testsuite/ld-x86-64/pr23486c-x32.d: Likewise. * testsuite/ld-x86-64/pr23486c.d: Likewise. * testsuite/ld-x86-64/pr23486c.s: Likewise. * testsuite/ld-x86-64/pr23486d-x32.d: Likewise. * testsuite/ld-x86-64/pr23486d.d: Likewise. * testsuite/ld-x86-64/pr23486d.s: Likewise. * testsuite/ld-i386/property-3.r: Updated. * testsuite/ld-i386/property-4.r: Likewise. * testsuite/ld-i386/property-5.r: Likewise. * testsuite/ld-i386/property-x86-3.d: Likewise. * testsuite/ld-i386/property-x86-ibt3a.d: Likewise. * testsuite/ld-i386/property-x86-shstk3a.d: Likewise. * testsuite/ld-i386/property-x86-shstk3b.d: Likewise. * testsuite/ld-x86-64/property-3.r: Likewise. * testsuite/ld-x86-64/property-4.r: Likewise. * testsuite/ld-x86-64/property-5.r: Likewise. * testsuite/ld-x86-64/property-x86-3-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-3.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt3a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt3a.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt3b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt3b.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk3a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk3a.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk3b-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-shstk3b.d: Likewise. * testsuite/ld-i386/property-x86-1.S: Updated to the current GNU_PROPERTY_X86_ISA_1_USED and GNU_PROPERTY_X86_ISA_1_NEEDED values. * testsuite/ld-i386/property-x86-2.S: Likewise. * testsuite/ld-i386/property-x86-3.s: Likewise. * testsuite/ld-x86-64/property-x86-1.S: Likewise. * testsuite/ld-x86-64/property-x86-2.S: Likewise. * testsuite/ld-x86-64/property-x86-3.s: Likewise. * ld/testsuite/ld-x86-64/x86-64.exp: Run pr23372c, pr23372c-x32, pr23372d, pr23372d-x32, pr23486c, pr23486c-x32, pr23486d and pr23486d-x32.
2018-08-24x86: Add GNU_PROPERTY_X86_UINT32_VALIDH.J. Lu2-5/+19
The older linker treats .note.gnu.property section as a generic note and just concatenates all .note.gnu.property sections from the input to the output. On CET-enabled OS, the output of the older linker is marked as CET enabled, but in fact, it is not CET enabled and it crashes on CET-enabled machines. This patch defines GNU_PROPERTY_X86_UINT32_VALID. Linker is updated to set the GNU_PROPERTY_X86_UINT32_VALID bit in GNU property note for non-relocatable output to differentiate outputs from the older linker. bfd/ * elfxx-x86.c (_bfd_x86_elf_parse_gnu_properties): Mask out the GNU_PROPERTY_X86_UINT32_VALID bit. (_bfd_x86_elf_link_fixup_gnu_properties): Set the GNU_PROPERTY_X86_UINT32_VALID bit for non-relocatable output. binutils/ * readelf.c (print_gnu_property_note): Check the GNU_PROPERTY_X86_UINT32_VALID bit for invalid GNU property note. include/ * elf/common.h (GNU_PROPERTY_X86_UINT32_VALID): New.
2018-08-24Automatic date update in version.inGDB Administrator1-1/+1
2018-08-23Avoid problems with plugins being loaded multiple times.Zenith4232-14/+45
PR 23460 * plugin.c (struct plugin_list_entry): New structure. (plugin_list): New variable. (try_load_plugin): Place opened plugins on a list. Ensure that the refcount in the dynamic loader is kept at 1.
2018-08-24PowerPC64 "call lacks nop"Alan Modra2-2/+7
The "-fPIC" and "-mcmodel=small" parts of these messages isn't always true, so lets dispense with that and just report the type of stub causing trouble. * elf64-ppc.c (ppc64_elf_relocate_section): Revise "call lacks nop" error message.
2018-08-23Replace unworkable code in HPPA relocs handelr with an assertion.Nick Clifton2-27/+11
* elf64-hppa.c (elf_hppa_final_link_relocate): Replace unworkable code with an assertion.
2018-08-23Prevent illegal memory access when processing COFF auxillary symbol information.Nick Clifton2-4/+17
PR 23061 * coffgen.c (coff_pointerize_aux): Add table_end parameter. Use it to prevent walking off the end of the table. (coff_get_normalized_symtab): Pass internal_end pointer to coff_pointerize_aux.
2018-08-23Fix "unresolved reloc" error for NOTOC relocsAlan Modra2-3/+7
* elf64-ppc.c (ppc64_elf_relocate_section): Don't miss clearing unresolved_reloc on ppc_stub_plt_call_notoc.
2018-08-23Automatic date update in version.inGDB Administrator1-1/+1
2018-08-22bfd/development.sh: Add experimentalH.J. Lu2-0/+8
Add experimental to indicate whether this is a release branch. PR ld/23536 * development.sh (experimental): New.
2018-08-22Use the correct constants when setting the section type of HPPA unwind sections.Helge Deller2-3/+16
* elf-hppa.h (elf_hppa_fake_sections): Use SHT_PARISC_UNWIND as the section type of the .PARISC.unwind section on 64-bit binaries and SHT_PROGBITS for 32-bit binaries. Add a comment about it. Add comment about the sh_entsize value.
2018-08-22Fix AArch64 stub layout algorithm to allow for the fact that section layut ↵Rafeal Auler2-0/+9
might change a stub's target location. PR 23560 * elfnn-aarch64.c (elfNN_aarch64_size_stubs): Always update the stub's target, since it may have been changed after the layout.
2018-08-22Fix changelog entriesAlan Modra1-2/+2
2018-08-22Automatic date update in version.inGDB Administrator1-1/+1
2018-08-21S12Z: Rename reloc R_S12Z_UKNWN_3 to R_S12Z_EXT18 and implement according to ↵John Darrington2-9/+46
recently inferred information about this reloc. * bfd/elf32-s12z.c: (opru18_reloc): New function. * bfd/elf32-s12z.c: (elf_s12z_howto_table): Adjust Howto according to new knowledge. * include/elf/s12z.h: Rename R_S12Z_UKNWN_3 to R_S12Z_EXT18.
2018-08-21Fix running objcopy on Mach-O binaries.mephi422-3/+12
PR binutils/23315 * mach-o.c (bfd_mach_o_mangle_symbols): Update n_type even if data is already considered filled.
2018-08-21PowerPC HOWTOsAlan Modra3-3071/+515
These take up far too many lines in the files. This patch introduces a replacement for the HOWTO macro that simplifies the relow howto initialization. Apart from the two relocs mentioned in the ChangeLog, no relocation howto is changed. * elf64-ppc.c (HOW): Define. (ONES): Delete. (ppc64_elf_howto_raw): Use HOW to initialize entries. * elf32-ppc.c (HOW): Define. (ppc_elf_howto_raw): Use HOW to initialize entries, updating R_PPC_VLE_REL15 and R_PPC_VLE_REL24 to use bitpos=0.
2018-08-21Pack reloc_howto_structAlan Modra8-131/+138
This patch uses bitfields in reloc_howto_struct, reducing its size from 80 to 40 bytes on 64-bit hosts and from 52 to 32 bytes on 32-bit hosts (with a 32-bit bfd_vma). I've also added a new "negate" field rather than making the encoded "size" field do double duty as both a size and a flag. There was just one use of an encoded size of 8, which according to bfd_get_reloc_size meant 16 bytes, in vms-alpha.c ALPHA_R_LINKAGE. See git commit c3d8e071bf adding ALPHA_R_LINKAGE and git commit 8612a388f7 decoding size 8 in bfd_get_reloc_size. Since no other part of BFD handles 16 byte relocs, I've removed that encoding and special cased the ALPHA_R_LINKAGE size in vms-alpha.c. * reloc.c (reloc_howto_type): Typedef. (bfd_symbol): Delete forward declaration. (struct reloc_howto_struct): Add "negate" field. Make "size", "bitsize", "rightshift", "bitpos", "complain_on_overflow", "pc_relative", "partial_inplace", and "pcrel_offset" bitfields. Rearrange for better packing. Revise comments. (HOWTO): Map to rearranged reloc_howto_struct. (bfd_get_reloc_size): Delete now unused cases. (read_reloc, write_reloc): Likewise. (apply_reloc, _bfd_relocate_contents): Test howto->negate rather than howto->size < 0 for negated relocation values. * coff-rs6000.c (xcoff_complain_overflow_bitfield_func): Avoid signed/unsigned warning. (xcoff_ppc_relocate_section): Delete "condition is always false" code. * coff64-rs6000.c (xcoff64_ppc_relocate_section): Likewise. * cpu-ns32k.c (do_ns32k_reloc): Adjust to suit reloc_howto_struct changes. * vms-alpha.c (_bfd_vms_write_etir, alpha_vms_slurp_relocs): Use size 16 for ALPHA_R_LINKAGE. (alpha_howto_table <ALPHA_R_LINKAGE>): Set encoded size and bitsize to zero. * bfd-in.h (reloc_howto_type): Delete. * bfd-in2.h: Regenerate.
2018-08-21Delete NEWHOWTO and tidy some uses of reloc_howto_structAlan Modra8-544/+271
NEWHOWTO was promised way back in 1991 (git commit e5683622186). I doubt it's ever going to be implemented. This patch removes it, and tidies some reloc howtos. I was going to make some changes to reloc_howto_struct, so I think it's important that all relocs howtos are initialized with HOWTO. * reloc.c (HOWTO): Revise comment. (NEWHOWTO, HOWTO_PREPARE): Delete. * coff-arm.c (coff_arm_reloc_type_lookup): Replace const struc reloc_howto_struct with reloc_howto_type. * ns32knetbsd.c (MY_bfd_reloc_type_lookup): Likewise. * vms-alpha.c (alpha_vms_bfd_reloc_type_lookup): Likewise. * elf-hppa.h (HOW): Define. (elf_hppa_howto_table): Use it to simplify this table, correcting name of R_PARISC_LTOFF16WF, R_PARISC_LTOFF_FPTR64, and R_PARISC_LTOFF_FPTR16DF. * elf32-mep.c (MEPREL): Use HOWTO. * bfd-in2.h: Regenerate.
2018-08-21Automatic date update in version.inGDB Administrator1-1/+1
2018-08-20Don't init array at run timeAlan Modra2-27/+30
When it can be done at compile time. * mmo.c (valid_mmo_symbol_character_set): Initialize and make array const. (mmo_init): Don't init valid_mmo_symbol_character_set.
2018-08-20Balance parentheses in expressionAlan Modra2-2/+6
* rs6000-core.c (CORE_COMMONSZ): Balance parentheses in expression.
2018-08-20Automatic date update in version.inGDB Administrator1-1/+1
2018-08-19Automatic date update in version.inGDB Administrator1-1/+1
2018-08-18Automatic date update in version.inGDB Administrator1-1/+1
2018-08-17x86: Remove empty X86_FEATURE_1_AND propertyH.J. Lu6-0/+68
There is no need to generate .note.gnu.property section with empty X86_FEATURE_1_AND property. This patch adds fixup_gnu_properties to ELF linker backend so that x86 backend can remove it. bfd/ PR ld/23515 * elf-bfd.h (elf_backend_data): Add fixup_gnu_properties. * elf-properties.c (_bfd_elf_link_setup_gnu_properties): Call backend fixup_gnu_properties if it isn't NULL. Discard .note.gnu.property section if all properties have been removed. * elfxx-target.h (elf_backend_fixup_gnu_properties): New. (elfNN_bed): Initialize fixup_gnu_properties. * elfxx-x86.c (_bfd_x86_elf_link_fixup_gnu_properties): New function. * elfxx-x86.h (_bfd_x86_elf_link_fixup_gnu_properties): New prototype. (elf_backend_fixup_gnu_properties): New. ld/ PR ld/23515 * testsuite/ld-i386/ibt-plt-2a.d: Updated. * testsuite/ld-i386/ibt-plt-2b.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2a-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2a.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2b-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2b.d: Likewise.
2018-08-16Correct elf64-ppc.c linkage stub comment and formatting fixesAlan Modra2-77/+94
ppc_stub_long_branch_notoc will never need more than a 32-bit offset for the r12 offset since the stub target must be in range of a branch instruction. * elf64-ppc.c: Correct ppc_stub_long_branch_notoc example. Formatting.
2018-08-16Automatic date update in version.inGDB Administrator1-1/+1
2018-08-15Automatic date update in version.inGDB Administrator1-1/+1
2018-08-14Automatic date update in version.inGDB Administrator1-1/+1
2018-08-13bfd: Move elf-properties.lo to BFD32_LIBSH.J. Lu5-22/+30
commit 6404ab993797d1d6cd3d9e97cc281e3cb6226c12 Author: H.J. Lu <hjl.tools@gmail.com> Date: Wed Aug 8 21:00:04 2018 -0700 Convert .note.gnu.property section between ELF32 and ELF64 updated bfd_convert_section_size and bfd_convert_section_contents in bfd.c to call _bfd_elf_convert_gnu_property_size and _bfd_elf_convert_gnu_properties, which are defined in elf-properties.c. It led to bfd.c:2484: undefined reference to `_bfd_elf_convert_gnu_property_size' for non-ELF targets. Since elf-properties.c is a generic implementation and doesn't reference any ELF specific functions directly, this patch moves elf-properties.lo BFD32_LIBS. Tested for many ELF and non-ELF targets. PR binutils/23494 * Makefile.am (BFD32_LIBS): Add elf-properties.lo. (BFD32_LIBS_CFILES): Add elf-properties.c. (BFD32_BACKENDS): Remove elf-properties.lo. (BFD32_BACKENDS_CFILES): Remove elf-properties.c. * configure.ac (elf): Remove elf-properties.lo. * Makefile.in: Regenerated. * configure: Likewise.
2018-08-13Automatic date update in version.inGDB Administrator1-1/+1
2018-08-12Automatic date update in version.inGDB Administrator1-1/+1
2018-08-11x86: Properly add X86_ISA_1_NEEDED propertyH.J. Lu2-6/+29
Existing properties may be removed during property merging. We avoid adding X86_ISA_1_NEEDED property only if existing properties won't be removed. bfd/ PR ld/23428 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Don't add X86_ISA_1_NEEDED property only if existing properties won't be removed. ld/ PR ld/23428 * testsuite/ld-elf/dummy.s: New file. * testsuite/ld-elf/linux-x86.S: Add X86_FEATURE_1_AND property. * testsuite/ld-elf/linux-x86.exp: Add dummy.s to pr23428.
2018-08-11Factor out common relocation processingAlan Modra2-244/+116
This patch factors out some code common to both bfd_perform_relocation and bfd_install_relocation, in the process fixing the omission of "case -1" in bfd_install_relocation. * reloc.c (bfd_get_reloc_size): Sort switch. (read_reloc, write_reloc, apply_reloc): New functions. (bfd_perform_relocation, bfd_install_relocation): Use apply_reloc. (_bfd_relocate_contents): Use read_reloc and write_reloc. (_bfd_clear_contents): Likewise.
2018-08-11Deal with relocations which are 3 bytes in sizeJohn Darrington2-4/+28
* reloc.c (_bfd_relocate_contents): Handle 3 byte relocs. (_bfd_clear_contents): Likewise. (bfd_perform_relocation): Likewise. (bfd_install_relocation): Likewise.
2018-08-11Automatic date update in version.inGDB Administrator1-1/+1
2018-08-10Always clear h->verinfo.verdef when overriding a dynamic definitionH.J. Lu2-7/+11
When linker defines a symbol to override a dynamic definition, it should always clear h->verinfo.verdef so that the symbol won't be associated with the version information from the dynamic object. This happened to the symbol "_edata" when creating an unversioned dynamic object linking against: 1. libKF5ConfigCore.so.5.49.0 2. libKF5CoreAddons.so.5.49.0 3. libKF5I18n.so.5.49.0 4. libKF5DBusAddons.so.5.49.0 5. libQt5Xml.so.5.11.1 6. libQt5DBus.so.5.11.1 7. libQt5Core.so.5.11.1 Among them libQt5Xml.so.5.11.1 299: 000000000003e000 0 NOTYPE GLOBAL DEFAULT 18 _edata@@Qt_5 libQt5DBus.so.5.11.1 597: 0000000000092018 0 NOTYPE GLOBAL DEFAULT 18 _edata@@Qt_5 libQt5Core.so.5.11.1 2292: 00000000004df640 0 NOTYPE GLOBAL DEFAULT 21 _edata@Qt_5 2293: 00000000004df640 0 NOTYPE GLOBAL DEFAULT 21 _edata@Qt_5 The problem is triggered by 2 duplicated entries of _edata@Qt_5 in libQt5Core.so.5.11.1 which was created by gold. Before this commit, ld created the dynamic object with "_edata" in its dynamic symbol table which was linker defined and associated with the version information from libQt5Core.so.5.11.1. The code in question was there when the binutils source was imported to sourceware.org. When such a dynamic object was used later, we got: /usr/bin/ld: bin/libKF5Service.so.5.49.0: _edata: invalid version 21 (max 0) /usr/bin/ld: bin/libKF5Service.so.5.49.0: error adding symbols: bad value Tested with many ELF targets. PR ld/23499 * elflink.c (bfd_elf_record_link_assignment): Always clear h->verinfo.verdef when overriding a dynamic definition.
2018-08-10Always use align_size as pr_datasz for GNU_PROPERTY_STACK_SIZEH.J. Lu2-7/+22
For GNU_PROPERTY_STACK_SIZE, pr_datasz is the same as align_size, which is 8 bytes for 64-bit ELF binaries and 4 bytes for 32-bit ELF binaries, Use align_size as pr_datasz for GNU_PROPERTY_STACK_SIZE to convert .note.gnu.property section. bfd/ PR binutils/23494 * elf-properties.c (elf_get_gnu_property_section_size): Always use align_size as pr_datasz for GNU_PROPERTY_STACK_SIZE. (elf_write_gnu_properties): Likewise. binutils/ PR binutils/23494 * testsuite/binutils-all/x86-64/pr23494c.s: New file. * testsuite/binutils-all/x86-64/pr23494e-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494e.d: Likewise.
2018-08-10Automatic date update in version.inGDB Administrator1-1/+1
2018-08-08Convert .note.gnu.property section between ELF32 and ELF64H.J. Lu4-75/+188
.note.gnu.property section has different alignments and section sizes for 32-bit and 64-bit ELF binaries. This patch updated bfd_convert_section_size and bfd_convert_section_contents to properly convert .note.gnu.property section between 32-bit and 64-bit ELF binaries. bfd/ PR binutils/23494 * bfd.c (bfd_convert_section_size): Check BFD_DECOMPRESS after calling _bfd_elf_convert_gnu_property_size to convert .note.gnu.property section size. (bfd_convert_section_contents): Check BFD_DECOMPRESS after calling _bfd_elf_convert_gnu_properties to convert .note.gnu.property section. * elf-bfd.h (_bfd_elf_convert_gnu_property_size): New prototype. (_bfd_elf_convert_gnu_properties): Likewise. * elf-properties.c (elf_get_gnu_property_section_size): New function. (elf_write_gnu_properties): Likewise. (_bfd_elf_convert_gnu_property_size): Likewise. (_bfd_elf_convert_gnu_properties): Likewise. (_bfd_elf_link_setup_gnu_properties): Use elf_get_gnu_property_section_size and elf_write_gnu_properties. binutils/ PR binutils/23494 * testsuite/binutils-all/x86-64/pr23494a-x32.d: New file. * testsuite/binutils-all/x86-64/pr23494a.d: Likewise. * testsuite/binutils-all/x86-64/pr23494a.s: Likewise. * testsuite/binutils-all/x86-64/pr23494b-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494b.d: Likewise. * testsuite/binutils-all/x86-64/pr23494b.s: Likewise. * testsuite/binutils-all/x86-64/pr23494c-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494c.d: Likewise. * testsuite/binutils-all/x86-64/pr23494d-x32.d: Likewise. * testsuite/binutils-all/x86-64/pr23494d.d: Likewise.
2018-08-09Automatic date update in version.inGDB Administrator1-1/+1