aboutsummaryrefslogtreecommitdiff
path: root/ld/ld.texinfo
AgeCommit message (Collapse)AuthorFilesLines
2015-10-29fix typo in ld's texinfoMatthias Klose1-1/+1
* ld.texinfo (Options <-rpath>): Fix typo.
2015-10-27Add --fix-stm32l4xx-629360 to the ARM linker to enable a link-time ↵Laurent Alfonsi1-0/+42
workaround for a bug in the bus matrix / memory controller for some of the STM32 Cortex-M4 based products (STM32L4xx). bfd * bfd-in2.h: Regenerate. * bfd-in.h (bfd_arm_stm32l4xx_fix): New enum. Specify how STM32L4XX instruction scanning should be done. (bfd_elf32_arm_set_stm32l4xx_fix) (bfd_elf32_arm_stm32l4xx_erratum_scan) (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): Add prototypes. (bfd_elf32_arm_set_target_relocs): Add stm32l4xx fix type argument to prototype. * elf32-arm.c (STM32L4XX_ERRATUM_VENEER_SECTION_NAME) (STM32L4XX_ERRATUM_VENEER_ENTRY_NAME): Define macros. (elf32_stm32l4xx_erratum_type): New enum. (elf32_stm32l4xx_erratum_list): New struct. List of veneers or jumps to veneers. (_arm_elf_section_data): Add stm32l4xx_erratumcount, stm32l4xx_erratumlist. (elf32_arm_link_hash_table): Add stm32l4xx_erratum_glue_size, stm32l4xx_fix and num_stm32l4xx_fixes fields. (ctz): New function. (popcount): New function. (elf32_arm_link_hash_table_create): Initialize stm32l4xx_fix. (put_thumb2_insn): New function. (STM32L4XX_ERRATUM_LDM_VENEER_SIZE): Define. Size of a veneer for LDM instructions. (STM32L4XX_ERRATUM_VLDM_VENEER_SIZE): Define. Size of a veneer for VLDM instructions. (bfd_elf32_arm_allocate_interworking_sections): Initialise erratum glue section. (record_stm32l4xx_erratum_veneer) : New function. Create a single veneer, and its associated symbols. (bfd_elf32_arm_add_glue_sections_to_bfd): Add STM32L4XX erratum glue. (bfd_elf32_arm_set_stm32l4xx_fix): New function. Set the type of erratum workaround required. (bfd_elf32_arm_stm32l4xx_fix_veneer_locations): New function. Find out where veneers and branches to veneers have been placed in virtual memory after layout. (is_thumb2_ldmia): New function. (is_thumb2_ldmdb): Likewise. (is_thumb2_vldm ): Likewise. (stm32l4xx_need_create_replacing_stub): New function. Decide if a veneer must be emitted. (bfd_elf32_arm_stm32l4xx_erratum_scan): Scan the sections of an input BFD for potential erratum-triggering insns. Record results. (bfd_elf32_arm_set_target_relocs): Set stm32l4xx_fix field in global hash table. (elf32_arm_size_dynamic_sections): Collect glue information. (create_instruction_branch_absolute): New function. (create_instruction_ldmia): Likewise. (create_instruction_ldmdb): Likewise. (create_instruction_mov): Likewise. (create_instruction_sub): Likewise. (create_instruction_vldmia): Likewise. (create_instruction_vldmdb): Likewise. (create_instruction_udf_w): Likewise. (create_instruction_udf): Likewise. (push_thumb2_insn32): Likewise. (push_thumb2_insn16): Likewise. (stm32l4xx_fill_stub_udf): Likewise. (stm32l4xx_create_replacing_stub_ldmia): New function. Expands the replacing stub for ldmia instructions. (stm32l4xx_create_replacing_stub_ldmdb): Likewise for ldmdb. (stm32l4xx_create_replacing_stub_vldm): Likewise for vldm. (stm32l4xx_create_replacing_stub): New function. Dispatches the stub emission to the appropriate functions. (elf32_arm_write_section): Output veneers, and branches to veneers. ld * ld.texinfo: Description of the STM32L4xx erratum workaround. * emultempl/armelf.em (stm32l4xx_fix): New. (arm_elf_before_allocation): Choose the type of fix, scan for erratum. (gld${EMULATION_NAME}_finish): Fix veneer locations. (arm_elf_create_output_section_statements): Propagate stm32l4xx_fix value. (PARSE_AND_LIST_PROLOGUE): Define OPTION_STM32L4XX_FIX. (PARSE_AND_LIST_LONGOPTS): Add entry for handling --fix-stm32l4xx-629360. (PARSE_AND_LIST_OPTION): Add entry for helping on --fix-stm32l4xx-629360. (PARSE_AND_LIST_ARGS_CASES): Treat OPTION_STM32L4XX_FIX. tests * ld-arm/arm-elf.exp (armelftests_common): Add STM32L4XX tests. * ld-arm/stm32l4xx-cannot-fix-far-ldm.d: New. * ld-arm/stm32l4xx-cannot-fix-far-ldm.s: Likewise. * ld-arm/stm32l4xx-cannot-fix-it-block.d: Likewise. * ld-arm/stm32l4xx-cannot-fix-it-block.s: Likewise. * ld-arm/stm32l4xx-fix-all.d: Likewise. * ld-arm/stm32l4xx-fix-all.s: Likewise. * ld-arm/stm32l4xx-fix-it-block.d: Likewise. * ld-arm/stm32l4xx-fix-it-block.s: Likewise. * ld-arm/stm32l4xx-fix-ldm.d: Likewise. * ld-arm/stm32l4xx-fix-ldm.s: Likewise. * ld-arm/stm32l4xx-fix-vldm.d: Likewise. * ld-arm/stm32l4xx-fix-vldm.s: Likewise.
2015-10-22Add "-z call-nop=PADDING" option to ldH.J. Lu1-0/+14
The ld linker can transform indirect call to a locally defined function, foo, via its GOT slot, to either "NOP call foo" or "call foo NOP" where NOP is a 1-byte NOP padding. This patch adds a "-z call-nop=PADDING" option to x86 ld to control 1-byte NOP padding for x86 call instruction. PADDING is one of prefix-addr, prefix-nop, suffix-nop, prefix-NUMBER or suffix-NUMBER. bfd/ * elf32-i386.c (elf_i386_convert_load): Use call_nop_byte and check call_nop_as_suffix for 1-byte NOP padding to pad call. * elf64-x86-64.c (elf_x86_64_convert_load): Likewise. include/ * bfdlink.h (bfd_link_info): Add call_nop_as_suffix and call_nop_byte. ld/ * ld/ld.texinfo: Document "-z call-nop=PADDING" option. * emulparams/call_nop.sh: New file. * emulparams/elf_i386_be.sh: Source ${srcdir}/emulparams/call_nop.sh. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_i386_vxworks.sh: Likewise. * emulparams/elf_iamcu.sh: Likewise. * emulparams/elf_k1om.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Likewise. * emultempl/elf32.em (gld${EMULATION_NAME}_before_parse): Set link_info.call_nop_byte if $CALL_NOP_BYTE isn't empty. ld/testsuite/ * ld-i386/call3.s: New file. * ld-i386/call3a.d: Likewise. * ld-i386/call3b.d: Likewise. * ld-i386/call3c.d: Likewise. * ld-i386/call3d.d: Likewise. * ld-i386/call3e.d: Likewise. * ld-i386/call3f.d: Likewise. * ld-i386/call3g.d: Likewise. * ld-i386/call3h.d: Likewise. * ld-i386/load1-nacl.d: Likewise. * ld-x86-64/call1.s: Likewise. * ld-x86-64/call1a.d: Likewise. * ld-x86-64/call1b.d: Likewise. * ld-x86-64/call1c.d: Likewise. * ld-x86-64/call1d.d: Likewise. * ld-x86-64/call1e.d: Likewise. * ld-x86-64/call1f.d: Likewise. * ld-x86-64/call1g.d: Likewise. * ld-x86-64/call1h.d: Likewise. * ld-x86-64/call1i.d: Likewise. * ld-x86-64/load1a-nacl.d: Likewise. * ld-x86-64/load1b-nacl.d: Likewise. * ld-x86-64/load1c-nacl.d: Likewise. * ld-x86-64/load1d-nacl.d: Likewise.
2015-10-21Reset x86 Linux targets to not compressing debug sections by default. ↵Nick Clifton1-0/+3
Enable compression of debug sections by default in the linker, if so configured. PR gas/19109 . * configure.ac: Note the 'none' is an acceptable argument to --enable-compressed-debug-sections. * configure: Regenerate. gas * configure.ac: Restore --enable-compressed-debug-sections. Do not enable compressed debug sections by default for x86 Linux targets. * configure: Regenerate. ld * configure.ac: Add --enable-compressed-debug-sections. * configure: Regenerate. * config.in: Regenerate. * ld.texinfo: Document how to determine the default action for debug sections. * ldmain.c (main): If DEFAULT_FLAG_COMPRESS_DEBUG is defined then set the compress_debug field of the link_info structure to zlib-gabi. * lexsup.c (elf_static_list_options): Output the default setting for the --compress-debug-sections option. * NEWS: Mention the new configure option.
2015-10-15Fix a typo for "-z noextern-protected-data"H.J. Lu1-1/+1
* ld.texinfo: Fix a typo for "-z noextern-protected-data".
2015-09-29PR/19014: Fix a spelling mistake in the linker documentation.Nick Clifton1-6/+6
2015-09-22Format ld option itemsAlan Modra1-3/+6
* ld.texinfo: Put --dotsyms/--no-dotsyms on separate lines. Ditto for --save-restore-funcs and --tls-get-addr-optimize.
2015-09-20Add --no-dynamic-linker option to ld, for static PIE useRich Felker1-0/+7
Inhibits output of .interp section in ELF executables. include/ * bfdlink.h (struct bfd_link_info): Add "nointerp" field. bfd/ * elflink.c (_bfd_elf_link_create_dynamic_sections): Don't create .interp when info->nointerp. (bfd_elf_size_dynamic_sections): Adjust assert. * elf32-arm.c (elf32_arm_size_dynamic_sections): Don't size .interp when info->nointerp. * elf32-bfin.c (elf32_bfinfdpic_size_dynamic_sections): Likewise. * elf32-cr16.c (_bfd_cr16_elf_size_dynamic_sections): Likewise. * elf32-cris.c (elf_cris_size_dynamic_sections): Likewise. * elf32-frv.c (elf32_frvfdpic_size_dynamic_sections): Likewise. * elf32-hppa.c (elf32_hppa_size_dynamic_sections): Likewise. * elf32-i370.c (i370_elf_size_dynamic_sections): Likewise. * elf32-i386.c (elf_i386_size_dynamic_sections): Likewise. * elf32-lm32.c (lm32_elf_size_dynamic_sections): Likewise. * elf32-m32r.c (m32r_elf_size_dynamic_sections): Likewise. * elf32-m68k.c (elf_m68k_size_dynamic_sections): Likewise. * elf32-metag.c (elf_metag_size_dynamic_sections): Likewise. * elf32-nds32.c (nds32_elf_size_dynamic_sections): Likewise. * elf32-nios2.c (nios2_elf32_size_dynamic_sections): Likewise. * elf32-or1k.c (or1k_elf_size_dynamic_sections): Likewise. * elf32-ppc.c (ppc_elf_size_dynamic_sections): Likewise. * elf32-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf32-score.c (s3_bfd_score_elf_size_dynamic_sections): Likewise. * elf32-score7.c (s7_bfd_score_elf_size_dynamic_sections): Likewise. * elf32-sh.c (sh_elf_size_dynamic_sections): Likewise. * elf32-tic6x.c (elf32_tic6x_size_dynamic_sections): Likewise. * elf32-tilepro.c (tilepro_elf_size_dynamic_sections): Likewise. * elf32-vax.c (elf_vax_size_dynamic_sections): Likewise. * elf32-xtensa.c (elf_xtensa_size_dynamic_sections): Likewise. * elf64-alpha.c (elf64_alpha_size_dynamic_sections): Likewise. * elf64-hppa.c (elf64_hppa_size_dynamic_sections): Likewise. * elf64-ppc.c (ppc64_elf_size_dynamic_sections): Likewise. * elf64-s390.c (elf_s390_size_dynamic_sections): Likewise. * elf64-sh64.c (sh64_elf64_size_dynamic_sections): Likewise. * elf64-x86-64.c (elf_x86_64_size_dynamic_sections): Likewise. * elfnn-aarch64.c (elfNN_aarch64_size_dynamic_sections): Likewise. * elfnn-ia64.c (elfNN_ia64_size_dynamic_sections): Likewise. * elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Likewise. * elfxx-sparc.c (_bfd_sparc_elf_size_dynamic_sections): Likewise. * elfxx-tilegx.c (tilegx_elf_size_dynamic_sections): Likewise. ld/ * ld.texinfo (--no-dynamic-linker): Document. * ldlex.h (enum option_values): Add OPTION_NO_DYNAMIC_LINKER. * lexsup.c (ld_options, parse_args): Handle --no-dynamic-linker.
2015-09-18Add missing PowerPC64 ld --save-restore-funcs docAlan Modra1-0/+10
* ld.texinfo: Document --{no-,}save-restore-funcs.
2015-09-18Add PowerPC64 ld --tls-get-addr-optimize.Alan Modra1-0/+15
Sometimes it may be of benefit to force use of the __tls_get_addr_opt call stub even when the glibc being used during linking does not advertise __tls_get_addr_opt. bfd/ * elf64-ppc.h (struct ppc64_elf_params <tls_get_addr_opt>): Rename from no_tls_get_addr_opt. * elf64-ppc.c: Update for rename and inversion of tls_get_addr_opt. (ppc64_elf_tls_setup): Set tls_get_addr_opt to 0 only when at default of -1. ld/ * emultempl/ppc64elf.em (params): Init tls_get_addr_opt field to -1. (OPTION_TLS_GET_ADDR_OPT): Define. (PARSE_AND_LIST_LONGOPTS): Handle --tls-get-addr-opt. (PARSE_AND_LIST_OPTIONS, PARSE_AND_LIST_ARGS_CASES): Likewise. * ld.texinfo: Document --tls-get-addr-optimize and --no-tls-get-addr-optimize.
2015-09-08Extend the descriptiopn of how to access linker defined symbols from C.Nick Clifton1-0/+13
* ld.texinfo (Source Code Reference): Extend description to include an example using arrays.
2015-09-04ld: Extend options for altering orphan handling behaviour.Andrew Burgess1-11/+33
Replace the options --warn-orphan and --no-warn-orphan with a single option --orphan-handling=MODE, where mode can be place, warn, error, and discard. Mode 'place' is the default, and is the current behaviour, placing the orphan section into a suitable output section. Mode 'warn' is the same as '--warn-orphan'. The orphan is also placed using the same algorithm as for 'place'. Mode 'error' is the same as '--warn-orphan' and '--fatal-warnings'. Mode 'discard' assigns all output sections to the /DISCARD/ section. ld/ChangeLog: * ld.h (enum orphan_handling_enum): New. (ld_config_type): Remove warn_orphan, add orphan_handling. * ldemul.c (ldemul_place_orphan): Remove warning about orphan sections. * ldlang.c (ldlang_place_orphan): New function. (lang_place_orphans): Call ldlang_place_orphan. * ldlex.h (enum option_values): Remove OPTION_WARN_ORPHAN and OPTION_NO_WARN_ORPHAN, add OPTION_ORPHAN_HANDLING. * lexsup.c (ld_options): Remove 'warn-orphan' and 'no-warn-orphan', add 'orphan-handling'. (parse_args): Remove handling for OPTION_WARN_ORPHAN and OPTION_NO_WARN_ORPHAN, add handling for OPTION_ORPHAN_HANDLING. * NEWS: Replace text about --warn-orphan with --orphan-handling. * ld.texinfo (Options): Remove --warn-orphan entry and add entry on --orphan-handling. (Orphan Sections): Add reference to relevant command line options. ld/testsuite/ChangeLog: * ld-elf/elf.exp: Switch to rely on run_dump_test. * ld-elf/orphan-5.l: Update expected output. * ld-elf/orphan-5.d: New file. * ld-elf/orphan-6.d: New file. * ld-elf/orphan-6.l: New file. * ld-elf/orphan-7.d: New file. * ld-elf/orphan-7.map: New file. * ld-elf/orphan-8.d: New file. * ld-elf/orphan-8.map: New file.
2015-09-03Fix typo in desription of linker script symbols.Nick Clifton1-1/+1
(Source Code Reference): Fix off-by-one typo in example of how to use linker script symbols in C source code.
2015-09-03Fix a typo in the linker documentation: The COFF section .build-id should be ↵Nick Clifton1-1/+1
.buildid.
2015-08-06Revert ALIGN changesAlan Modra1-1/+1
Reverts a2c59f28 and e474ab13. Since the unary form of ALIGN only references "dot" implicitly, there isn't really a strong argument for making ALIGN use a relative value when inside an output section. * ldexp.c (align_dot_val): Delete. (fold_unary <ALIGN_K, NEXT>): Revert 2015-07-10 change. (is_align_conditional): Revert 2015-07-20 change. (exp_fold_tree_1): Likewise, but keep expanded comment. * scripttempl/elf.sc (.ldata, .bss): Revert 2015-07-20 change. * ld.texinfo (<ALIGN>): Correct description.
2015-08-04ld: Add '--require-defined' command line option.Andrew Burgess1-0/+16
Add a new command line option '--require-defined' to the linker. This option operates identically to the '--undefined' option, except that if the symbol is not defined in the final output file then the linker will exit with an error. When making use of --gc-section, or just when trying to pull in parts of a library, it is not uncommon for a user to use the '--undefined' command line option to specify a symbol that the user then expects to be defined by one of the object files supplied to the link. However, if for any reason the symbol is not satisfied by an object provided to the link the user will be left with an undefined symbol in the output file, instead of a defined symbol. In some cases the above behaviour is what the user wants, in other cases though we can do better. The '--require-defined' option tries to fill this gap. The symbol passed to the '--require-defined' option is treated exactly as if the symbol was passed to '--undefined', however, before the linker exits a check is made that all symbols passed to '--require-defined' are actually defined, if any are not then the link will fail with an error. ld/ChangeLog: * ld.texinfo (Options): Document --require-defined option. * ldlang.c (struct require_defined_symbol): New structure. (require_defined_symbol_list): New variable. (ldlang_add_require_defined): New function. (ldlang_check_require_defined_symbols): New function. (lang_process): Check required symbols are defined. * ldlang.h (ldlang_add_require_defined): Declare. * ldlex.h (enum option_values): Add OPTION_REQUIRE_DEFINED_SYMBOL. * lexsup.c (ld_options): Add '--require-defined' entry. (parse_args): Handle '--require-defined' entry. * NEWS: Mention new '--require-defined' option. ld/testsuite/ChangeLog: * ld-undefined/require-defined-1.d: New file. * ld-undefined/require-defined-2.d: New file. * ld-undefined/require-defined-3.d: New file. * ld-undefined/require-defined-4.d: New file. * ld-undefined/require-defined-5.d: New file. * ld-undefined/require-defined.exp: New file. * ld-undefined/require-defined.s: New file.
2015-08-03ld/doc: Document that multiple MEMORY commands are allowed.Andrew Burgess1-3/+4
The linker documentation explicitly states that there can be only one MEMORY command. This is not true. Multiple MEMORY commands are allowed, the contents of all will be treated as if a single MEMORY command was given. Update the documentation to make this clear to the users. ld/ChangeLog: * ld.texinfo (MEMORY): Explain that multiple MEMORY commands are acceptable.
2015-07-14Make default compression gABI compliantH.J. Lu1-4/+5
All programs in binutils+gdb git repo now support gABI compression with the SHF_COMPRESSED bit. This patch makes the zlib-gabi option as compression default for gas, gold, ld and objcopy, instead of the zlib-gnu option whose outputs are incompatible with gABI. binutils/ * objcopy.c (copy_file): Set BFD_COMPRESS_GABI if not zlib-gnu. * doc/binutils.texi: Change --compress-debug-sections and --compress-debug-sections=zlib to zlib-gabi. binutils/testsuite/ * binutils-all/compress.exp: Update. gas/ * as.c (parse_args): Make --compress-debug-sections and --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * doc/as.texinfo: Change --compress-debug-sections and --compress-debug-sections=zlib to zlib-gabi. gold/ * compressed_output.cc (Output_compressed_section::set_final_data_size): Make --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * testsuite/Makefile.am (flagstest_compress_debug_sections.check): Expect ".debug_.*" with the SHF_COMPRESSED bit, instead of ".zdebug_". * testsuite/Makefile.in: Regenerated. ld/ * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Make --compress-debug-sections=zlib the same as --compress-debug-sections=zlib-gabi. * ld.texinfo: Change --compress-debug-sections=zlib to zlib-gabi. ld/testsuite/ * ld-elf/zlibbegin.rS: Updated to .debug_.* with the SHF_COMPRESSED bit. * ld-elf/zlibnormal.rS: Likewise.
2015-07-14Fix texinfo problem by adding the required period after an @xref.Nick Clifton1-1/+1
* ld.texinfo (Options): Add missing period after @xref.
2015-07-03Add experimental support for --gc-sections with COFF and PE based targets.Kai Tietz1-1/+3
PR ld/11539 bfd * coffcode.h (coff_bfd_gc_sections): Define default to bfd_coff_gc_sections function. * cofflink.c (init_reloc_cookie): Copy and adjust coff related code about gc-sections from elflink.c to here. (fini_reloc_cookie): Likewise. (init_reloc_cookie_rels): Likewise. (fini_reloc_cookie_rels): Likewise. (init_reloc_cookie_for_section): Likewise. (fini_reloc_cookie_for_section): Likewise. (_bfd_coff_gc_mark_hook): Likewise. (_bfd_coff_gc_mark_rsec): Likewise. (_bfd_coff_gc_mark_reloc): Likewise. (_bfd_coff_gc_mark): Likewise. (_bfd_coff_gc_mark_extra_sections): Likewise. (coff_gc_sweep_symbol_info): Likewise. (coff_gc_sweep_symbol): Likewise. (gc_sweep_hook_fn): Likewise. (coff_gc_sweep): Likewise. (bfd_coff_gc_sections): Likewise. (_bfd_coff_gc_keep): Likewise. * libcoff.h (coff_reloc_cookie): New struct. (bfd_coff_gc_sections): New prototype. (coff_gc_mark_hook_fn): New type. ld * scripttempl/pep.sc: Mark .idata*, .CRT*, .tls*, .rsrc*, .init, .ctor*, .dtor*, .fini, .jcr, .eh_frame, .pdata. .xdata, and .gcc_except_table sections as KEEP. * scripttempl/pe.sc: Likewise.
2015-06-12Add new ld option: --print-memory-usageTristan Gingold1-0/+15
ld/ * NEWS: Mention new option. * lexsup.c (parse_args): Handle --print-memory-usage. (ld_options): Add --print-memory-usage. * ldmain.c (main): Call lang_print_memory_usage. * ldlex.h (enum option_values): Add OPTION_PRINT_MEMORY_USAGE. * ldlang.h: Add prototype of lang_print_memory_usage. * ldlang.c (lang_print_memory_size, lang_print_memory_usage): New functions. * ld.texinfo (Options): Document --print-memory-usage. * ld.h (args_type): Add print_memory_usage field. ld/testsuite/ * ld-scripts/print-memory-usage-1.t, * ld-scripts/print-memory-usage-1.s, * ld-scripts/print-memory-usage-1.l, * ld-scripts/print-memory-usage-2.t, * ld-scripts/print-memory-usage-2.l, * ld-scripts/print-memory-usage-3.s, * ld-scripts/print-memory-usage-3.t, * ld-scripts/print-memory-usage-3.l, * ld-scripts/print-memory-usage.t: New tests. * ld-scripts/print-memory-usage.exp: Run them.
2015-05-14Update description of the ASSERT linker script command to note its ↵Nick Clifton1-0/+30
interation with PROVIDEd symbols. * ld.texinfo (ASSERT): Describe the interaction with PROVIDEd symbols.
2015-04-14Add --compress-debug-sections=[none|zlib|zlib-gnu|zlib-gabi]H.J. Lu1-0/+16
This patch adds --compress-debug-sections=[none|zlib|zlib-gnu|zlib-gabi] to ld for ELF targets to support generating compressed DWARF debug sections. We always generate .zdebug_* section since section names have been finalized and they can't be changed easily when compression is being performed. bfd/ * bfd-in.h (compressed_debug_section_type): New. * compress.c (bfd_compress_section_contents): Add an argument for linker write compression and always generate .zdebug_* section when linking. (bfd_init_section_compress_status): Pass FALSE to bfd_compress_section_contents. (bfd_compress_section): New function. * elf.c (elf_fake_sections): For linking, set SEC_ELF_COMPRESS on DWARF debug sections if COMPRESS_DEBUG is set and rename section if COMPRESS_DEBUG_GABI_ZLIB isn't set. (assign_file_positions_for_non_load_sections): Set sh_offset to -1 if SEC_ELF_COMPRESS is set. (assign_file_positions_except_relocs): Likwise. (_bfd_elf_assign_file_positions_for_relocs): Renamed to ... (_bfd_elf_assign_file_positions_for_non_load): This. Change return time to bfd_boolean. Compress the section if SEC_ELF_COMPRESS is set. (_bfd_elf_write_object_contents): Updated. (_bfd_elf_set_section_contents): Write section contents to the buffer if SEC_ELF_COMPRESS is set. * merge.c: Include "elf-bfd.h". (sec_merge_emit): Add arguments for contents and offset. Write to contents with offset if contents isn't NULL. (_bfd_write_merged_section): Write section contents to the buffer if SEC_ELF_COMPRESS is set. Pass contents and output_offset to sec_merge_emit. * elflink.c (bfd_elf_final_link): Allocate the buffer for output section contents if SEC_ELF_COMPRESS is set. * section.c (SEC_ELF_COMPRESS): New. * bfd-in2.h: Regenerated. gas/ * as.h (compressed_debug_section_type): Removed. include/ * bfdlink.h (bfd_link_info): Add compress_debug. ld/ * ld.texinfo: Document --compress-debug-sections=. * ldmain.c (main): Set BFD_COMPRESS on output_bfd if COMPRESS_DEBUG is set. Set BFD_COMPRESS_GABI on output_bfd for COMPRESS_DEBUG_GABI_ZLIB. * lexsup.c (elf_static_list_options): Add --compress-debug-sections=. * emultempl/elf32.em (OPTION_COMPRESS_DEBUG): New. (xtra_long): Add "compress-debug-sections". (gld${EMULATION_NAME}_handle_option): Handle OPTION_COMPRESS_DEBUG. ld/testsuite/ * ld-elf/compress.exp (build_tests): Add tests for --compress-debug-sections=. (run_tests): Likewise. Add additonal tests for --compress-debug-sections=. * ld-elf/gabiend.rt: New file. * ld-elf/gabinormal.rt: Likewise. * ld-elf/gnubegin.rS: Likewise. * ld-elf/gnunormal.rS: Likewise. * ld-elf/zlibbegin.rS: Likewise. * ld-elf/zlibnormal.rS: Likewise.
2015-04-14Add -z noextern-protected-data to ld for ELF/x86H.J. Lu1-0/+8
Address of protected data defined in the shared library may be external, i.e., due to copy relocation. By default, linker backend checks if relocations against protected data symbols are valid for building shared library and issues an error if relocation isn't allowed. The new option override linker backend default. When -z noextern-protected-data is used, updates on protected data symbols by another module won't be visibile to the resulting shared library. This option is specific to ELF/i386 and ELF/x86-64. bfd/ PR ld/pr17709 * elflink.c (_bfd_elf_adjust_dynamic_copy): Check info->extern_protected_data when warning copy relocs against protected symbols. (_bfd_elf_symbol_refs_local_p): Check info->extern_protected_data when checking protected non-function symbols. include/ PR ld/pr17709 * bfdlink.h (bfd_link_info): Add extern_protected_data. ld/ PR ld/pr17709 * ld.texinfo: Document "-z noextern-protected-data". * ldmain.c (main): Initialize link_info.extern_protected_data to -1. * lexsup.c (elf_shlib_list_options): Add "-z [no]extern-protected-data". * emulparams/elf32_x86_64.sh: Source extern_protected_data.sh. * emulparams/elf_i386.sh: Likewise. * emulparams/elf_i386_be.sh: Likewise. * emulparams/elf_i386_chaos.sh: Likewise. * emulparams/elf_i386_ldso.sh: Likewise. * emulparams/elf_i386_vxworks.sh: Likewise. * emulparams/elf_k1om.sh: Likewise. * emulparams/elf_l1om.sh: Likewise. * emulparams/elf_x86_64.sh: Source extern_protected_data.sh. (PARSE_AND_LIST_OPTIONS): Renamed to ... (PARSE_AND_LIST_OPTIONS_BNDPLT): This. (PARSE_AND_LIST_ARGS_CASE_Z): Renamed to ... (PARSE_AND_LIST_ARGS_CASE_Z_BNDPLT): This. (PARSE_AND_LIST_OPTIONS): Append $PARSE_AND_LIST_OPTIONS_BNDPLT. (PARSE_AND_LIST_ARGS_CASE_Z): Append $PARSE_AND_LIST_ARGS_CASE_Z_BNDPLT. * emulparams/extern_protected_data.sh: New file. ld/testsuite/ PR ld/pr17709 * ld-i386/i386.exp: Run protected6b. * ld-i386/protected6b.d: New file. * ld-x86-64/protected6b.d: Likewise. * ld-x86-64/x86-64.exp: Run protected6b.
2015-04-10Add documentation about the interation of the ARM assembler's -EB option and ↵Nick Clifton1-2/+4
the linker's --be8 option. PR binutils/18198 * ld.texinfo (--be8): Add a note about the interaction of this option with the assembler's -EB option. * doc/c-arm.texi (ARM Options): Add a note about the interaction of the -EB option with the linker's --be8 option.
2015-04-07Add new linker option: --warn-orphan which generates warning messages when ↵Nick Clifton1-0/+11
orphan sections are detected. ld * ld.h (struct ld_config_type): Add new field: warn_orphan. * ldlex.h (enum option_values): Add OPTION_WARN_ORPHAN and OPTION_NO_WARN_ORPHAN. * lexsup.c (ld_options): Add --warn-orphan and --no-warn-orphan. (parse_args): Handle the new options. * ldemul.c (ldemul_place_orphan): If requested, generate a warning message when an orphan section is placed in the output file. * ld.texinfo: Document the new option. * NEWS: Mention the new feature. tests * ld-elf/orphan-5.l: New test - checks the linker's output with --warn-orphan enabled. * ld-elf/elf.exp: Run the new test.
2015-03-02Correct -z nocopyreloc docAlan Modra1-1/+2
This option is misnamed. It should probably be called -z nodynbss, but it's too late to change now. * ld.texinfo (Options <-z nocopyreloc>): Rewrite.
2015-02-13Correct ld.texinfo cross referenceAlan Modra1-4/+3
Fixes warning: @pxref cross-reference name should not contain `:' * ld.texinfo (Options <--defsym>): Correct cross reference.
2015-02-06Document -z text, -z notext and -z textoffH.J. Lu1-0/+9
* ld.texinfo: Document -z text, -z notext and -z textoff. * emultempl/elf32.em (gld${EMULATION_NAME}_list_options): Add -z text, -z notext and -z textoff.
2015-01-02ChangeLog rotatation and copyright year updateAlan Modra1-3/+3
2014-11-24PowerPC64 --plt-alignAlan Modra1-3/+4
Alignment of plt stubs was broken, firstly because the option was being dropped due to the alignment value not being set in the "params" struct used in elf64-ppc.c, and secondly due to not calculating the number of alignment boundary crossings correctly. bfd/ * elf64-ppc.c (plt_stub_pad): Correct. ld/ * ld.texinfo: Correct --plt-align documentation. * emultempl/ppc64elf.em (plt_stub_align): Delete. Use and set params.plt_stub_align instead.
2014-11-18Add -z bndplt to generate BND prefix in PLT entriesIgor Zamyatin1-0/+3
This patch adds "-z bndplt" option Linux/x86-64 linker to generate BND prefix in PLT entries. It also updated Linux/x86-64 assembler not to generate R_X86_64_PLT32_BND nor R_X86_64_PC32_BND relocations. bfd/ 2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com> * elf64-x86-64.c (elf_x86_64_check_relocs): Enable MPX PLT only for -z bndplt. gas/ 2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com> * config/tc-i386-intel.c (i386_operator): Remove last argument from lex_got call. * config/tc-i386.c (reloc): Remove bnd_prefix from parameters' list. Return always BFD_RELOC_32_PCREL. * (output_branch): Remove condition for BFD_RELOC_X86_64_PC32_BND. * (output_jump): Update call to reloc accordingly. * (output_interseg_jump): Likewise. * (output_disp): Likewise. * (output_imm): Likewise. * (x86_cons_fix_new): Likewise. * (lex_got): Remove bnd_prefix from parameters' list in macro and declarations. Don't use BFD_RELOC_X86_64_PLT32_BND. * (x86_cons): Update call to lex_got accordingly. * (i386_immediate): Likewise. * (i386_displacement): Likewise. * (md_apply_fix): Don't use BFD_RELOC_X86_64_PLT32_BND nor BFD_RELOC_X86_64_PC32_BND. * (tc_gen_reloc): Likewise. include/ 2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com> * bfdlink.h (struct bfd_link_info): Add bndplt. ld/ 2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com> * emulparams/elf_x86_64.sh (BNDPLT): Set to yes for x86_64. * emultempl/elf32.em (gld${EMULATION_NAME}_handle_option): Handle "-z bndplt" if BNDPLT is yes. (gld${EMULATION_NAME}_list_options): Add "-z bndplt" entry. * ld.texinfo: Add description for bndplt. ld/testsuite/ 2014-11-18 Igor Zamyatin <igor.zamyatin@intel.com> * testsuite/ld-x86-64/bnd-ifunc-1.d: Add bndplt option. * testsuite/ld-x86-64/bnd-ifunc-2.d: Likewise. * testsuite/ld-x86-64/bnd-plt-1.d: Likewise. Update dissassembly sections. * testsuite/ld-x86-64/mpx.exp: Handle mpx3 and mpx4 tests. * testsuite/ld-x86-64/mpx1a.rd: Remove _BND from relocation name. * testsuite/ld-x86-64/mpx1c.rd: Likewise. * testsuite/ld-x86-64/mpx2a.rd: Likewise. * testsuite/ld-x86-64/mpx2c.rd: Likewise. * testsuite/ld-x86-64/mpx3.dd: New file. * testsuite/ld-x86-64/mpx3a.s: Likewise. * testsuite/ld-x86-64/mpx3b.s: Likewise. * testsuite/ld-x86-64/mpx4.dd: Likewise. * testsuite/ld-x86-64/mpx4a.s: Likewise. * testsuite/ld-x86-64/mpx4b.s: Likewise.
2014-10-24[AArch64] Cortex-A53 erratum 835769 linker workaroundJiong Wang1-0/+7
2014-10-22 Tejas Belagod <tejas.belagod@arm.com> bfd/ * bfd-in.h (bfd_elf64_aarch64_set_options): Add a parameter. * bfd-in2.h (bfd_elf64_aarch64_set_options): Likewise. * elfnn-aarch64.c (aarch64_erratum_835769_stub): New. (elf_aarch64_stub_type): Add new type aarch64_stub_erratum_835769_veneer. (elf_aarch64_stub_hash_entry): New fields for erratum 835769. (aarch64_erratum_835769_fix): New data struct to record erratum 835769. (elf_aarch64_link_hash_table: Global flags for 835769. (aarch64_build_one_stub): Add case for 835769. (aarch64_size_one_stub): Likewise. (aarch64_mem_op_p, aarch64_mlxl_p, aarch64_erratum_sequence,erratum_835769_scan): New. Decode and scan functions for erratum 835769. (elf_aarch64_create_or_find_stub_sec): New. (elfNN_aarch64_size_stubs): Look for erratum 835769 and record them. (bfd_elfNN_aarch64_set_options: Set global flag for 835769. (erratum_835769_branch_to_stub_data, make_branch_to_erratum_835769_stub):New. Connect up all the erratum stubs to occurances by branches. (elfNN_aarch64_write_section): New hook. (aarch64_map_one_stub): Output erratum stub symbol. (elfNN_aarch64_size_dynamic_sections): Init mapping symbol information for erratum 835769. (elf_backend_write_section): Define. ld/ * emultempl/aarch64elf.em: Add command-line option for erratum 835769. ld/testsuite/ * ld-aarch64/aarch64-elf.exp (aarch64elftests): Drive erratum 835769 tests. * ld-aarch64/erratum835769.d: New. * ld-aarch64/erratum835769.s: New.
2014-10-15ld.texinfo: "=" path-prefix forces sysroot in scripts not only SEARCH_DIRHans-Peter Nilsson1-1/+3
* ld.texinfo (input files in linker scripts): When mentioning behavior of first character "/" on scripts within sysroot, also mention that effect can be forced by prefixing with "=" and refer to SEARCH_DIR.
2014-10-15ld.texinfo: Clarify that sysroot affects "=" expansion.Hans-Peter Nilsson1-1/+2
* ld.texinfo (Options): When mentioning "=" and sysroot, mention that --sysroot controls it, not only through the configuration.
2014-08-20Enabling the HIGH_ENTROPY_VA flag allows the operating system to useNick Clifton1-0/+5
addresses outside of the 32-bit range before memory exhaustion. This results in a higher entropy implementation of ASLR when used with the DYNAMIC_BASE flag. * include/coff/pe.h: Add HIGH_ENTROPY_VA flag * ld/emultempl/pep.em: Add --high-entropy-va switch * ld/ld.texinfo: Document the --high-entropy-va switch
2014-08-18PR 17287, DT_NEEDED of unneeded libraries affects --as-neededAlan Modra1-2/+2
PR 17287 bfd/ * elflink.c (on_needed_list): Only consider libraries that have been loaded. ld/ * ld.texinfo (--as-needed): Clarify that references from libraries must be from needed libraries. ld/testsuite/ * ld-plugin/needed3.c: New file. * ld-elf/shared.exp: Add needed3 test.
2014-08-08 * ldlang.h (struct lang_input_statement_flags): Add pushedUlrich Drepper1-0/+28
member. * ldlex.h (enum option_values): Add OPTION_PUSH_STATE and OPTION_POP_STATE. * lexsup.c (ld_options): Add entries for --push-state and --pop-state. (parse_args): Handle OPTION_PUSH_STATE and OPTION_POP_STATE. * ld.texinfo: Document --push-state and --pop-state.
2014-06-26Change the default behaviour of the PE targeted linker so that timestamps areLinda Zhang1-3/+9
inserted. This is for compatibility with other, non-GNU tools. Deterministic binaries can still be created by using the new --no-insert-timestamp command line option. * emultempl/pe.em: Initialise insert_timestamp to true. Add a --no-insert-timestamp command line option. * emultempl/pep.em: Likewise. * ld.texinfo: Document that --insert-timestamp is enabled by default and that it now has an inverse command line option. * NEWS: Mention the new behaviour.
2014-04-09Remove remaining default manifest support.Nick Clifton1-8/+0
* Makefile.am (default-manifest.o): Remove rule. (EMUL_EXTRA_BINARIES): Delete. (ALL_EMUL_EXTRA_BINARIES): Delete. (ld_new_DEPENDENCIES): Remove EMUL_EXTRA_BINARIES. (install-data-local): Remove EMUL_EXTRA_BINARIES. * Makefile.in: Regenerate. * configure.in (all_emul_extra_binaries): Delete. (EMUL_EXTRA_BINARIES): Remove. * configure: Regenerate. * configure.tgt (target_extra_binaries): Delete. * emultempl/default-manifest.rc: Delete. * ld.texinfo: Remove discussion of default manifest. * emulparams/i386pe.sh (DEFAULT_MANIFEST): Delete. * emulparams/i386pep.sh (DEFAULT_MANIFEST): Delete.
2014-04-08Add support for generating and inserting build IDs into COFF binaries.Jon TURNEY1-10/+10
* 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-04Document optional comma in linker script.Cary Coutant1-2/+7
The linker script documentation does not mention the optional comma that may follow an output section command or an overlay command. In some cases, where a fill expression is used, and the next output section command begins with an operator (e.g., "/DISCARD/"), the comma may be required to separate the two commands. Currently, GNU ld doesn't require the comma, but gold does. ld/ PR gold/16804 * ld.texinfo: Document optional comma following output section command and overlay command.
2014-03-212014-03-21 Christopher Faylor <me.binutils2014@cgf.cx>Chris Faylor1-5/+6
* ld.texinfo: Document change in handling of --enable-auto-image-base. * emultempl/pe.em (pe_auto_image_base): Set to default base. (gld_${EMULATION_NAME}_list_options): Change usage message to reflect optional --enable-auto-image-base argument. (gld${EMULATION_NAME}_handle_option): Handle optional --enable-auto-image-base argument. (compute_dll_image_base): Eliminate constant. Use pe_auto_image_base.
2014-03-05Update copyright yearsAlan Modra1-1/+1
2014-02-27This patch adds support for ARM PLT entries that support a full 32-bit ↵Yuri Gribov1-14/+21
offset range. Enabled via the use of a new linker command line option: --long-plt. * bfd-in.h: Add export of bfd_elf32_arm_use_long_plt. * bfd-in2.h: Regenerate. * elf32-arm.c (elf32_arm_plt_entry_long): New array. (elf32_arm_link_hash_table_create): Set plt_entry_size to 16 if using long PLT entries. (bfd_elf32_arm_use_long_plt): New function. (elf32_arm_populate_plt_entry): Add support for long PLT entries. * emultempl/armelf.em (OPTION_LONG_PLT): Define. (PARSE_AND_LIST_LONGOPTS): Add long-plt. (PARSE_AND_LIST_OPTIONS): Likewise. (PARSE_AND_LIST_ARGS_CASES): Handle long-plt. * ld.texinfo: Document --long-plt. * ld-arm/long-plt-format.s: New test case. * ld-arm/long-plt-format.d: Expected disassembly. * ld-arm/arm-elf.exp: Run the new test.
2014-02-27This patch adds a default manifest in to the final links performed by the ↵Nick Clifton1-0/+9
Cygwin and MinGW targets. The manifest is necessary in order for the linked binaries to be executed in a Windows 8 environment. The manifest is added using a linker script so that this feature will be compiler-neutral. The resource merging code in the linker means that if an application provides its own manifest then the default manifest will be ignored. * configure.in (all_emul_extra_binaries): New variable. Populated by invoking configure.tgt. (EMUL_EXTRA_BINARIES): New substitution. * configure: Regenerate. * configure.tgt (target_extra_binaries): New variable. Set to default-manifest.o for Cygwin and MinGW targets. * Makefile.am (EMUL_EXTRA_BINARIES): New variable. Initialised by the configure script. (ALL_EMUL_EXTRA_BINARIES): New variable. (default-manifest.o): New rule to build the default manifest. (ld_new_DEPENDENCIES): Add EMUL_EXTRA_BINARIES. (install-data-local): Add EMUL_EXTRA_BINARIES. * Makefile.in: Regenerate. * ld.texinfo: Document default manifest support. * emulparams/i386pe.sh (DEFAULT_MANIFEST): Define. * emulparams/i386pep.sh (DEFAULT_MANIFEST): Define. * emultempl/default-manifest.rc: New file. * scripttempl/pe.sc (R_RSRC): Include DEFAULT_MANIFEST, if defined. * scripttempl/pep.sc (R_RSRC): Likewise. * ld-pe/longsecn-1.d: Allow for extra sections. * ld-pe/longsecn-2.d: Likewise. * ld-pe/longsecn.d: Likewise. * ld-pe/secrel.d: Likewise.
2014-02-02Fix ALIGN_WITH_INPUTSebastian Huber1-4/+2
ld/ 2014-02-02 Sebastian Huber <sebastian.huber@embedded-brains.de> * ld/ld.texinfo: Change ALIGN_WITH_INPUT documentation. * ld/ldlang.c (lang_size_sections_1): Add dotdelta variable which reflects the VMA change due to alignment requirements. Use dotdelta do change the LMA if ALIGN_WITH_INPUT is requested. ld/testsuite/ChangeLog 2014-02-02 Sebastian Huber <sebastian.huber@embedded-brains.de> * ld-scripts/rgn-at9.d: New file. * ld-scripts/rgn-at9.t: Likewise. * ld-scripts/rgn-at10.d: Likewise. * ld-scripts/rgn-at10.s: Likewise. * ld-scripts/rgn-at10.t: Likewise. * ld-scripts/rgn-at11.d: Likewise. * ld-scripts/rgn-at11.t: Likewise.
2014-01-30Nios II CALL26 linker relaxationSandra Loosemore1-0/+44
2014-01-30 Sandra Loosemore <sandra@codesourcery.com> bfd/ * bfd-in2.h: Update from reloc.c. * elf32-nios2.c: Include elf32-nios2.h. (elf_nios2_howto_table_rel): Add entry for R_NIOS2_CALL26_NOAT. (nios2_reloc_map): Likewise. (enum elf32_nios2_stub_type): Declare. (struct elf32_nios2_stub_hash_entry): Declare. (nios2_stub_hash_entry, nios2_stub_hash_lookup): New macros. (struct elf32_nios2_link_hash_entry): Add hsh_cache field. (struct elf32_nios2_link_hash_table): Add new fields bstab, stub_bfd, add_stub_section, layout_sections_again, stub_group, bfd_count, top_index, input_list, all_local_syms. (nios2_call26_stub_entry): New. (nios2_elf32_install_imm16): Move up in file. (nios2_elf32_install_data): Move up in file. (hiadj): Move up in file. (stub_hash_newfunc): New. (link_hash_newfunc): Initialize hsh_cache field. (STUB_SUFFIX): New. (nios2_stub_name): New. (nios2_get_stub_entry): New. (nios2_add_stub): New. (nios2_elf32_setup_section_lists): New. (nios2_elf32_next_input_section): New. (CALL26_SEGMENT): New. (MAX_STUB_SECTION_SIZE): New. (group_sections): New. (nios2_type_of_stub): New. (nios2_build_one_stub): New. (nios2_size_one_stub): New. (get_local_syms): New. (nios2_elf32_size_stubs): New. (nios2_elf32_build_stubs): New. (nios2_elf32_do_call26_relocate): Correct CALL26 overflow test. (nios2_elf32_relocate_section): Handle R_NIOS2_CALL26_NOAT. Add trampolines for R_NIOS2_CALL26 stubs. (nios2_elf32_check_relocs): Handle R_NIOS2_CALL26_NOAT. (nios2_elf32_gc_sweep_hook): Likewise. (nios2_elf32_link_hash_table_create): Initialize the stub hash table. (nios2_elf32_link_hash_table_free): New. (bfd_elf32_bfd_link_hash_table_free): Define. * elf32-nios2.h: New file. * libbfd.h: Update from reloc.c. * reloc.c (BFD_RELOC_NIOS2_CALL26_NOAT): New. gas/ * config/tc-nios2.c (md_apply_fix): Handle BFD_RELOC_NIOS2_CALL26_NOAT. (nios2_assemble_args_m): Likewise. (md_assemble): Likewise. gas/testsuite/ * gas/nios2/call26_noat.d: New. * gas/nios2/call26_noat.s: New. * gas/nios2/call_noat.d: New. * gas/nios2/call_noat.s: New. include/elf/ * nios2.h (elf_nios2_reloc_type): Add R_NIOS2_CALL26_NOAT. ld/ * Makefile.am (enios2elf.c, enios2linux.c): Update dependencies. * Makefile.in: Regenerated. * emulparams/nios2elf.sh (EXTRA_EM_FILE): Set. * emulparams/nios2linux.sh (EXTRA_EM_FILE): Set. * emultempl/nios2elf.em: New file. * gen-doc.texi (NIOSII): Set. * ld.texinfo (NIOSII): Set. ld/testsuite/ * ld-nios2/relax_call26.s: New. * ld-nios2/relax_call26_boundary.ld: New. * ld-nios2/relax_call26_boundary.s: New. * ld-nios2/relax_call26_boundary_c8.d: New. * ld-nios2/relax_call26_boundary_cc.d: New. * ld-nios2/relax_call26_boundary_d0.d: New. * ld-nios2/relax_call26_boundary_d4.d: New. * ld-nios2/relax_call26_boundary_d8.d: New. * ld-nios2/relax_call26_boundary_dc.d: New. * ld-nios2/relax_call26_boundary_f0.d: New. * ld-nios2/relax_call26_boundary_f4.d: New. * ld-nios2/relax_call26_boundary_f8.d: New. * ld-nios2/relax_call26_boundary_fc.d: New. * ld-nios2/relax_call26_cache.d: New. * ld-nios2/relax_call26_cache.ld: New. * ld-nios2/relax_call26_cache.s: New. * ld-nios2/relax_call26_multi.d: New. * ld-nios2/relax_call26_multi.ld: New. * ld-nios2/relax_call26_norelax.d: New. * ld-nios2/relax_call26_shared.d: New. * ld-nios2/relax_call26_shared.ld: New.
2014-01-22Make assignments to dot keep an empty output section.Alan Modra1-4/+9
An assignment to dot in an output section that allocates space of course keeps the output section. Here, I'm changing the behaviour for assignments that don't allocate space. The idea is not so much to allow people to force output of an empty section with ". = .", but to fix cases where an otherwise empty section has padding added by an alignment expression that changes with relaxation or .eh_frame editing. Such a section might have zero size before relaxation and so be stripped incorrectly. ld/ * ld.texinfo (Output Section Discarding): Mention assigning to dot as a way of keeping otherwise empty sections. * ldexp.c (is_dot, is_value, is_sym_value, is_dot_ne_0, is_dot_plus_0, is_align_conditional): New predicates. (exp_fold_tree_1): Set SEC_KEEP when assigning to dot inside an output section, except for some special cases. * scripttempl/elfmicroblaze.sc: Use canonical form to align at end of .heap and .stack. ld/testsuite/ * ld-shared/elf-offset.ld: Align end of .bss with canonical form of ALIGN that allows an empty .bss to be removed. * ld-arm/arm-dyn.ld: Likewise. * ld-arm/arm-lib.ld: Likewise. * ld-elfvsb/elf-offset.ld: Likewise. * ld-mips-elf/mips-dyn.ld: Likewise. * ld-mips-elf/mips-lib.ld: Likewise. * ld-arm/arm-no-rel-plt.ld: Remove duplicate ALIGN. * ld-powerpc/vle-multiseg-1.ld: Remove ALIGN at start of section. ALIGN address of section instead. * ld-powerpc/vle-multiseg-2.ld: Likewise. * ld-powerpc/vle-multiseg-3.ld: Likewise. * ld-powerpc/vle-multiseg-4.ld: Likewise. * ld-powerpc/vle-multiseg-6.ld: Likewise. * ld-scripts/empty-aligned.d: Check section headers not program headers. Remove xfail and notarget. * ld-scripts/empty-aligned.t: Use canonical ALIGN for end of .text2.
2014-01-10Don't adjust LOAD segment to match GNU_RELRO segmentAlan Modra1-2/+4
Instead, fix Jakub's original code setting up the PR_GNU_RELRO header from the PT_LOAD header. PR ld/14207 PR ld/16322 PR binutils/16323 bfd/ * elf.c (assign_file_positions_for_load_sections): Revert last change. (assign_file_positions_for_non_load_sections): When setting up PT_GNU_RELRO header, don't require a corresponding PT_LOAD header that completely covers the relro region. ld/ * ldlang.c (lang_size_sections): Remove unneeded RELRO base adjust. Tidy comments. * ld.texinfo (DATA_SEGMENT_RELRO_END): Correct description. ld/testsuite/ * ld-x86-64/pr14207.d: Adjust