aboutsummaryrefslogtreecommitdiff
path: root/bfd
AgeCommit message (Collapse)AuthorFilesLines
2014-04-18mach-o: Define copy_private_header instead of copy_private_bfd.Tristan Gingold4-3/+10
bfd/ * mach-o-target.c (bfd_mach_o_bfd_copy_private_header_data): Define instead of bfd_mach_o_bfd_copy_private_bfd_data. * mach-o.c (bfd_mach_o_bfd_copy_private_bfd_data): Rename. * mach-o.h (bfd_mach_o_bfd_copy_private_bfd_data): Likewise.
2014-04-18mach-o: remove name_len field.Tristan Gingold3-16/+25
bfd/ * mach-o.h (bfd_mach_o_dylinker_command) (bfd_mach_o_dylib_command, bfd_mach_o_fvmlib_command): Remove name_len field. * mach-o.c (bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib) (bfd_mach_o_read_fvmlib): Adjust after name_len removal.
2014-04-18mach-o: add page_size to backend data.Tristan Gingold6-0/+24
This is preliminary work to layout executables. bfd/ * mach-o.h (bfd_mach_o_backend_data): Add page_size field. * mach-o-target.c: Check TARGET_PAGESIZE is defined. (TARGET_NAME_BACKEND): Add TARGET_PAGESIZE. * mach-o.c (TARGET_PAGESIZE): Define and undefined for each targets declared. * mach-o-x86-64.c (TARGET_PAGESIZE): Define. * mach-o-i386.c (TARGET_PAGESIZE): Define.
2014-04-18mach-o.c: use boolean instead of int to return status.Tristan Gingold2-141/+159
bfd/ * mach-o.c (bfd_mach_o_write_thread) (bfd_mach_o_write_section_32, bfd_mach_o_write_section_64) (bfd_mach_o_write_segment_32, bfd_mach_o_write_segment_64) (bfd_mach_o_read_dylinker, bfd_mach_o_read_dylib) (bfd_mach_o_read_prebound_dylib, bfd_mach_o_read_prebind_cksum) (bfd_mach_o_read_twolevel_hints, bfd_mach_o_read_fvmlib) (bfd_mach_o_read_thread, bfd_mach_o_read_dysymtab) (bfd_mach_o_read_symtab, bfd_mach_o_read_uuid) (bfd_mach_o_read_linkedit, bfd_mach_o_read_str) (bfd_mach_o_read_dyld_info, bfd_mach_o_read_segment) (bfd_mach_o_read_segment_32, bfd_mach_o_read_segment_64) (bfd_mach_o_read_command): Now return a boolean status. Adjust return statements. (bfd_mach_o_write_contents, bfd_mach_o_scan): Adjust tests. (bfd_mach_o_core_file_failing_command): Remove useless initialization.
2014-04-18daily updateAlan Modra1-1/+1
2014-04-17This patch causes local GOT entries addressed via a 16-bit index toKwok Cheung Yeung2-18/+50
be placed towards the front of local GOT space, while entries addressed via a 32-bit index are placed towards the rear. Provided that there are fewer than ~16K local GOT entries addressed via a 16-bit index in total, this should eliminate any relocation overflows caused by such GOT entries being allocated beyond the addressable range. bfd/ * elfxx-mips.c (struct mips_got_info): Delete assigned_gotno field. Add assigned_low_gotno and assigned_high_gotno fields. (mips_elf_create_local_got_entry): Update out-of-space condition. Set index of new GOT entry to assigned_low_gotno if required by the current relocation, else set it to assigned_high_gotno. (mips_elf_set_global_gotidx): Replace uses of assigned_gotno with assigned_low_gotno. (mips_elf_multi_got): Initialize assigned_low_gotno and assigned_high_gotno in secondary GOTs. Use assigned_low_gotno in place of assigned_gotno when handling global GOT entries. (mips_elf_lay_out_got): Initialize assigned_low_gotno and assigned_high_gotno. (_bfd_mips_elf_finish_dynamic_sections): Account for a possible gap in the middle of local GOT space. ld/testsuite/ * ld-mips-elf/elf-rel-xgot-n32.d: Update for new GOT layout. * ld-mips-elf/elf-rel-xgot-n32-embed.d: Likewise. * ld-mips-elf/elf-rel-xgot-n64.d: Likewise. * ld-mips-elf/elf-rel-xgot-n64-embed.d: Likewise. * ld-mips-elf/elf-rel-xgot-n64-linux.d: Likewise.
2014-04-17Fix LTO mismatched TLS referenceAlan Modra2-9/+15
PR 16846 * elflink.c (_bfd_elf_merge_symbol): Ignore TLS mismatch when current bfd is a plugin. Don't always set type_change_ok when old bfd is a plugin.
2014-04-17daily updateAlan Modra1-1/+1
2014-04-16Mach-O: add cpu and cpusubtype caps.Tristan Gingold2-1/+7
include/mach-o/ 2014-04-16 Tristan Gingold <gingold@adacore.com> * loader.h (BFD_MACH_O_CPU_ARCH_MASK, BFD_MACH_O_CPU_ARCH_ABI64) (BFD_MACH_O_CPU_SUBTYPE_MASK, BFD_MACH_O_CPU_SUBTYPE_LIB64): Define. bfd/ 2014-04-16 Tristan Gingold <gingold@adacore.com> * mach-o-x86-64.c (bfd_mach_o_x86_64_mkobject): Adjust cpusubtype flag.
2014-04-16fill ppc476 fixup areaAlan Modra2-2/+19
Stops false positive warnings from scanner. * elf32-ppc.c (ppc_elf_relocate_section): Fill 476 fixup area with "ba 0" rather than zeros.
2014-04-16daily updateAlan Modra1-1/+1
2014-04-15[AArch64] Fix off by one error in instruction relaxation mask.Marcus Shawcroft2-1/+5
The AArch64 TLSDESC to IE relaxation code uses a bit mask intended to ensure that destination register in a relaxed ldr instruction is always X0. The mask has an off by one error resulting in the most significant bit of the destination register being retained in the relaxed instruction. The issue generally appears when the compiler emits TLS accesses code under high register pressure resulting in a broken code sequence.
2014-04-15daily updateAlan Modra1-1/+1
2014-04-14ppc476 plt call stubsAlan Modra2-5/+57
Fuss over bctr in call stubs. * elf32-ppc.c (BA): Define (ppc_elf_link_hash_table_create): Correct default_params. (write_glink_stub): Pad small plt call stub with "ba 0" rather than "nop" for ppc476_workaround. (ppc_elf_finish_dynamic_sections): Likewise for branch table and __glink_PLTresolve. Ensure plt call stub at end of page doesn't allow fall-thru prefetch.
2014-04-14daily updateAlan Modra1-1/+1
2014-04-13daily updateAlan Modra1-1/+1
2014-04-12daily updateAlan Modra1-1/+1
2014-04-11PE32+ binaries that use addresses > 1^32 have a problem in that the linkerNick Clifton2-0/+39
converts some address expressions into absolute values, but the PE format only stores absolutes as 32-bits. This is a partial solution which attempts to convert such absolute values back to section relative ones instead. It fails for symbols like __image_base and ImageBase__, but it is unclear as to whether these values are ever actually used by applications. PR ld/16821 * peXXigen.c (abs_finder): New function. (_bfd_XXi_swap_sym_out): For absolute symbols with values larger than 1^32 try to convert them into section relative values instead.
2014-04-11Regenerate header files after this commit:Nick Clifton3-0/+18
2014-04-10 Senthil Kumar Selvaraj <senthil_kumar.selvaraj@atmel.com> * reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations
2014-04-10Ignore non-stub sections for nios2 stub_bfd processing.Sandra Loosemore2-10/+20
2014-04-10 Cesar Philippidis <cesar@codesourcery.com> bfd/ * elf32-nios2.c (nios2_elf32_build_stubs): Ignore dynobjs when building function stubs.
2014-04-11daily updateAlan Modra1-1/+1
2014-04-10bfd/ChangeLogDenis Chertykov3-2/+206
* elf32-avr.c: Add DIFF relocations for AVR. (avr_final_link_relocate): Handle the DIFF relocs. (bfd_elf_avr_diff_reloc): New. (elf32_avr_is_diff_reloc): New. (elf32_avr_adjust_diff_reloc_value): Reduce difference value. (elf32_avr_relax_delete_bytes): Recompute difference after deleting bytes. * reloc.c: Add BFD_RELOC_AVR_DIFF8/16/32 relocations gas/ChangeLog * config/tc-avr.c: Add new flag mlink-relax. (md_show_usage): Add flag and help text. (md_parse_option): Record whether link relax is turned on. (relaxable_section): New. (avr_validate_fix_sub): New. (avr_force_relocation): New. (md_apply_fix): Generate DIFF reloc. (avr_allow_local_subtract): New. * config/tc-avr.h (TC_LINKRELAX_FIXUP): Define to 0. (TC_FORCE_RELOCATION): Define. (TC_FORCE_RELOCATION_SUB_SAME): Define. (TC_VALIDATE_FIX_SUB): Define. (avr_force_relocation): Declare. (avr_validate_fix_sub): Declare. (md_allow_local_subtract): Define. (avr_allow_local_subtract): Declare. gas/testsuite/ChangeLog * gas/avr/diffreloc_withrelax.d: New testcase. * gas/avr/noreloc_withoutrelax.d: Likewise. * gas/avr/relax.s: Likewise. include/ChangeLog * elf/avr.h: Add new DIFF relocs. ld/testsuite/ChangeLog * ld-avr/norelax_diff.d: New testcase. * ld-avr/relax_diff.d: Likewise. * ld-avr/relax.s: Likewise.
2014-04-10daily updateAlan Modra1-1/+1
2014-04-09Add a time-stamp for chewAlan Modra3-8/+23
One last time-stamp. Now none of the doc rules using move-if-change will run unnecessarily. * Makefile.am ($(MKDOC)): New rule, depend on chew.stamp. Move old rule to.. (chew.stamp): ..here. (DISTCLEANFILES): Move *.stamp.. (MOSTLYCLEANFILES): ..to here. * Makefile.in: Regenerate.
2014-04-09Fix fallout from splitting ldbuildid.[ch] off elf32.em.Alan Modra2-1/+5
bfd/ * libcoff.h: Regenerate. ld/ * emultempl/spuelf.em: Include safe-ctype.h, remove duplicate errno.h. * emultempl/nds32elf.em: Include bfd_stdint.h. * po/POTFILES.in: Regenerate.
2014-04-09bfd doc chewAlan Modra3-136/+193
I got tired of watching chew.c being compiled a dozen or more times each time I do a binutils build. * Makefile.am (MKDOC): Use $@ in command. (aoutx.texi): New rule, depend on aoutx.stamp. Move old rule.. (aoutx.stamp): .. to here. Don't depend on chew.c, depend on MKDOC and omit recursive MAKE. Use $< in command. (archive.texi, archures.texi, bfdt.texi, cache.texi, coffcode.texi, core.texi, elf.texi, elfcode.texi, mmo.texi, format.texi, libbfd.texi, bfdio.texi, bfdwin.texi, opncls.texi, reloc.texi, section.texi, syms.texi, targets.texi, init.texi, hash.texi, linker.texi): Similarly. (DISTCLEANFILES): Remove *.stamp. * Makefile.in: Regenerate.
2014-04-09daily updateAlan Modra1-1/+1
2014-04-09ppc476 icache workaround fix for bctrAlan Modra2-19/+54
I got the ppc476 workaround wrong. bctr (and bctrl) as the last instruction in a page can hit the icache bug if the preceding mtctr insn is close by, and the destination is in the first few instructions on the next page. This scenario can occur with code generated by gcc to implement switch statements, or in code generated to call by function pointer. To prevent the bctr problem it is also necessary to remove other instructions that otherwise would be safe. bfd/ * elf32-ppc.c (ppc_elf_relocate_section): Remove bctr from list of safe ppc476 insns at end of page. Also remove non-branch insns. Expand comments. ld/ * emultempl/ppc32elf.em (no_zero_padding, ppc_finish): New functions. (LDEMUL_FINISH): Define.
2014-04-08Add support for generating and inserting build IDs into COFF binaries.Jon TURNEY6-4/+270
* peXXigen.c (pe_print_debugdata): New function: Displays the contents of the debug directory and decodes codeview entries. (_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out) (_bfd_XXi_slurp_codeview_record, _bfd_XXi_write_codeview_record): Add functions for reading and writing debugdir and codeview records. * libpei.h (_bfd_XXi_swap_debugdir_in, _bfd_XXi_swap_debugdir_out) (_bfd_XXi_write_codeview_record): Add prototypes and macros. * libcoff-in.h (pe_tdata): Add build-id data. * libcoff.h: Regenerate. * coffcode.h (coff_write_object_contents): Run build_id after_write_object_contents hook. * pe.h (external_IMAGE_DEBUG_DIRECTORY, _CV_INFO_PDB70) (_CV_INFO_PDB20): Add structures and constants for debug directory and codeview records. * internal.h (internal_IMAGE_DEBUG_DIRECTORY, CODEVIEW_INFO): Add structures and constants for internal representation of debug directory and codeview records. * emultempl/elf32.em (id_note_section_size, read_hex, write_build_id): Move code for parsing build-id option and calculating the build-id to... * ldbuildid.c: New file. * ldbuildid.h: New file. * Makefile.am (CFILES, HFILES, OFILES, ld_new_SOURCES): Add new files. * Makefile.in: Regenerate. * ld.texinfo: Update --build-id description to mention COFF support. * NEWS: Mention support for COFF build ids. * emultempl/pe.em (gld${EMULATION_NAME}_handle_option): (pecoff_checksum_contents, write_build_id, setup_build_id) (gld_${EMULATION_NAME}_after_open): Handle and implement build-id option. * emultempl/pep.em: Likewise.
2014-04-08daily updateAlan Modra1-1/+1
2014-04-07daily updateAlan Modra1-1/+1
2014-04-06daily updateAlan Modra1-1/+1
2014-04-05Fix map file referenceAlan Modra2-1/+6
The testcase in pr16417 comment #6 produces a map file showing libpthread.so.0 (write@@GLIBC_2.2.5) ie. missing the file referencing the symbol. * elflink.c (_bfd_elf_add_default_symbol): Pass poldbfd when merging non-default sym.
2014-04-05daily updateAlan Modra1-1/+1
2014-04-04mach-o: reject 64 bit targets when not configured for.Tristan Gingold2-0/+14
bfd/ * mach-o.c (bfd_mach_o_header_p): Reject 64 bit target when not configured for.
2014-04-04mach-o: fix section name conversion from bfd to mach-o.Tristan Gingold2-4/+10
bfd/ * mach-o.c (bfd_mach_o_convert_section_name_to_mach_o): Fix thinko on names length.
2014-04-04mach-o: output output_section target_index to write relocs.Tristan Gingold3-2/+10
bfd/ * mach-o-i386.c (bfd_mach_o_i386_swap_reloc_out): Use target index of output_section. * mach-o-x86-64.c (bfd_mach_o_x86_64_swap_reloc_out): Ditto.
2014-04-04bfd_get_arch_size: return size from arch info on non-ELF targets.Tristan Gingold2-4/+10
bfd/ * bfd.c (bfd_get_arch_size): Default is taken from arch.
2014-04-04daily updateAlan Modra1-1/+1
2014-04-03 * peXXigen.c (pe_print_edata): Verify edt.name lies insideJon Turney2-10/+33
section before dereferencing. (pe_print_idata, pe_print_edata, pe_print_reloc) (rsrc_print_section): Don't bother interpreting the contents of sections which have no contents.
2014-04-03This fixes a problem building large (> 2Gb) binaries on 32-bit hosts. Using aMaria Guseva2-1/+7
long type instead of long long meant that bfd_seek (SET) could be called with a negative offset. PR ld/16803 * elf.c (_bfd_elf_set_section_contents): Use correct type to hold file position.
2014-04-03mach-o: fix section number while writing symbols.Tristan Gingold2-7/+24
bfd/ * mach-o.c (bfd_mach_o_mangle_symbols): Use index from output_section. (bfd_mach_o_build_seg_command): Add comment. Realign segment. Fix style. (bfd_mach_o_build_commands, bfd_mach_o_read_thread): Fix style.
2014-04-03Fix sim breakageAlan Modra3-2/+4
Replace "size_t size" with "bfd_size_type size". and here too. * bfd-in.h (bfd_elf_bfd_from_remote_memory): Likewise. * bfd-in2.h: Regenerate.
2014-04-03ChangeLog missed from last commitAlan Modra1-0/+10
2014-04-03Fix sim breakageAlan Modra3-5/+5
* elf-bfd.h (struct elf_backend_data <elf_backend_bfd_from_remote_memory>): Replace "size_t size" with "bfd_size_type size". (_bfd_elf32_bfd_from_remote_memory): Likewise. (_bfd_elf64_bfd_from_remote_memory): Likewise. * elf.c (bfd_elf_bfd_from_remote_memory): Likewise. * elfcode.h (bfd_from_remote_memory): Likewise.
2014-04-03daily updateAlan Modra1-1/+1
2014-04-02mach-o: read and dump: prebound_dylib, prebind_cksum, twolevel_hints.Tristan Gingold3-8/+110
include/mach-o: * external.h (mach_o_prebound_dylib_command_external) (mach_o_prebind_cksum_command_external) (mach_o_twolevel_hints_command_external): New types. bfd/ * mach-o.h (bfd_mach_o_twolevel_hints_command) (bfd_mach_o_prebind_cksum_command): New types. (bfd_mach_o_prebound_dylib_command): Rewrite. (bfd_mach_o_load_command): Add prebind_cksum and twolevel_hints fields. * mach-o.c (bfd_mach_o_read_prebound_dylib): Read and decode the command. (bfd_mach_o_read_prebind_cksum): New function. (bfd_mach_o_read_twolevel_hints): Ditto. (bfd_mach_o_read_command): Handle prebind cksum and twolevel hints commands. binutils/ * od-macho.c (OPT_TWOLEVEL_HINTS): New macro. (options): Add entry for twolevel_hints. (dump_data_in_code): Fix error message. (dump_twolevel_hints): New function. (dump_load_command): Handle prebound dylib, prebind cksum and twolevel hints. (mach_o_dump): Handle twolevel hints.
2014-04-02Handle VDSO section headers past end of pageAlan Modra6-91/+145
When a VDSO gets large enough that it doesn't entirely fit in one page, but not so large that the part described by the program header exceeds one page, then gdb/BFD doesn't read the section headers and symbol table information. This patch cures that by passing the size of the vdso to BFD, and fixes a number of other issues in the BFD code. bfd/ * elfcode.h (bfd_from_remote_memory): Add "size" parameter. Consolidate code handling possible section headers past end of segment. Don't use p_align for page size guess, instead use minpagesize. Take note of ld.so clearing section headers when p_memsz > p_filesz. Handle file header specifying no section headers. Handle zero p_align throughout. Default loadbase to zero. Add comments. Rename contents_size to high_offset, and make it a bfd_vma. Delete unnecessary bfd_set_error calls. * bfd-in.h (bfd_elf_bfd_from_remote_memory): Update prototpe. * elf-bfd.h (struct elf_backend_data <elf_backend_from_remote_memory>): Likewise. (_bfd_elf32_bfd_from_remote_memory): Likewise. (_bfd_elf64_bfd_from_remote_memory): Likewise. * elf.c (bfd_elf_bfd_from_remote_memory): Adjust. * bfd-in2.h: Regnerate. gdb/ * symfile-mem.c (symbol_file_add_from_memory): Add size parameter. Pass to bfd_elf_bfd_from_remote_memory. Adjust all callers. (struct symbol_file_add_from_memory_args): Add size field. (find_vdso_size): New function. (add_vsyscall_page): Attempt to find vdso size.
2014-04-02daily updateAlan Modra1-1/+1
2014-04-01bfd/mach-o: avoid a crash when num == 0 in reloc.Tristan Gingold2-2/+6
bfd/ * mach-o.c (bfd_mach_o_canonicalize_one_reloc): Avoid to crash when num == 0.