X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=bfd%2Freloc.c;h=5098e0ab09f087256a8a23cef148175fc2f15bfa;hb=a55939ca586b81c16cc95fa692a7862551cc6773;hp=353a2404771b0f16e68d7f0ace2c5693dfdedcac;hpb=1c4f3780f7d939402cfe555007ebff45c8e38951;p=binutils-gdb.git diff --git a/bfd/reloc.c b/bfd/reloc.c index 353a2404771..5098e0ab09f 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -1,5 +1,5 @@ /* BFD support for handling relocation entries. - Copyright (C) 1990-2018 Free Software Foundation, Inc. + Copyright (C) 1990-2022 Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -51,6 +51,7 @@ SECTION #include "bfdlink.h" #include "libbfd.h" #include "bfdver.h" + /* DOCDD INODE @@ -361,7 +362,7 @@ CODE_FRAGMENT . bfd *, char **); . . {* The textual name of the relocation type. *} -. char *name; +. const char *name; .}; . */ @@ -383,8 +384,8 @@ DESCRIPTION This is used to fill in an empty howto entry in an array. .#define EMPTY_HOWTO(C) \ -. HOWTO ((C), 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, \ -. NULL, FALSE, 0, 0, FALSE) +. HOWTO ((C), 0, 0, 0, false, 0, complain_overflow_dont, NULL, \ +. NULL, false, 0, 0, false) . */ @@ -432,8 +433,9 @@ DESCRIPTION . */ -/* N_ONES produces N one bits, without overflowing machine arithmetic. */ -#define N_ONES(n) (((((bfd_vma) 1 << ((n) - 1)) - 1) << 1) | 1) +/* N_ONES produces N one bits, without undefined behaviour for N + between zero and the number of bits in a bfd_vma. */ +#define N_ONES(n) ((n) == 0 ? 0 : ((bfd_vma) 1 << ((n) - 1) << 1) - 1) /* FUNCTION @@ -466,6 +468,9 @@ bfd_check_overflow (enum complain_overflow how, bfd_vma fieldmask, addrmask, signmask, ss, a; bfd_reloc_status_type flag = bfd_reloc_ok; + if (bitsize == 0) + return flag; + /* Note: BITSIZE should always be <= ADDRSIZE, but in case it's not, we'll be permissive: extra bits in the field mask will automatically extend the address mask for purposes of the @@ -515,7 +520,7 @@ FUNCTION bfd_reloc_offset_in_range SYNOPSIS - bfd_boolean bfd_reloc_offset_in_range + bool bfd_reloc_offset_in_range (reloc_howto_type *howto, bfd *abfd, asection *section, @@ -530,7 +535,7 @@ DESCRIPTION /* HOWTO describes a relocation, at offset OCTET. Return whether the relocation field is within SECTION of ABFD. */ -bfd_boolean +bool bfd_reloc_offset_in_range (reloc_howto_type *howto, bfd *abfd, asection *section, @@ -542,7 +547,7 @@ bfd_reloc_offset_in_range (reloc_howto_type *howto, /* The reloc field must be contained entirely within the section. Allow zero length fields (marker relocs or NONE relocs where no relocation will be performed) at the end of the section. */ - return octet <= octet_end && octet + reloc_size <= octet_end; + return octet <= octet_end && reloc_size <= octet_end - octet; } /* Read and return the section contents at DATA converted to a host @@ -722,7 +727,7 @@ bfd_perform_relocation (bfd *abfd, return bfd_reloc_undefined; /* Is the address of the relocation really within the section? */ - octets = reloc_entry->address * bfd_octets_per_byte (abfd); + octets = reloc_entry->address * bfd_octets_per_byte (abfd, input_section); if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets)) return bfd_reloc_outofrange; @@ -744,7 +749,14 @@ bfd_perform_relocation (bfd *abfd, else output_base = reloc_target_output_section->vma; - relocation += output_base + symbol->section->output_offset; + output_base += symbol->section->output_offset; + + /* If symbol addresses are in octets, convert to bytes. */ + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour + && (symbol->section->flags & SEC_ELF_OCTETS)) + output_base *= bfd_octets_per_byte (abfd, input_section); + + relocation += output_base; /* Add in supplied addend. */ relocation += reloc_entry->addend; @@ -1052,7 +1064,7 @@ bfd_install_relocation (bfd *abfd, it will have been checked in `bfd_perform_relocation already'. */ /* Is the address of the relocation really within the section? */ - octets = reloc_entry->address * bfd_octets_per_byte (abfd); + octets = reloc_entry->address * bfd_octets_per_byte (abfd, input_section); if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets)) return bfd_reloc_outofrange; @@ -1073,7 +1085,14 @@ bfd_install_relocation (bfd *abfd, else output_base = reloc_target_output_section->vma; - relocation += output_base + symbol->section->output_offset; + output_base += symbol->section->output_offset; + + /* If symbol addresses are in octets, convert to bytes. */ + if (bfd_get_flavour (abfd) == bfd_target_elf_flavour + && (symbol->section->flags & SEC_ELF_OCTETS)) + output_base *= bfd_octets_per_byte (abfd, input_section); + + relocation += output_base; /* Add in supplied addend. */ relocation += reloc_entry->addend; @@ -1337,7 +1356,8 @@ _bfd_final_link_relocate (reloc_howto_type *howto, bfd_vma addend) { bfd_vma relocation; - bfd_size_type octets = address * bfd_octets_per_byte (input_bfd); + bfd_size_type octets = (address + * bfd_octets_per_byte (input_bfd, input_section)); /* Sanity check the address. */ if (!bfd_reloc_offset_in_range (howto, input_bfd, input_section, octets)) @@ -1368,8 +1388,7 @@ _bfd_final_link_relocate (reloc_howto_type *howto, } return _bfd_relocate_contents (howto, input_bfd, relocation, - contents - + address * bfd_octets_per_byte (input_bfd)); + contents + octets); } /* Relocate a given location using a given value and howto. */ @@ -1504,15 +1523,21 @@ _bfd_relocate_contents (reloc_howto_type *howto, relocations against discarded symbols, to make ignorable debug or unwind information more obvious. */ -void +bfd_reloc_status_type _bfd_clear_contents (reloc_howto_type *howto, bfd *input_bfd, asection *input_section, - bfd_byte *location) + bfd_byte *buf, + bfd_vma off) { bfd_vma x; + bfd_byte *location; + + if (!bfd_reloc_offset_in_range (howto, input_bfd, input_section, off)) + return bfd_reloc_outofrange; /* Get the value we are going to relocate. */ + location = buf + off; x = read_reloc (input_bfd, location, howto); /* Zero out the unwanted bits of X. */ @@ -1520,13 +1545,13 @@ _bfd_clear_contents (reloc_howto_type *howto, /* For a range list, use 1 instead of 0 as placeholder. 0 would terminate the list, hiding any later entries. */ - if (strcmp (bfd_get_section_name (input_bfd, input_section), - ".debug_ranges") == 0 + if (strcmp (bfd_section_name (input_section), ".debug_ranges") == 0 && (howto->dst_mask & 1) != 0) x |= 1; /* Put the relocated value back in the object file. */ write_reloc (input_bfd, x, location, howto); + return bfd_reloc_ok; } /* @@ -1596,6 +1621,8 @@ the section containing the relocation. It depends on the specific target. ENUM BFD_RELOC_32_SECREL +ENUMX + BFD_RELOC_16_SECIDX ENUMDOC Section relative relocations. Some targets need this for DWARF2. @@ -2711,6 +2738,10 @@ ENUMX BFD_RELOC_PPC_BA26 ENUMX BFD_RELOC_PPC_TOC16 +ENUMX + BFD_RELOC_PPC_TOC16_LO +ENUMX + BFD_RELOC_PPC_TOC16_HI ENUMX BFD_RELOC_PPC_B16 ENUMX @@ -2803,6 +2834,8 @@ ENUMX BFD_RELOC_PPC_16DX_HA ENUMX BFD_RELOC_PPC_REL16DX_HA +ENUMX + BFD_RELOC_PPC_NEG ENUMX BFD_RELOC_PPC64_HIGHER ENUMX @@ -2871,6 +2904,42 @@ ENUMX BFD_RELOC_PPC64_ENTRY ENUMX BFD_RELOC_PPC64_REL24_NOTOC +ENUMX + BFD_RELOC_PPC64_REL24_P9NOTOC +ENUMX + BFD_RELOC_PPC64_D34 +ENUMX + BFD_RELOC_PPC64_D34_LO +ENUMX + BFD_RELOC_PPC64_D34_HI30 +ENUMX + BFD_RELOC_PPC64_D34_HA30 +ENUMX + BFD_RELOC_PPC64_PCREL34 +ENUMX + BFD_RELOC_PPC64_GOT_PCREL34 +ENUMX + BFD_RELOC_PPC64_PLT_PCREL34 +ENUMX + BFD_RELOC_PPC64_ADDR16_HIGHER34 +ENUMX + BFD_RELOC_PPC64_ADDR16_HIGHERA34 +ENUMX + BFD_RELOC_PPC64_ADDR16_HIGHEST34 +ENUMX + BFD_RELOC_PPC64_ADDR16_HIGHESTA34 +ENUMX + BFD_RELOC_PPC64_REL16_HIGHER34 +ENUMX + BFD_RELOC_PPC64_REL16_HIGHERA34 +ENUMX + BFD_RELOC_PPC64_REL16_HIGHEST34 +ENUMX + BFD_RELOC_PPC64_REL16_HIGHESTA34 +ENUMX + BFD_RELOC_PPC64_D28 +ENUMX + BFD_RELOC_PPC64_PCREL28 ENUMDOC Power(rs6000) and PowerPC relocations. @@ -2880,6 +2949,14 @@ ENUMX BFD_RELOC_PPC_TLSGD ENUMX BFD_RELOC_PPC_TLSLD +ENUMX + BFD_RELOC_PPC_TLSLE +ENUMX + BFD_RELOC_PPC_TLSIE +ENUMX + BFD_RELOC_PPC_TLSM +ENUMX + BFD_RELOC_PPC_TLSML ENUMX BFD_RELOC_PPC_DTPMOD ENUMX @@ -2934,10 +3011,26 @@ ENUMX BFD_RELOC_PPC_GOT_DTPREL16_HI ENUMX BFD_RELOC_PPC_GOT_DTPREL16_HA +ENUMX + BFD_RELOC_PPC64_TLSGD +ENUMX + BFD_RELOC_PPC64_TLSLD +ENUMX + BFD_RELOC_PPC64_TLSLE +ENUMX + BFD_RELOC_PPC64_TLSIE +ENUMX + BFD_RELOC_PPC64_TLSM +ENUMX + BFD_RELOC_PPC64_TLSML ENUMX BFD_RELOC_PPC64_TPREL16_DS ENUMX BFD_RELOC_PPC64_TPREL16_LO_DS +ENUMX + BFD_RELOC_PPC64_TPREL16_HIGH +ENUMX + BFD_RELOC_PPC64_TPREL16_HIGHA ENUMX BFD_RELOC_PPC64_TPREL16_HIGHER ENUMX @@ -2950,6 +3043,10 @@ ENUMX BFD_RELOC_PPC64_DTPREL16_DS ENUMX BFD_RELOC_PPC64_DTPREL16_LO_DS +ENUMX + BFD_RELOC_PPC64_DTPREL16_HIGH +ENUMX + BFD_RELOC_PPC64_DTPREL16_HIGHA ENUMX BFD_RELOC_PPC64_DTPREL16_HIGHER ENUMX @@ -2959,13 +3056,19 @@ ENUMX ENUMX BFD_RELOC_PPC64_DTPREL16_HIGHESTA ENUMX - BFD_RELOC_PPC64_TPREL16_HIGH + BFD_RELOC_PPC64_TPREL34 ENUMX - BFD_RELOC_PPC64_TPREL16_HIGHA + BFD_RELOC_PPC64_DTPREL34 ENUMX - BFD_RELOC_PPC64_DTPREL16_HIGH + BFD_RELOC_PPC64_GOT_TLSGD_PCREL34 ENUMX - BFD_RELOC_PPC64_DTPREL16_HIGHA + BFD_RELOC_PPC64_GOT_TLSLD_PCREL34 +ENUMX + BFD_RELOC_PPC64_GOT_TPREL_PCREL34 +ENUMX + BFD_RELOC_PPC64_GOT_DTPREL_PCREL34 +ENUMX + BFD_RELOC_PPC64_TLS_PCREL ENUMDOC PowerPC and PowerPC64 thread-local storage relocations. @@ -3007,6 +3110,36 @@ ENUM ENUMDOC ARM 26-bit pc-relative branch for B or conditional BL instruction. +ENUM + BFD_RELOC_THUMB_PCREL_BRANCH5 +ENUMDOC + ARM 5-bit pc-relative branch for Branch Future instructions. + +ENUM + BFD_RELOC_THUMB_PCREL_BFCSEL +ENUMDOC + ARM 6-bit pc-relative branch for BFCSEL instruction. + +ENUM + BFD_RELOC_ARM_THUMB_BF17 +ENUMDOC + ARM 17-bit pc-relative branch for Branch Future instructions. + +ENUM + BFD_RELOC_ARM_THUMB_BF13 +ENUMDOC + ARM 13-bit pc-relative branch for BFCSEL instruction. + +ENUM + BFD_RELOC_ARM_THUMB_BF19 +ENUMDOC + ARM 19-bit pc-relative branch for Branch Future Link instruction. + +ENUM + BFD_RELOC_ARM_THUMB_LOOP12 +ENUMDOC + ARM 12-bit pc-relative branch for Low Overhead Loop instructions. + ENUM BFD_RELOC_THUMB_PCREL_BRANCH7 ENUMX @@ -3255,6 +3388,8 @@ ENUMX BFD_RELOC_ARM_T32_CP_OFF_IMM ENUMX BFD_RELOC_ARM_T32_CP_OFF_IMM_S2 +ENUMX + BFD_RELOC_ARM_T32_VLDR_VSTR_OFF_IMM ENUMX BFD_RELOC_ARM_ADR_IMM ENUMX @@ -5859,88 +5994,6 @@ ENUMDOC Freescale S12Z reloc. This is a 15 bit relative address. If the most significant bits are all zero then it may be truncated to 8 bits. -ENUM - BFD_RELOC_16C_NUM08 -ENUMX - BFD_RELOC_16C_NUM08_C -ENUMX - BFD_RELOC_16C_NUM16 -ENUMX - BFD_RELOC_16C_NUM16_C -ENUMX - BFD_RELOC_16C_NUM32 -ENUMX - BFD_RELOC_16C_NUM32_C -ENUMX - BFD_RELOC_16C_DISP04 -ENUMX - BFD_RELOC_16C_DISP04_C -ENUMX - BFD_RELOC_16C_DISP08 -ENUMX - BFD_RELOC_16C_DISP08_C -ENUMX - BFD_RELOC_16C_DISP16 -ENUMX - BFD_RELOC_16C_DISP16_C -ENUMX - BFD_RELOC_16C_DISP24 -ENUMX - BFD_RELOC_16C_DISP24_C -ENUMX - BFD_RELOC_16C_DISP24a -ENUMX - BFD_RELOC_16C_DISP24a_C -ENUMX - BFD_RELOC_16C_REG04 -ENUMX - BFD_RELOC_16C_REG04_C -ENUMX - BFD_RELOC_16C_REG04a -ENUMX - BFD_RELOC_16C_REG04a_C -ENUMX - BFD_RELOC_16C_REG14 -ENUMX - BFD_RELOC_16C_REG14_C -ENUMX - BFD_RELOC_16C_REG16 -ENUMX - BFD_RELOC_16C_REG16_C -ENUMX - BFD_RELOC_16C_REG20 -ENUMX - BFD_RELOC_16C_REG20_C -ENUMX - BFD_RELOC_16C_ABS20 -ENUMX - BFD_RELOC_16C_ABS20_C -ENUMX - BFD_RELOC_16C_ABS24 -ENUMX - BFD_RELOC_16C_ABS24_C -ENUMX - BFD_RELOC_16C_IMM04 -ENUMX - BFD_RELOC_16C_IMM04_C -ENUMX - BFD_RELOC_16C_IMM16 -ENUMX - BFD_RELOC_16C_IMM16_C -ENUMX - BFD_RELOC_16C_IMM20 -ENUMX - BFD_RELOC_16C_IMM20_C -ENUMX - BFD_RELOC_16C_IMM24 -ENUMX - BFD_RELOC_16C_IMM24_C -ENUMX - BFD_RELOC_16C_IMM32 -ENUMX - BFD_RELOC_16C_IMM32_C -ENUMDOC - NS CR16C Relocations. ENUM BFD_RELOC_CR16_NUM8 @@ -6147,14 +6200,28 @@ ENUM BFD_RELOC_OR1K_REL_26 ENUMX BFD_RELOC_OR1K_SLO16 +ENUMX + BFD_RELOC_OR1K_PCREL_PG21 +ENUMX + BFD_RELOC_OR1K_LO13 +ENUMX + BFD_RELOC_OR1K_SLO13 ENUMX BFD_RELOC_OR1K_GOTPC_HI16 ENUMX BFD_RELOC_OR1K_GOTPC_LO16 +ENUMX + BFD_RELOC_OR1K_GOT_AHI16 ENUMX BFD_RELOC_OR1K_GOT16 +ENUMX + BFD_RELOC_OR1K_GOT_PG21 +ENUMX + BFD_RELOC_OR1K_GOT_LO13 ENUMX BFD_RELOC_OR1K_PLT26 +ENUMX + BFD_RELOC_OR1K_PLTA26 ENUMX BFD_RELOC_OR1K_GOTOFF_SLO16 ENUMX @@ -6169,10 +6236,18 @@ ENUMX BFD_RELOC_OR1K_TLS_GD_HI16 ENUMX BFD_RELOC_OR1K_TLS_GD_LO16 +ENUMX + BFD_RELOC_OR1K_TLS_GD_PG21 +ENUMX + BFD_RELOC_OR1K_TLS_GD_LO13 ENUMX BFD_RELOC_OR1K_TLS_LDM_HI16 ENUMX BFD_RELOC_OR1K_TLS_LDM_LO16 +ENUMX + BFD_RELOC_OR1K_TLS_LDM_PG21 +ENUMX + BFD_RELOC_OR1K_TLS_LDM_LO13 ENUMX BFD_RELOC_OR1K_TLS_LDO_HI16 ENUMX @@ -6183,6 +6258,10 @@ ENUMX BFD_RELOC_OR1K_TLS_IE_AHI16 ENUMX BFD_RELOC_OR1K_TLS_IE_LO16 +ENUMX + BFD_RELOC_OR1K_TLS_IE_PG21 +ENUMX + BFD_RELOC_OR1K_TLS_IE_LO13 ENUMX BFD_RELOC_OR1K_TLS_LE_HI16 ENUMX @@ -6321,6 +6400,11 @@ ENUMX BFD_RELOC_MSP430_PREL31 ENUMX BFD_RELOC_MSP430_SYM_DIFF +ENUMX + BFD_RELOC_MSP430_SET_ULEB128 +ENUMX + BFD_RELOC_MSP430_SUB_ULEB128 + ENUMDOC msp430 specific relocation codes @@ -6514,6 +6598,8 @@ ENUMX ENUMX BFD_RELOC_XTENSA_DIFF32 ENUMDOC + Xtensa relocations for backward compatibility. These have been replaced + by BFD_RELOC_XTENSA_PDIFF and BFD_RELOC_XTENSA_NDIFF. Xtensa relocations to mark the difference of two local symbols. These are only needed to support linker relaxation and can be ignored when not relaxing. The field is set to the value of the difference @@ -6626,11 +6712,61 @@ ENUMX BFD_RELOC_XTENSA_TLS_CALL ENUMDOC Xtensa TLS relocations. +ENUM + BFD_RELOC_XTENSA_PDIFF8 +ENUMX + BFD_RELOC_XTENSA_PDIFF16 +ENUMX + BFD_RELOC_XTENSA_PDIFF32 +ENUMX + BFD_RELOC_XTENSA_NDIFF8 +ENUMX + BFD_RELOC_XTENSA_NDIFF16 +ENUMX + BFD_RELOC_XTENSA_NDIFF32 +ENUMDOC + Xtensa relocations to mark the difference of two local symbols. + These are only needed to support linker relaxation and can be ignored + when not relaxing. The field is set to the value of the difference + assuming no relaxation. The relocation encodes the position of the + subtracted symbol so the linker can determine whether to adjust the field + value. PDIFF relocations are used for positive differences, NDIFF + relocations are used for negative differences. The difference value + is treated as unsigned with these relocation types, giving full + 8/16 value ranges. ENUM BFD_RELOC_Z80_DISP8 ENUMDOC 8 bit signed offset in (ix+d) or (iy+d). +ENUM + BFD_RELOC_Z80_BYTE0 +ENUMDOC + First 8 bits of multibyte (32, 24 or 16 bit) value. +ENUM + BFD_RELOC_Z80_BYTE1 +ENUMDOC + Second 8 bits of multibyte (32, 24 or 16 bit) value. +ENUM + BFD_RELOC_Z80_BYTE2 +ENUMDOC + Third 8 bits of multibyte (32 or 24 bit) value. +ENUM + BFD_RELOC_Z80_BYTE3 +ENUMDOC + Fourth 8 bits of multibyte (32 bit) value. +ENUM + BFD_RELOC_Z80_WORD0 +ENUMDOC + Lowest 16 bits of multibyte (32 or 24 bit) value. +ENUM + BFD_RELOC_Z80_WORD1 +ENUMDOC + Highest 16 bits of multibyte (32 or 24 bit) value. +ENUM + BFD_RELOC_Z80_16_BE +ENUMDOC + Like BFD_RELOC_16 but big-endian. ENUM BFD_RELOC_Z8K_DISP7 @@ -7819,6 +7955,19 @@ ENUMX ENUMDOC Tilera TILE-Gx Relocations. +ENUM + BFD_RELOC_BPF_64 +ENUMX + BFD_RELOC_BPF_32 +ENUMX + BFD_RELOC_BPF_16 +ENUMX + BFD_RELOC_BPF_DISP16 +ENUMX + BFD_RELOC_BPF_DISP32 +ENUMDOC + Linux eBPF relocations. + ENUM BFD_RELOC_EPIPHANY_SIMM8 ENUMDOC @@ -8021,6 +8170,100 @@ ENUMX ENUMDOC C-SKY relocations. +ENUM + BFD_RELOC_S12Z_OPR +ENUMDOC + S12Z relocations. + +ENUM + BFD_RELOC_LARCH_TLS_DTPMOD32 +ENUMX + BFD_RELOC_LARCH_TLS_DTPREL32 +ENUMX + BFD_RELOC_LARCH_TLS_DTPMOD64 +ENUMX + BFD_RELOC_LARCH_TLS_DTPREL64 +ENUMX + BFD_RELOC_LARCH_TLS_TPREL32 +ENUMX + BFD_RELOC_LARCH_TLS_TPREL64 +ENUMX + BFD_RELOC_LARCH_MARK_LA +ENUMX + BFD_RELOC_LARCH_MARK_PCREL +ENUMX + BFD_RELOC_LARCH_SOP_PUSH_PCREL +ENUMX + BFD_RELOC_LARCH_SOP_PUSH_ABSOLUTE +ENUMX + BFD_RELOC_LARCH_SOP_PUSH_DUP +ENUMX + BFD_RELOC_LARCH_SOP_PUSH_GPREL +ENUMX + BFD_RELOC_LARCH_SOP_PUSH_TLS_TPREL +ENUMX + BFD_RELOC_LARCH_SOP_PUSH_TLS_GOT +ENUMX + BFD_RELOC_LARCH_SOP_PUSH_TLS_GD +ENUMX + BFD_RELOC_LARCH_SOP_PUSH_PLT_PCREL +ENUMX + BFD_RELOC_LARCH_SOP_ASSERT +ENUMX + BFD_RELOC_LARCH_SOP_NOT +ENUMX + BFD_RELOC_LARCH_SOP_SUB +ENUMX + BFD_RELOC_LARCH_SOP_SL +ENUMX + BFD_RELOC_LARCH_SOP_SR +ENUMX + BFD_RELOC_LARCH_SOP_ADD +ENUMX + BFD_RELOC_LARCH_SOP_AND +ENUMX + BFD_RELOC_LARCH_SOP_IF_ELSE +ENUMX + BFD_RELOC_LARCH_SOP_POP_32_S_10_5 +ENUMX + BFD_RELOC_LARCH_SOP_POP_32_U_10_12 +ENUMX + BFD_RELOC_LARCH_SOP_POP_32_S_10_12 +ENUMX + BFD_RELOC_LARCH_SOP_POP_32_S_10_16 +ENUMX + BFD_RELOC_LARCH_SOP_POP_32_S_10_16_S2 +ENUMX + BFD_RELOC_LARCH_SOP_POP_32_S_5_20 +ENUMX + BFD_RELOC_LARCH_SOP_POP_32_S_0_5_10_16_S2 +ENUMX + BFD_RELOC_LARCH_SOP_POP_32_S_0_10_10_16_S2 +ENUMX + BFD_RELOC_LARCH_SOP_POP_32_U +ENUMX + BFD_RELOC_LARCH_ADD8 +ENUMX + BFD_RELOC_LARCH_ADD16 +ENUMX + BFD_RELOC_LARCH_ADD24 +ENUMX + BFD_RELOC_LARCH_ADD32 +ENUMX + BFD_RELOC_LARCH_ADD64 +ENUMX + BFD_RELOC_LARCH_SUB8 +ENUMX + BFD_RELOC_LARCH_SUB16 +ENUMX + BFD_RELOC_LARCH_SUB24 +ENUMX + BFD_RELOC_LARCH_SUB32 +ENUMX + BFD_RELOC_LARCH_SUB64 +ENUMDOC + LARCH relocations. + ENDSENUM BFD_RELOC_UNUSED CODE_FRAGMENT @@ -8059,7 +8302,7 @@ bfd_reloc_name_lookup (bfd *abfd, const char *reloc_name) } static reloc_howto_type bfd_howto_32 = -HOWTO (0, 00, 2, 32, FALSE, 0, complain_overflow_dont, 0, "VRT32", FALSE, 0xffffffff, 0xffffffff, TRUE); +HOWTO (0, 00, 2, 32, false, 0, complain_overflow_dont, 0, "VRT32", false, 0xffffffff, 0xffffffff, true); /* INTERNAL_FUNCTION @@ -8077,28 +8320,11 @@ DESCRIPTION reloc_howto_type * bfd_default_reloc_type_lookup (bfd *abfd, bfd_reloc_code_real_type code) { - switch (code) - { - case BFD_RELOC_CTOR: - /* The type of reloc used in a ctor, which will be as wide as the - address - so either a 64, 32, or 16 bitter. */ - switch (bfd_arch_bits_per_address (abfd)) - { - case 64: - BFD_FAIL (); - break; - case 32: - return &bfd_howto_32; - case 16: - BFD_FAIL (); - break; - default: - BFD_FAIL (); - } - break; - default: - BFD_FAIL (); - } + /* Very limited support is provided for relocs in generic targets + such as elf32-little. FIXME: Should we always return NULL? */ + if (code == BFD_RELOC_CTOR + && bfd_arch_bits_per_address (abfd) == 32) + return &bfd_howto_32; return NULL; } @@ -8127,29 +8353,29 @@ INTERNAL_FUNCTION bfd_generic_relax_section SYNOPSIS - bfd_boolean bfd_generic_relax_section + bool bfd_generic_relax_section (bfd *abfd, asection *section, struct bfd_link_info *, - bfd_boolean *); + bool *); DESCRIPTION Provides default handling for relaxing for back ends which don't do relaxing. */ -bfd_boolean +bool bfd_generic_relax_section (bfd *abfd ATTRIBUTE_UNUSED, asection *section ATTRIBUTE_UNUSED, struct bfd_link_info *link_info ATTRIBUTE_UNUSED, - bfd_boolean *again) + bool *again) { if (bfd_link_relocatable (link_info)) (*link_info->callbacks->einfo) (_("%P%F: --relax and -r may not be used together\n")); - *again = FALSE; - return TRUE; + *again = false; + return true; } /* @@ -8157,7 +8383,7 @@ INTERNAL_FUNCTION bfd_generic_gc_sections SYNOPSIS - bfd_boolean bfd_generic_gc_sections + bool bfd_generic_gc_sections (bfd *, struct bfd_link_info *); DESCRIPTION @@ -8165,11 +8391,11 @@ DESCRIPTION don't do section gc -- i.e., does nothing. */ -bfd_boolean +bool bfd_generic_gc_sections (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info ATTRIBUTE_UNUSED) { - return TRUE; + return true; } /* @@ -8177,7 +8403,7 @@ INTERNAL_FUNCTION bfd_generic_lookup_section_flags SYNOPSIS - bfd_boolean bfd_generic_lookup_section_flags + bool bfd_generic_lookup_section_flags (struct bfd_link_info *, struct flag_info *, asection *); DESCRIPTION @@ -8186,7 +8412,7 @@ DESCRIPTION Returns FALSE if the section should be omitted, otherwise TRUE. */ -bfd_boolean +bool bfd_generic_lookup_section_flags (struct bfd_link_info *info ATTRIBUTE_UNUSED, struct flag_info *flaginfo, asection *section ATTRIBUTE_UNUSED) @@ -8194,9 +8420,9 @@ bfd_generic_lookup_section_flags (struct bfd_link_info *info ATTRIBUTE_UNUSED, if (flaginfo != NULL) { _bfd_error_handler (_("INPUT_SECTION_FLAGS are not supported")); - return FALSE; + return false; } - return TRUE; + return true; } /* @@ -8204,7 +8430,7 @@ INTERNAL_FUNCTION bfd_generic_merge_sections SYNOPSIS - bfd_boolean bfd_generic_merge_sections + bool bfd_generic_merge_sections (bfd *, struct bfd_link_info *); DESCRIPTION @@ -8212,11 +8438,11 @@ DESCRIPTION which don't have SEC_MERGE support -- i.e., does nothing. */ -bfd_boolean +bool bfd_generic_merge_sections (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *link_info ATTRIBUTE_UNUSED) { - return TRUE; + return true; } /* @@ -8229,7 +8455,7 @@ SYNOPSIS struct bfd_link_info *link_info, struct bfd_link_order *link_order, bfd_byte *data, - bfd_boolean relocatable, + bool relocatable, asymbol **symbols); DESCRIPTION @@ -8243,7 +8469,7 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, struct bfd_link_info *link_info, struct bfd_link_order *link_order, bfd_byte *data, - bfd_boolean relocatable, + bool relocatable, asymbol **symbols) { bfd *input_bfd = link_order->u.indirect.section->owner; @@ -8312,14 +8538,15 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, && (input_section->flags & SEC_DEBUGGING) != 0 && link_info->input_bfds == link_info->output_bfd)) { - bfd_byte *p; + bfd_vma off; static reloc_howto_type none_howto - = HOWTO (0, 0, 0, 0, FALSE, 0, complain_overflow_dont, NULL, - "unused", FALSE, 0, 0, FALSE); + = HOWTO (0, 0, 0, 0, false, 0, complain_overflow_dont, NULL, + "unused", false, 0, 0, false); - p = data + (*parent)->address * bfd_octets_per_byte (input_bfd); - _bfd_clear_contents ((*parent)->howto, input_bfd, input_section, - p); + off = ((*parent)->address + * bfd_octets_per_byte (input_bfd, input_section)); + _bfd_clear_contents ((*parent)->howto, input_bfd, + input_section, data, off); (*parent)->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr; (*parent)->addend = 0; (*parent)->howto = &none_howto; @@ -8349,7 +8576,7 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, case bfd_reloc_undefined: (*link_info->callbacks->undefined_symbol) (link_info, bfd_asymbol_name (*(*parent)->sym_ptr_ptr), - input_bfd, input_section, (*parent)->address, TRUE); + input_bfd, input_section, (*parent)->address, true); break; case bfd_reloc_dangerous: BFD_ASSERT (error_message != NULL); @@ -8402,7 +8629,7 @@ bfd_generic_get_relocated_section_contents (bfd *abfd, free (reloc_vector); return data; -error_return: + error_return: free (reloc_vector); return NULL; } @@ -8437,7 +8664,7 @@ INTERNAL_FUNCTION _bfd_unrecognized_reloc SYNOPSIS - bfd_boolean _bfd_unrecognized_reloc + bool _bfd_unrecognized_reloc (bfd * abfd, sec_ptr section, unsigned int r_type); @@ -8448,7 +8675,7 @@ DESCRIPTION Returns FALSE so that it can be called from a return statement. */ -bfd_boolean +bool _bfd_unrecognized_reloc (bfd * abfd, sec_ptr section, unsigned int r_type) { /* xgettext:c-format */ @@ -8460,7 +8687,7 @@ _bfd_unrecognized_reloc (bfd * abfd, sec_ptr section, unsigned int r_type) BFD_VERSION_STRING); bfd_set_error (bfd_error_bad_value); - return FALSE; + return false; } reloc_howto_type *