* elfxx-mips.h (_bfd_mips_elf_get_synthetic_symtab): New
prototype.
* elf32-mips.c (elf_backend_plt_sym_val): Remove macro.
(bfd_elf32_get_synthetic_symtab): New macro.
* elfxx-mips.c (plt_entry): New structure.
(mips_elf_link_hash_entry): Add use_plt_entry member.
(mips_elf_link_hash_table): Rename plt_entry_size member to
plt_mips_entry_size. Add plt_comp_entry_size, plt_mips_offset,
plt_comp_offset, plt_got_index entries and plt_header_is_comp
members.
(STUB_LW_MICROMIPS, STUB_MOVE_MICROMIPS): New macros.
(STUB_LUI_MICROMIPS, STUB_JALR_MICROMIPS): Likewise.
(STUB_ORI_MICROMIPS, STUB_LI16U_MICROMIPS): Likewise.
(STUB_LI16S_MICROMIPS): Likewise.
(MICROMIPS_FUNCTION_STUB_NORMAL_SIZE): Likewise.
(MICROMIPS_FUNCTION_STUB_BIG_SIZE): Likewise.
(micromips_o32_exec_plt0_entry): New variable.
(mips16_o32_exec_plt_entry): Likewise.
(micromips_o32_exec_plt_entry): Likewise.
(mips_elf_link_hash_newfunc): Initialize use_plt_entry.
(mips_elf_output_extsym): Update to use gotplt_union's plist
member rather than offset.
(mips_elf_gotplt_index): Likewise. Remove the VxWorks
restriction. Use MIPS_ELF_GOT_SIZE to calculate GOT address.
(mips_elf_count_got_symbols): Update to use gotplt_union's plist
member rather than offset.
(mips_elf_calculate_relocation): Handle MIPS16/microMIPS PLT
entries.
(_bfd_mips_elf_create_dynamic_sections): Don't set PLT sizes
here.
(mips_elf_make_plt_record): New function.
(_bfd_mips_elf_check_relocs): Update comment. Record occurences
of JAL relocations that might need a PLT entry.
(_bfd_mips_elf_adjust_dynamic_symbol): Update to use
gotplt_union's plist member rather than offset. Set individual
PLT entry sizes here. Handle MIPS16/microMIPS PLT entries.
Don't set the symbol's value in the symbol table for PLT
references here. Don't set the PLT or PLT GOT section sizes
here.
(mips_elf_estimate_stub_size): Handle microMIPS stubs.
(mips_elf_allocate_lazy_stub): Likewise.
(mips_elf_lay_out_lazy_stubs): Likewise. Define a _MIPS_STUBS_
magic symbol.
(mips_elf_set_plt_sym_value): New function.
(_bfd_mips_elf_size_dynamic_sections): Set PLT header size and
PLT and PLT GOT section sizes here. Set the symbol values in
the symbol table for PLT references here. Handle microMIPS
annotation of the _PROCEDURE_LINKAGE_TABLE_ magic symbol.
(_bfd_mips_elf_finish_dynamic_symbol): Update to use
gotplt_union's plist member rather than offset. Handle
MIPS16/microMIPS PLT entries. Handle microMIPS stubs.
(_bfd_mips_vxworks_finish_dynamic_symbol): Update to use
gotplt_union's plist member rather than offset. Use
MIPS_ELF_GOT_SIZE to calculate GOT address.
(mips_finish_exec_plt): Handle microMIPS PLT. Return status.
(_bfd_mips_elf_finish_dynamic_sections): Handle result from
mips_finish_exec_plt.
(_bfd_mips_elf_link_hash_table_create): Update to use
gotplt_union's plist member rather than offset.
(_bfd_mips_elf_get_synthetic_symtab): New function.
include/elf/
* mips.h (ELF_ST_IS_MIPS_PLT): Respect STO_MIPS16 setting.
(ELF_ST_SET_MIPS_PLT): Likewise.
gdb/
* mips-tdep.c (mips_elf_make_msymbol_special): Handle MIPS16 and
microMIPS synthetic symbols.
ld/
* emulparams/elf32btsmip.sh: Arrange for .got.plt to be placed
as close to .plt as possible.
* scripttempl/elf.sc: Handle $INITIAL_READWRITE_SECTIONS and
$PLT_NEXT_DATA variables.
ld/testsuite/
* ld-mips-elf/jalx-2.dd: Update for microMIPS PLT support.
* ld-mips-elf/pic-and-nonpic-3a.dd: Update for the _MIPS_STUBS_
magic symbol.
* ld-mips-elf/pic-and-nonpic-3b.dd: Likewise.
* ld-mips-elf/pic-and-nonpic-6-n32.dd: Likewise.
* ld-mips-elf/pic-and-nonpic-6-n64.dd: Likewise.
* ld-mips-elf/pic-and-nonpic-6-o32.dd: Likewise.
* ld-mips-elf/stub-dynsym-1-10000.d: Likewise.
* ld-mips-elf/stub-dynsym-1-2fe80.d: Likewise.
* ld-mips-elf/stub-dynsym-1-7fff.d: Likewise.
* ld-mips-elf/stub-dynsym-1-8000.d: Likewise.
* ld-mips-elf/stub-dynsym-1-fff0.d: Likewise.
* ld-mips-elf/tlslib-o32.d: Likewise.
opcodes/
* mips-dis.c (is_mips16_plt_tail): New function.
(print_insn_mips16): Handle MIPS16 PLT entry's GOT slot address
word.
(is_compressed_mode_p): Handle MIPS16/microMIPS PLT entries.
* Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Move MIPS ELF
files to...
(BFD64_BACKENDS, BFD64_BACKENDS_CFILES): ...here.
* Makefile.in: Regenerate.
* config.bfd: Enclose all MIPS ELF targets in #ifdef BFD64.
Set want64 to true for them at the end.
* targets.c (_bfd_target_vector): Protect MIPS ELF targets with
#ifdef BFD64.
gas/
* config/tc-mips.c: Assert that offsetT and valueT are at least
8 bytes in size.
(GPR_SMIN, GPR_SMAX): New macros.
(macro, mips_ip): Remove code for 4-byte valueT and offsetT.
ld/
* Makefile.am (ALL_EMULATION_SOURCES): Move MIPS ELF emulations to...
(ALL_64_EMULATION_SOURCES): ...here.
* Makefile.in: Regenerate.
* elf64-aarch64.c (elf64_aarch64_final_link_relocate): Call
aarch64_resolve_relocation and bfd_elf_aarch64_put_addend to
handle the relocations of R_AARCH64_JUMP26, R_AARCH64_CALL26,
R_AARCH64_LD64_GOT_LO12_NC, R_AARCH64_ADR_GOT_PAGE and
R_AARCH64_GOT_LD_PREL19.
ld/testsuite/
* ld-aarch64/aarch64-elf.exp: Add 'ifunc-7c'.
* ld-aarch64/ifunc-7c.d: New test.
* elf32-arm.c (allocate_dynrelocs_for_symbol): Transform
ST_BRANCH_TO_ARM into ST_BRANCH_TO_THUMB if the target only
supports thumb instructions.
PR ld/15302
* ld-arm/branch-lks-sym.ld: New script.
* ld-arm/thumb-b-lks-sym.s: New test.
* ld-arm/thumb-b-lks-sym.d: Expected disassembly.
* ld-arm/thumb-bl-lks-sym.s: New test.
* ld-arm/thumb-bl-lks-sym.d: Expected disassembly.
* ld-arm/arm-elf.exp: Run the new tests.
Fix incorrect usage of ELF32_R_SYM introduced in ifunc changes.
bfd/ChangeLog:
2013-06-11 Will Newton <will.newton@linaro.org>
* elf64-aarch64.c (elf_aarch64_get_local_sym_hash): Use
ELF64_R_SYM instead of ELF32_R_SYM.
alternate debug info source.
(dwarf_debug_sections): Add entries for alternate .debug_str and
.debug_info sections.
(dwarf_debug_section_enum): Likewise.
(read_alt_indirect_string): New function. Handles a
DW_FORM_GNU_strp_alt attribute.
(read_alt_indirect_ref): New function. Handles a
DW_FORM_GNU_ref_alt attribute.
(read_attribute_value): Process DW_FORM_GNU_ref_alt and
DW_FORM_GNU_strp_alt.
(find_abstract_instance_name): Handle DW_FORM_GNU_ref_alt
attributes.
(_bfd_dwarf2_cleanup_debug_info): Free alternate debug info
sources.
* opncls.c (GNU_DEBUGALTLINK): Define.
(bfd_get_alt_debug_link_info): New function.
(separate_alt_debug_file_exists): New function.
(find_separate_debug_file): Add parameters for fetch and check
functions.
(bfd_follow_gnu_debugaltlink): New function.
* bfd-in2.h: Regenerate.
The current hard coded limit of open files in bfd/cache.c is 10. This
is pretty low these days. Binaries are often linked against much more
than 10 files (and sometimes against more than 100 shared libraries).
When debugging with GDB some files are opened and closed multiple
times because of this low limit. If possible make the BFD cache file
limit depend on the actual open file limit of the process so more BFD
files can be open at the same time.
* cache.c (BFD_CACHE_MAX_OPEN): Remove define.
(max_open_files): New static int initialized to zero.
(bfd_cache_max_open): New static function to set and return
max_open_files.
(bfd_cache_init): Use bfd_cache_max_open.
(bfd_open_file): Likewise.
* configure.in (AC_CHECK_HEADERS): Add sys/resource.h.
(AC_CHECK_FUNCS): Add getrlimit.
* configure: Regenerated.
* config.in: Likewise.
* sysdep.h: Check and include sys/resource.h for getrlimit.
The relocs_copied member is never assigned a non-NULL value, so
this code does not appear to be used.
bfd/ChangeLog:
2013-05-20 Will Newton <will.newton@linaro.org>
* elf64-aarch64.c (elf64_aarch64_link_hash_entry): Remove
relocs_copied member.
(elf64_aarch64_link_hash_newfunc): Remove initialization of
relocs_copied member.
(elf64_aarch64_copy_indirect_symbol): Remove code to copy
relocs_copied member.
The .except, .loader and .typchk are not mapped to memory,
so do not set their SEC_ALLOC flag.
bfd/ChangeLog:
* coffcode.h (styp_to_sec_flags) [RS6000COFF_C]: Add handling
of STYP_EXCEPT, STYP_LOADER and STYP_TYPCHK sections.
ld/testsuite/ChangeLog:
* ld-powerpc/aix-core-sec-1.hd, ld-powerpc/aix-core-sec-2.hd,
ld-powerpc/aix-core-sec-3.hd: Adjust expected section flags
for section .loader.
Currently, bfd does not compile with -Wunused-value because
the following code:
val = putc ('\n', f);
gets expanded into some code that triggers a warning:
warning: value computed is not used [-Wunused-value]
This is because putc is implemented as a macro...
>#define putc(__x, __p) (((!((__p)->_flag & 0xC000)) && \
> ((__p)->_flag = ((__p)->_flag & 0x3FFF) | 0x8000)),\
> (--(__p)->_cnt < 0 ? \
> __flsbuf((unsigned char) (__x), (__p)) : \
> (int) (*(__p)->_ptr++ = (unsigned char) (__x))))
It's the first part, before the coma operator, which triggers
the unused-value warning.
This patch fixes the issue by simply avoiding the macro and using
fputc instead.
bfd/ChangeLog:
* bfd.c (_bfd_default_error_handler): Replace use of putc
by fputc. Add comment explaining why.
bfd/ChangeLog:
2013-05-07 Will Newton <will.newton@linaro.org>
* elf-ifunc.c (_bfd_elf_allocate_ifunc_dyn_relocs): Add a
plt_header_size argument for ports where it differs from
plt_entry_size.
* elf-bfd.h: Likewise.
* elf32-i386.c: Pass plt_header_size to
_bfd_elf_allocate_ifunc_dyn_relocs.
* elf64-x86-64.c: Likewise.
hashes around loading as-needed library. Zero them on allocation,
and restore to initial all-zero state if library not needed.
Arrange to reuse hashes if we load library again later.
* config.bfd (msp430): Define targ_selvecs.
* configure.in: Add bfd_elf32_msp430_ti_vec.
* cpu-msp430.c: Add some more MSP430 machine numbers.
* elf32-msp430.c Add support for MSP430X relocations.
Add support for TI compiler generated relocations.
Add support for sym_diff relocations.
Add support for relaxing out of range short branches into long
branches.
Add support for MSP430 attribute section.
* reloc.c: Add MSP430X relocations.
* targets.c: Add bfd_elf32_msp430_ti_vec.
* bfd-in2.h: Regenerate.
* configure: Regenerate.
* libbfd.h: Regenerate.
* readelf.c: Add support for MSP430X architecture.
* readelf.exp: Expect -wi test to fail for the MSP430.
* config/tc-msp430.c: Add support for the MSP430X architecture.
Add code to insert a NOP instruction after any instruction that
might change the interrupt state.
Add support for the LARGE memory model.
Add code to initialise the .MSP430.attributes section.
* config/tc-msp430.h: Add support for the MSP430X architecture.
* doc/c-msp430.texi: Document the new -mL and -mN command line
options.
* NEWS: Mention support for the MSP430X architecture.
* gas/all/gas.exp: Skip the DIFF1 test for the MSP430.
Expect the FORWARD test to pass for the MSP430.
Skip the REDEF tests for the MSP430.
Expect the 930509A test to fail for the MSP430.
* gas/all/sleb128-4.d: Skip for the MSP430.
* gas/elf/elf.exp: Set target_machine to msp430 for the MSP430.
Skip the EHOPT0 test for the MSP430.
Skip the REDEF and EQU-RELOC tests for the MSP430.
* gas/elf/section2.e-msp430: New file.
* gas/lns/lns-big-delta.d: Remove expectation of 20-bit
addresses.
* gas/lns/lns.exp: Use alternate LNS COMMON test for the MSP430.
* gas/msp430/msp430x.s: New test.
* gas/msp430/msp430x.d: Expected disassembly.
* gas/msp430/msp430.exp: Run new test.
* gas/msp430/opcode.d: Update expected disassembly.
* msp430.h: Add MSP430X relocs.
Add some more MSP430 machine numbers.
Add values used by .MSP430.attributes section.
* msp430.h: Add patterns for MSP430X instructions.
* Makefile.am: Add emsp430X.c
* Makefine.in: Regenerate.
* configure.tgt (msp430): Add msp430X emulation.
* ldmain.c (multiple_definition): Only disable relaxation if it
was enabled by the user.
* ldmain.h (RELAXATION_ENABLED_BY_USER): New macro.
* emulparams/msp430all.sh: Add support for MSP430X.
* emultempl/generic.em: (before_parse): Enable relaxation for the
MSP430.
* scripttempl/msp430.sc: Reorganize sections. Add .rodata
section.
* scripttempl/msp430_3.sc: Likewise.
* NEWS: Mention support for MSP430X.
* ld-elf/flags1.d: Expect this test to pass on the MSP430.
* ld-elf/init-fini-arrays.d: Expect this test to fail on the
MSP430.
* ld-elf/merge.d: Expect this test to pass on the MSP430.
* ld-elf/sec64k.exp: Skip these tests for the MSP430.
* ld-gc/pr13683.d: Expect this test to fail on the MSP430.
* ld-srec/srec.exp: Expect these tests to fail on the MSP430.
* ld-undefined/undefined.exp: Expect the UNDEFINED LINE test to
fail on the MSP430.
* msp430-dis.c: Add support for MSP430X instructions.
* config.bfd: Replace alpha*-*-linuxecoff* pattern with
alpha*-*-linux*ecoff*.
binutils/testsuite/
* lib/binutils-common.exp (is_elf_format): Also exclude
*-*-linux*ecoff*.
gas/
* configure.tgt: Replace alpha*-*-linuxecoff* pattern with
alpha*-*-linux*ecoff*.
ld/
* configure.tgt: Replace alpha*-*-linuxecoff* pattern with
alpha*-*-linux*ecoff*. Update the `sed' pattern used to convert
from alpha*-*-linux-* to alpha*-*-linux*ecoff*.