aboutsummaryrefslogtreecommitdiff
path: root/ld
AgeCommit message (Collapse)AuthorFilesLines
2019-01-19Add markers for 2.32 branch to NEWS and ChangeLog files.Nick Clifton1-0/+4
2019-01-16RISC-V: Merge ELF attribute for ld.Jim Wilson38-0/+189
2019-01-16 Kito Cheng <kito@andestech.com> Nelson Chu <nelson@andestech.com> bfd/ * elfnn-riscv.c (in_subsets): New. (out_subsets): Likewise. (merged_subsets): Likewise. (riscv_std_ext_p): Likewise. (riscv_non_std_ext_p): Likewise. (riscv_std_sv_ext_p): Likewise. (riscv_non_std_sv_ext_p): Likewise. (riscv_version_mismatch): Likewise. (riscv_i_or_e_p): Likewise. (riscv_merge_std_ext): Likewise. (riscv_merge_non_std_and_sv_ext): Likewise. (riscv_merge_arch_attr_info): Likewise. (riscv_merge_attributes): Likewise. (_bfd_riscv_elf_merge_private_bfd_data): Merge attribute. ld/ * testsuite/ld-elf/orphan-region.d: XFAIL for RISC-V, because add new section. * testsuite/ld-riscv-elf/ld-riscv-elf.exp: Add new tests. * testsuite/ld-riscv-elf/attr-merge-arch-01.d: New test. * testsuite/ld-riscv-elf/attr-merge-arch-01a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-01b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-02.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-02a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-02b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-03.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-03a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-03b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-failed-01.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-failed-01a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-arch-failed-01b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec-a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec-b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-priv-spec.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align-a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align-b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align-failed-a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align-failed-b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align-failed.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-stack-align.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-01.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-01a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-01b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-02.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-02a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-02b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-03.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-03a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-03b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-04.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-04a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-04b.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-05.d: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-05a.s: Likewise. * testsuite/ld-riscv-elf/attr-merge-strict-align-05b.s: Likewise.
2019-01-14Correct PR number in prevvious deltaNick Clifton1-2/+2
2019-01-14Add support to GNU ld to separate got related plt entries from normal ones ↵Maamoun Tarsha17-97/+125
in order to be able to switch the non-plt got entries to read-only after startup, conforming to revised Linux for zSeries ABI. PR 20133 * emulparams/elf64_s390.sh (SEPARATE_GOTPLT): Define. * emulparams/elf_s390.sh (SEPARATE_GOTPLT): Define. * testsuite/ld-s390/gotreloc_31-1.dd: Update expected output. * testsuite/ld-s390/tlsbin.dd: Likewise. * testsuite/ld-s390/tlsbin.rd: Likewise. * testsuite/ld-s390/tlsbin.sd: Likewise. * testsuite/ld-s390/tlsbin_64.dd: Likewise. * testsuite/ld-s390/tlsbin_64.rd: Likewise. * testsuite/ld-s390/tlsbin_64.sd: Likewise. * testsuite/ld-s390/tlspic.dd: Likewise. * testsuite/ld-s390/tlspic.rd: Likewise. * testsuite/ld-s390/tlspic.sd: Likewise. * testsuite/ld-s390/tlspic_64.dd: Likewise. * testsuite/ld-s390/tlspic_64.rd: Likewise. * testsuite/ld-s390/tlspic_64.sd: Likewise. * testsuite/ld-s390/s390.exp: Skip s390 tests for tpf targets.
2019-01-14ld: Clarify --wrap documentationSebastian Huber2-0/+24
ld/ * ld.texi (--wrap): Add example to emphasise that only undefined references are replaced by the linker.
2019-01-09Updated Spanish translation for the ld sub-directory.Nick Clifton2-138/+195
* po/es.po: Updated Spanish translation.
2019-01-09Adjust bfd/warning.m4 egrep patternsAndrew Paprocki2-5/+9
Adjust the `bfd/warning.m4` `egrep` patterns to handle preprocessors that do not define `__GNUC__`, leaving the string in the output. bfd/ * warning.m4: Adjust egrep pattern for non-GNU compilers. * configure: Regenerate. binutils/ * configure: Regenerate. gas/ * configure: Regenerate. gold/ * configure: Regenerate. gprof/ * configure: Regenerate. ld/ * configure: Regenerate. opcodes/ * configure: Regenerate.
2019-01-08run_dump_test source in build directoryAlan Modra3-27/+33
Some existing tests build .s and .d files for run_dump_test, using an absolute #source: line in the .d file. This patch changes that scheme a little to instead use "#source: ./..." in .d files rather than "#source: $objdir/...", which is more useful in cases where the .d file is not generated. This allows RX gas test files to be built in the build directory, rather than in a source directory (which might be read-only). binutils/ * testsuite/lib/binutils-common.exp (run_dump_test): Don't prepend $srcdir/$subdir to source file name if it starts with "./". gas/ * testsuite/gas/rx/rx.exp: Create generated test source in current directory. * testsuite/gas/rx/Xtod.d, * testsuite/gas/rx/abs.d, * testsuite/gas/rx/adc.d, * testsuite/gas/rx/add.d, * testsuite/gas/rx/and.d, * testsuite/gas/rx/bclr.d, * testsuite/gas/rx/bcnd.d, * testsuite/gas/rx/bfmov.d, * testsuite/gas/rx/bmcnd.d, * testsuite/gas/rx/bnot.d, * testsuite/gas/rx/bra.d, * testsuite/gas/rx/brk.d, * testsuite/gas/rx/bset.d, * testsuite/gas/rx/bsr.d, * testsuite/gas/rx/btst.d, * testsuite/gas/rx/clrpsw.d, * testsuite/gas/rx/cmp.d, * testsuite/gas/rx/dabs.d, * testsuite/gas/rx/dadd.d, * testsuite/gas/rx/dbt.d, * testsuite/gas/rx/dcmp.d, * testsuite/gas/rx/ddiv.d, * testsuite/gas/rx/div.d, * testsuite/gas/rx/divu.d, * testsuite/gas/rx/dmov.d, * testsuite/gas/rx/dmul.d, * testsuite/gas/rx/dneg.d, * testsuite/gas/rx/dpopm.d, * testsuite/gas/rx/dpushm.d, * testsuite/gas/rx/dround.d, * testsuite/gas/rx/dsqrt.d, * testsuite/gas/rx/dsub.d, * testsuite/gas/rx/dtoX.d, * testsuite/gas/rx/emaca.d, * testsuite/gas/rx/emsba.d, * testsuite/gas/rx/emul.d, * testsuite/gas/rx/emula.d, * testsuite/gas/rx/emulu.d, * testsuite/gas/rx/fadd.d, * testsuite/gas/rx/fcmp.d, * testsuite/gas/rx/fdiv.d, * testsuite/gas/rx/fmul.d, * testsuite/gas/rx/fsqrt.d, * testsuite/gas/rx/fsub.d, * testsuite/gas/rx/ftoi.d, * testsuite/gas/rx/ftou.d, * testsuite/gas/rx/gprel.d, * testsuite/gas/rx/int.d, * testsuite/gas/rx/itof.d, * testsuite/gas/rx/jmp.d, * testsuite/gas/rx/jsr.d, * testsuite/gas/rx/machi.d, * testsuite/gas/rx/maclh.d, * testsuite/gas/rx/maclo.d, * testsuite/gas/rx/max.d, * testsuite/gas/rx/min.d, * testsuite/gas/rx/mov.d, * testsuite/gas/rx/movco.d, * testsuite/gas/rx/movli.d, * testsuite/gas/rx/movu.d, * testsuite/gas/rx/msbhi.d, * testsuite/gas/rx/msblh.d, * testsuite/gas/rx/msblo.d, * testsuite/gas/rx/mul.d, * testsuite/gas/rx/mulhi.d, * testsuite/gas/rx/mullh.d, * testsuite/gas/rx/mullo.d, * testsuite/gas/rx/mvfacgu.d, * testsuite/gas/rx/mvfachi.d, * testsuite/gas/rx/mvfaclo.d, * testsuite/gas/rx/mvfacmi.d, * testsuite/gas/rx/mvfc.d, * testsuite/gas/rx/mvfcp.d, * testsuite/gas/rx/mvfdc.d, * testsuite/gas/rx/mvfdr.d, * testsuite/gas/rx/mvtacgu.d, * testsuite/gas/rx/mvtachi.d, * testsuite/gas/rx/mvtaclo.d, * testsuite/gas/rx/mvtc.d, * testsuite/gas/rx/mvtcp.d, * testsuite/gas/rx/mvtdc.d, * testsuite/gas/rx/neg.d, * testsuite/gas/rx/nop.d, * testsuite/gas/rx/not.d, * testsuite/gas/rx/opecp.d, * testsuite/gas/rx/or.d, * testsuite/gas/rx/pop.d, * testsuite/gas/rx/popc.d, * testsuite/gas/rx/popm.d, * testsuite/gas/rx/push.d, * testsuite/gas/rx/pushc.d, * testsuite/gas/rx/pushm.d, * testsuite/gas/rx/r-bcc.d, * testsuite/gas/rx/r-bra.d, * testsuite/gas/rx/racl.d, * testsuite/gas/rx/racw.d, * testsuite/gas/rx/rdacl.d, * testsuite/gas/rx/rdacw.d, * testsuite/gas/rx/revl.d, * testsuite/gas/rx/revw.d, * testsuite/gas/rx/rmpa.d, * testsuite/gas/rx/rolc.d, * testsuite/gas/rx/rorc.d, * testsuite/gas/rx/rotl.d, * testsuite/gas/rx/rotr.d, * testsuite/gas/rx/round.d, * testsuite/gas/rx/rstr.d, * testsuite/gas/rx/rte.d, * testsuite/gas/rx/rtfi.d, * testsuite/gas/rx/rts.d, * testsuite/gas/rx/rtsd.d, * testsuite/gas/rx/sat.d, * testsuite/gas/rx/satr.d, * testsuite/gas/rx/save.d, * testsuite/gas/rx/sbb.d, * testsuite/gas/rx/sccnd.d, * testsuite/gas/rx/scmpu.d, * testsuite/gas/rx/setpsw.d, * testsuite/gas/rx/shar.d, * testsuite/gas/rx/shll.d, * testsuite/gas/rx/shlr.d, * testsuite/gas/rx/smovb.d, * testsuite/gas/rx/smovf.d, * testsuite/gas/rx/smovu.d, * testsuite/gas/rx/sstr.d, * testsuite/gas/rx/stnz.d, * testsuite/gas/rx/stz.d, * testsuite/gas/rx/sub.d, * testsuite/gas/rx/suntil.d, * testsuite/gas/rx/swhile.d, * testsuite/gas/rx/tst.d, * testsuite/gas/rx/utof.d, * testsuite/gas/rx/wait.d, * testsuite/gas/rx/xchg.d, * testsuite/gas/rx/xor.d: Add #source line. ld/ * testsuite/ld-elf/sec64k.exp: Use . rather than $objdir in generated source file names. * testsuite/ld-m68k/m68k-got.exp: Likewise.
2019-01-01Update year range in copyright notice of binutils filesAlan Modra330-392/+396
2019-01-01ChangeLog rotationAlan Modra2-4748/+4762
2018-12-31PR24042, Global-buffer-overflow problem in output_rel_findAlan Modra2-8/+20
place_orphan handled ELF SHT_REL/SHT_RELA specially, output_rel_find didn't. This mismatch was a bug and also meant it was possible to craft an object where ld accessed section->name out of bounds. PR 24042 * emultempl/elf32.em (output_rel_find): Drop "sec" param. Add "rela". (gld${EMULATION_NAME}_place_orphan): Use sh_type to calculate "rela" param of output_rel_find when ELF. Tidy uses of elfinput.
2018-12-19x86: Properly handle PLT expression in directiveH.J. Lu6-0/+64
For PLT expressions, we should subtract the PLT relocation size only for jump instructions. Since PLT relocations are PC relative, we only allow "symbol@PLT" in PLT expression. gas/ PR gas/23997 * config/tc-i386.c (x86_cons): Check for invalid PLT expression. (md_apply_fix): Subtract the PLT relocation size only for jump instructions. * testsuite/gas/i386/reloc32.s: Add test for invalid PLT expression. * testsuite/gas/i386/reloc64.s: Likewise. * testsuite/gas/i386/ilp32/reloc64.s: Likewise. * testsuite/gas/i386/reloc32.l: Updated. * testsuite/gas/i386/reloc64.l: Likewise. * testsuite/gas/i386/ilp32/reloc64.l: Likewise. ld/ PR gas/23997 * testsuite/ld-i386/i386.exp: Run PR gas/23997 test. * testsuite/ld-x86-64/x86-64.exp: Likewise. * testsuite/ld-x86-64/pr23997a.s: New file. * testsuite/ld-x86-64/pr23997b.c: Likewise. * testsuite/ld-x86-64/pr23997c.c: Likewise.
2018-12-19Rename PR ld/22842 run-time test to "Run pr22842"H.J. Lu2-1/+6
* testsuite/ld-x86-64/x86-64.exp: Rename PR ld/22842 run-time test to "Run pr22842".
2018-12-14elf: Add PT_GNU_PROPERTY segment typeH.J. Lu28-157/+330
Linkers group input note sections with the same name into one output note section with the same name. One output note section is placed in one PT_NOTE segment. New linkers merge all input .note.gnu.property sections into one output .note.gnu.property section with a single NT_GNU_PROPERTY_TYPE_0 note in a single PT_NOTE segment. Since older linkers treat input .note.gnu.property section as a generic note section and just concatenate all input .note.gnu.property sections into one output .note.gnu.property section without merging them, we may see one or more NT_GNU_PROPERTY_TYPE_0 notes in PT_NOTE segment, which are invalid. GNU_PROPERTY_X86_UINT32_VALID was defined to address this issue such that linker sets the bit for non-relocatable outputs. But it isn't sufficient: 1. It doesn't cover generic properties. 2. When -mx86-used-note=yes is passed to x86 assembler, the GNU_PROPERTY_X86_UINT32_VALID bit is set in GNU_PROPERTY_X86_ISA_1_USED property in object file and older linkers generate invalid NT_GNU_PROPERTY_TYPE_0 notes with the GNU_PROPERTY_X86_UINT32_VALID bit set. I am proposing the following changes: 1. Add PT_GNU_PROPERTY segment type: # define PT_GNU_PROPERTY (PT_LOOS + 0x474e553) which covers .note.gnu.property section. 2. Remove GNU_PROPERTY_X86_UINT32_VALID. bfd/ PR ld/23900 * elf.c (get_program_header_size): Add a PT_GNU_PROPERTY segment for NOTE_GNU_PROPERTY_SECTION_NAME. (_bfd_elf_map_sections_to_segments): Create a PT_GNU_PROPERTY segment for NOTE_GNU_PROPERTY_SECTION_NAME. * elfxx-x86.c (_bfd_elf_link_setup_gnu_properties): Don't set GNU_PROPERTY_X86_UINT32_VALID. binutils/ PR ld/23900 * readelf.c (get_segment_type): Support PT_GNU_PROPERTY. (decode_x86_isa): Don't check GNU_PROPERTY_X86_UINT32_VALID. (decode_x86_feature_1): Likewise. (decode_x86_feature_2): Likewise. (print_gnu_property_note): Remove GNU_PROPERTY_X86_UINT32_VALID check. * testsuite/binutils-all/i386/empty.d: Updated. * testsuite/binutils-all/x86-64/empty-x32.d: Likewise. * testsuite/binutils-all/x86-64/empty.d: Likewise. * testsuite/binutils-all/i386/pr21231b.s: Change GNU_PROPERTY_X86_ISA_1_USED bits to 0x7fffffff. * testsuite/binutils-all/x86-64/pr21231b.s: Likewise. gas/ PR ld/23900 * config/tc-i386.c (x86_cleanup): Don't set GNU_PROPERTY_X86_UINT32_VALID. * testsuite/gas/i386/property-1.s: Change GNU_PROPERTY_X86_ISA_1_USED bits to 0. include/ PR ld/23900 * elf/common.h (PT_GNU_PROPERTY): New. (GNU_PROPERTY_X86_UINT32_VALID): Removed. ld/ PR ld/23900 * testsuite/ld-elf/elf.exp: Run PR ld/23900 test. * testsuite/ld-elf/pr23900-1-32.rd: New file. * testsuite/ld-elf/pr23900-1-64.rd: Likewise. * testsuite/ld-elf/pr23900-1.d: Likewise. * testsuite/ld-elf/pr23900-1.s: Likewise. * testsuite/ld-elf/pr23900-2.s: Likewise. * testsuite/ld-elf/pr23900-2a.d: Likewise. * testsuite/ld-elf/pr23900-2b.d: Likewise. * testsuite/ld-i386/ibt-plt-1.d: Adjusted. * testsuite/ld-i386/ibt-plt-2c.d: Likewise. * testsuite/ld-i386/ibt-plt-2d.d: Likewise. * testsuite/ld-i386/ibt-plt-3d.d: Likewise. * testsuite/ld-x86-64/ibt-plt-1-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-1.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2d-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-2c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3c.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3d-x32.d: Likewise. * testsuite/ld-x86-64/ibt-plt-3d.d: Likewise. * testsuite/ld-i386/pr23372c.d: Expect <None> for GNU_PROPERTY_X86_ISA_1_USED. * testsuite/ld-x86-64/pr23372c-x32.d: Likewise. * testsuite/ld-x86-64/pr23372c.d: Likewise. * testsuite/ld-x86-64/pr23372d-x32.d: Likewise. * testsuite/ld-x86-64/pr23372d.d: Likewise. * testsuite/ld-x86-64/property-x86-5a.s: Change GNU_PROPERTY_X86_ISA_1_USED bits to 0. * testsuite/ld-x86-64/property-x86-5b.s: Likewise.
2018-12-11Fix a typo in scripttempl/elf32xc16x.scH.J. Lu2-1/+5
* scripttempl/elf32xc16x.sc: Fix a typo.
2018-12-07Override the previous definition from IR objectH.J. Lu4-0/+23
Mark the previous definition from IR object as undefined so that the generic linker will override it. bfd/ PR ld/23958 * elflink.c (_bfd_elf_add_default_symbol): Override the previous definition from IR object. ld/ PR ld/23958 * testsuite/ld-plugin/lto.exp: Run PR ld/23958 test. * testsuite/ld-plugin/pr23958.c: New file. * testsuite/ld-plugin/pr23958.t: Likewise.
2018-12-07elf: Report property change when merging propertiesH.J. Lu14-2/+57
With merging properties, report property change in linker map file, like Merging program properties Removed property 0xc0010000 to merge /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o (0x0) and /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crti.o (0x0) Removed property 0xc0000002 to merge /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o (0x3) and x.o (not found) Removed property 0xc0000000 to merge /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o (not found) and /usr/lib64/libc_nonshared.a(elf-init.oS) (0x0) Removed property 0xc0000001 to merge /usr/lib/gcc/x86_64-redhat-linux/8/../../../../lib64/crt1.o (not found) and /usr/lib64/libc_nonshared.a(elf-init.oS) (0x0) bfd/ * elf-properties.c (elf_find_and_remove_property): Add a bfd_boolean argument to indicate if the property should be removed. (elf_merge_gnu_property_list): Updated. Report property change in linker map file. (elf_get_gnu_property_section_size): Skip property_remove properties. (elf_write_gnu_properties): Likewise. (_bfd_elf_link_setup_gnu_properties): Report property merge in linker map file. Pass abfd to elf_merge_gnu_property_list. include/ * bfdlink.h (bfd_link_info): Add has_map_file. ld/ * NEWS: Updated for property change report. * ld.texi: Document property change report. * ldmain.c (main): Set link_info.has_map_file to TRUE when linker map file is used. * testsuite/ld-scripts/rgn-over1.d: Updated. * testsuite/ld-scripts/rgn-over2.d: Likewise. * testsuite/ld-scripts/rgn-over3.d: Likewise. * testsuite/ld-scripts/rgn-over4.d: Likewise. * testsuite/ld-scripts/rgn-over5.d: Likewise. * testsuite/ld-scripts/rgn-over6.d: Likewise. * testsuite/ld-scripts/rgn-over7.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt1a-x32.d: Check linker map file. * testsuite/ld-x86-64/property-x86-ibt1a.d: Likewise. * testsuite/ld-x86-64/property-x86-ibt1a.map: New file.
2018-12-04x86: Don't remove empty GNU_PROPERTY_X86_UINT32_OR_AND propertiesH.J. Lu7-0/+40
For GNU_PROPERTY_X86_COMPAT_ISA_1_USED and GNU_PROPERTY_X86_UINT32_OR_AND properties, a bit in the output pr_data field is set if it is set in any relocatable input pr_data fields and this property is present in all relocatable input files. A missing property implies that its bits have unknown values. When all bits in the the output pr_data field are zero, this property should not be removed from output to indicate it has zero in all bits. bfd/ PR ld/23372 * elfxx-x86.c (_bfd_x86_elf_merge_gnu_properties): Don't remove empty properties for GNU_PROPERTY_X86_COMPAT_ISA_1_USED and GNU_PROPERTY_X86_UINT32_OR_AND. (_bfd_x86_elf_link_fixup_gnu_properties): Likewise. ld/ PR ld/23372 * testsuite/ld-i386/pr23372a.d: Updated. * testsuite/ld-i386/pr23372c.d: Likewise. * testsuite/ld-x86-64/pr23372a-x32.d: Likewise. * testsuite/ld-x86-64/pr23372a.d: Likewise. * testsuite/ld-x86-64/pr23372c-x32.d: Likewise. * testsuite/ld-x86-64/pr23372c.d: Likewise.
2018-12-01x86: Delay setting the iplt section alignmentH.J. Lu10-0/+90
Delay setting its alignment until we know it is non-empty. Otherwise an empty iplt section may change vma and lma of the following sections, which triggers moving dot of the following section backwards, resulting in a warning and section lma not being set properly. It later leads to a "File truncated" error. bfd/ PR ld/23930 * elfxx-x86.c (_bfd_x86_elf_size_dynamic_sections): Update the iplt section alignment if it is non-empty. (_bfd_x86_elf_link_setup_gnu_properties): Set plt.iplt_alignment and delay setting the iplt section alignment. * elfxx-x86.h (elf_x86_plt_layout): Add iplt_alignment. ld/ PR ld/23930 * testsuite/ld-i386/i386.exp: Run pr23930. * testsuite/ld-i386/pr23930.d: New file. * testsuite/ld-x86-64/pr23930-32.t: Likewise. * testsuite/ld-x86-64/pr23930-x32.d: Likewise. * testsuite/ld-x86-64/pr23930.d: Likewise. * testsuite/ld-x86-64/pr23930.t: Likewise. * testsuite/ld-x86-64/pr23930a.s: Likewise. * testsuite/ld-x86-64/pr23930b.s: Likewise. * testsuite/ld-x86-64/x86-64.exp: Run pr23930 and pr23930-x32.
2018-11-30PR23937, powerpc64le local ifunc IRELATIVE relocs are wrongAlan Modra4-0/+82
IFUNC resolvers must always be called via their global entry point. They will be called from ld.so rather than from the local executable. PR 23937 bfd/ * elf64-ppc.c (write_plt_relocs_for_local_syms): Don't add local entry offset for ifuncs. ld/ * testsuite/ld-powerpc/pr23937.d, * testsuite/ld-powerpc/pr23937.s: New test. * testsuite/ld-powerpc/powerpc.exp: Run it.
2018-11-29Document purpose of each ld statement listsThomas Preud'homme3-7/+31
When discovering the statement lists via their header variable statement_list, file_chain and input_file_chain it can be confusing to figure out what they are for. They can point to the same initial statement and the relation between the next field they use is not obvious from the name. This commit adds comment for each of those statement list header to explain what they are for and what next field they use. It also rewrite the comment for the next fields to simply redirect the reader to the list header to avoid duplication of documentation. 2018-11-29 Thomas Preud'homme <thomas.preudhomme@linaro.org> ld/ * ldlang.c (statement_list): Document purpose and what next field it uses. (file_chain): Likewise. (input_file_chain): Likewise. * ldlang.h (lang_statement_header_type): Document statement list header the next pointer correspond to. (lang_statement_header_type): Replace comment for next and next_real_file field to refer the reader to their corresponding statement list header.
2018-11-27MIPS/LD: Accept high-part relocations in PIC code with absolute symbolsMaciej W. Rozycki12-0/+110
Accept R_MIPS_HI16, R_MIPS_HIGHER and R_MIPS_HIGHEST relocations and their compressed counterparts in PIC code where the symbol referred is absolute. Such an operation is meaningful, because an absolute symbol effectively is a constant the calculation of the value of which has been deferred to the static link time, and which is not going to change any further at the dynamic load time. Therefore there is no need ever to refuse the use of these relocations with such symbols, as the resulting run-time value observed by the program will be correct even in PIC code. This is not the case with R_MIPS_26 and its compressed counterparts, because the run-time value calculated by the instructions these relocations are used with depends on the address of the instruction itself, and that can change according to the base address used by the dynamic loader. Therefore these relocations have to continue being rejected in PIC code even with absolute symbols. This allows successful linking of code that relies on previous linker behavior up to commit 861fb55ab50a ("Defer allocation of R_MIPS_REL32 GOT slots"), <https://sourceware.org/ml/binutils/2008-08/msg00096.html>, which introduced the problematic check missing this special exception for absolute symbols. bfd/ * elfxx-mips.c (_bfd_mips_elf_check_relocs) <R_MIPS16_HI16> <R_MIPS_HI16, R_MIPS_HIGHER, R_MIPS_HIGHEST, R_MICROMIPS_HI16> <R_MICROMIPS_HIGHER, R_MICROMIPS_HIGHEST>: Also accept an absolute symbol in PIC code. ld/ * testsuite/ld-mips-elf/pic-reloc-0.d: New test. * testsuite/ld-mips-elf/pic-reloc-1.d: New test. * testsuite/ld-mips-elf/pic-reloc-2.d: New test. * testsuite/ld-mips-elf/pic-reloc-3.d: New test. * testsuite/ld-mips-elf/pic-reloc-4.d: New test. * testsuite/ld-mips-elf/pic-reloc-absolute-hi.ld: New test linker script. * testsuite/ld-mips-elf/pic-reloc-absolute-lo.ld: New test linker script. * testsuite/ld-mips-elf/pic-reloc-ordinary.ld: New test linker script. * testsuite/ld-mips-elf/pic-reloc-j.s: New test source. * testsuite/ld-mips-elf/pic-reloc-lui.s: New test source. * testsuite/ld-mips-elf/mips-elf.exp: Run the new tests.
2018-11-27LD: Convert `%P: %H:' to `%H:' in error messagesMaciej W. Rozycki2-3/+10
Similarly to commit 174d0a74a2e6 ("PowerPC/BFD: Convert `%P: %H:' to `%H:' in error messages") convert linker relocation error messages to use `%H:' rather `%P: %H:', removing inconsistent message composition like: $ cat reloc-j.s .text .globl foo .ent foo foo: j bar j bar .end foo $ cat reloc-j.ld SECTIONS { bar = 0x12345678; .text : { *(.text) } /DISCARD/ : { *(*) } } $ as -o reloc-j.o reloc-j.s $ ld -T reloc-j.ld -o reloc-j reloc-j.o ld: tmpdir/reloc-j.o: in function `foo': (.text+0x0): relocation truncated to fit: R_MIPS_26 against `bar' ld: (.text+0x8): relocation truncated to fit: R_MIPS_26 against `bar' $ where subsequent lines referring to issues within a single function have the name of the linker executable prepended, but the first one does not. As noted with the commit referred this breaks a GNU Coding Standard's requirement that error messages from compilers should look like this: source-file-name:lineno: message also quoted in `vfinfo' code handling these specifiers. Remove the linker name prefix then, making the messages now look like: $ ld -T reloc-j.ld -o reloc-j reloc-j.o tmpdir/reloc-j.o: in function `foo': (.text+0x0): relocation truncated to fit: R_MIPS_26 against `bar' (.text+0x8): relocation truncated to fit: R_MIPS_26 against `bar' $ instead. ld/ * ldmain.c (reloc_overflow): Use `%H:' rather than `%P: %H:' with `einfo'. (reloc_dangerous): Likewise. (unattached_reloc): Likewise.
2018-11-27AArch64: Fix regression in Cortex A53 erratum when PIE. (PR ld/23904)Tamar Christina4-0/+100
The fix for PR ld/22263 causes TLS relocations using ADRP to be relaxed into MOVZ, however this causes issues for the erratum code. The erratum code scans the input sections looking for ADRP instructions and notes their location in the stream. It then later tries to find them again in order to generate the linker stubs. Due to the relaxation it instead finds a MOVZ and hard aborts. Since this relaxation is a valid one, and in which case the erratum no longer applies, it shouldn't abort but instead just continue. This changes the TLS relaxation code such that when it finds an ADRP and it relaxes it, it removes the erratum entry from the work list by changing the stub type into none so the stub is ignored. The entry is not actually removed as removal is a more expensive operation and we have already allocated the memory anyway. The clearing is done for IE->LE and GD->LE relaxations, and a testcase is added for the IE case. The GD case I believe to be impossible to get together with the erratum sequence due to the required BL which would break the sequence. However to cover all basis I have added the guard there as well. build on native hardware and regtested on aarch64-none-elf, aarch64-none-elf (32 bit host), aarch64-none-linux-gnu, aarch64-none-linux-gnu (32 bit host) Cross-compiled and regtested on aarch64-none-linux-gnu, aarch64_be-none-linux-gnu Testcase in PR23940 tested and works as expected now and benchmarks ran on A53 showing no regressions and no issues. bfd/ChangeLog: PR ld/23904 * elfnn-aarch64.c (_bfd_aarch64_adrp_p): Use existing constants. (_bfd_aarch64_erratum_843419_branch_to_stub): Use _bfd_aarch64_adrp_p. (struct erratum_835769_branch_to_stub_clear_data): New. (_bfd_aarch64_erratum_843419_clear_stub): New. (clear_erratum_843419_entry): New. (elfNN_aarch64_tls_relax): Use it. (elfNN_aarch64_relocate_section): Pass input_section. (aarch64_map_one_stub): Handle branch type none as valid. ld/ChangeLog: PR ld/23904 * testsuite/ld-aarch64/aarch64-elf.exp: Add erratum843419_tls_ie. * testsuite/ld-aarch64/erratum843419_tls_ie.d: New test. * testsuite/ld-aarch64/erratum843419_tls_ie.s: New test.
2018-11-16(Another) Updated Spanish translation for the ld subdirectory.Nick Clifton3-40/+38
* po/es.po: Updated Spanish translation.
2018-11-15Updated Spanish translation for the ld subdirectory.Nick Clifton2-85/+63
ld * po/es.po: Updated Spanish translation.
2018-11-12i386: Accept both .plt.got and .plt.sec sectionsH.J. Lu2-1/+6
Glibc commit: commit a15529fda8d132621328c3fe32997a3d9c55aef4 Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon May 14 09:23:55 2018 -0700 i386: Replace PREINIT_FUNCTION@PLT with *%eax in call Since we have loaded address of PREINIT_FUNCTION into %eax, we can avoid extra branch to PLT slot. changed __gmon_start__ relocations in crt1.o from 00000015 0000092b R_386_GOT32X 00000000 __gmon_start__ 0000001e 00000904 R_386_PLT32 00000000 __gmon_start__ to 00000015 00000a2b R_386_GOT32X 00000000 __gmon_start__ As the result, .plt.sec section may be generated instead of .plt.got section, depending on __gmon_start__ relocations. * testsuite/ld-i386/plt-main-ibt.dd: Accept both .plt.got and .plt.sec sections.
2018-11-12Update documentation describing how the linker chooses a start address.Nick Clifton2-1/+7
PR 10865 * ld.texi (Entry Point): Make it clear that the text refers to PE-based systems rather than just a PE system.
2018-11-12Updated Spanish translation for the ld subdirectory.Nick Clifton2-59/+35
ld * po/es.po: Updated Spanish translation.
2018-11-09Updated French translation for the ld subdirectory.Nick Clifton2-3/+7
* po/fr.po: Updated French translation.
2018-11-09[ARC] Update ld tests.Claudiu Zissulescu3-3/+8
ld/ xxxx-xx-xx Claudiu Zissulescu <claziss@synopsys.com> * testsuite/ld-arc/tls_gd-01.d: Update test. * testsuite/ld-arc/arclinux-nps.d: Add cpu option.
2018-11-09Allow for compilers that do not produce aligned .rdat sections in PE format ↵Marc3-0/+9
files. PR 23872 * scripttempl/pep.sc (pe.sc): Ensure rdata_runtime_pseudo_relocs are aligned. * scripttempl/pep.sc (pep.sc): Likewise.
2018-11-06elfedit: Add --enable-x86-feature/--disable-x86-featureH.J. Lu8-0/+91
Add --enable-x86-feature and --disable-x86-feature options to elfedit to set and clear the IBT and SHSTK bits in program property in ELF executables and shared objects. binutils/ * doc/binutils.texi: Document --enable-x86-feature and --disable-x86-feature options for elfedit. * elfedit.c: Include "config.h" and <sys/mman.h>. (enable_x86_features): New. (disable_x86_features): Likewise. (update_gnu_property): Likewise. (elf_x86_feature): Likewise. (process_file): Call update_gnu_property on ET_EXEC or ET_DYN file. (command_line_switch): Add OPTION_ENABLE_X86_FEATURE and OPTION_DISABLE_X86_FEATURE. (options): Add--enable-x86-feature and --disable-x86-feature. (usage): Likewise. (main): Handle OPTION_ENABLE_X86_FEATURE and OPTION_DISABLE_X86_FEATURE. ld/ * testsuite/config/default.exp (ELFEDIT): New. * testsuite/ld-elf/linux-x86.exp (elfedit_test): New proc. Run elfedit tests. * testsuite/ld-elf/x86-feature-1a.rd: New file. * testsuite/ld-elf/x86-feature-1b.rd: Likewise. * testsuite/ld-elf/x86-feature-1c.rd: Likewise. * testsuite/ld-elf/x86-feature-1d.rd: Likewise. * testsuite/ld-elf/x86-feature-1e.rd: Likewise.
2018-11-05Correct ChangeLog entries for PR gas/23854 commitH.J. Lu1-1/+1
commit e60f4d3bdac25f02875afe36b7436bc2dfbbb978 Author: H.J. Lu <hjl.tools@gmail.com> Date: Mon Nov 5 09:01:26 2018 -0800 x86: Disable GOT relaxation with data prefix Since linker GOT relaxation isn't valid for 16-bit GOT access, we should disable GOT relaxation with data prefix.
2018-11-05x86: Disable GOT relaxation with data prefixH.J. Lu7-0/+135
Since linker GOT relaxation isn't valid for 16-bit GOT access, we should disable GOT relaxation with data prefix. gas/ PR gas/r23854 * config/tc-i386.c (output_disp): Disable GOT relaxation with data prefix. * testsuite/gas/i386/mixed-mode-reloc32.d: Updated. ld/ PR gas/r23854 * testsuite/ld-i386/i386.exp: Run pr23854. * testsuite/ld-x86-64/x86-64.exp: Likewwise. * testsuite/ld-i386/pr23854.d: New file. * testsuite/ld-i386/pr23854.s: Likewwise. * testsuite/ld-i386/pr23854.d: Likewwise. * testsuite/ld-x86-64/pr23854.d: Likewwise. * testsuite/ld-x86-64/pr23854.s: Likewwise.
2018-11-01Fix ld action in run_dump_testThomas Preud'homme2-17/+5
run_dump_test proposes an ld action but when trying to make use of it in a gas test it gave me some Tcl error. It turns out that it references the check_shared_lib_support procedure and ld_elf_shared_opt variable both only available in ld-lib.exp. I've thus moved the procedure in binutils-common.exp and defined the variable needed in the various default.exp of testsuite that seem to be using run_dump_test. Since check_shared_lib_support itself references the ld variable not defined in binutils-common I've defined it from LD in run_dump_test and fixed LD and LDFLAGS to be defined as expected by run_dump_test in the various default.exp of testsuite using run_dump_test. 2018-11-01 Thomas Preud'homme <thomas.preudhomme@linaro.org> binutils/ * testsuite/config/default.exp: Define LD, LDFLAGS and ld_elf_shared_opt. * testsuite/lib/binutils-common.exp (check_shared_lib_support): Moved from ld-lib.exp. (run_dump_test): Set ld to $LD. gas/ * testsuite/config/default.exp: Define LD, LDFLAGS and ld_elf_shared_opt. ld/ * testsuite/lib/ld-lib.exp (check_shared_lib_support): Moved to binutils-common.exp.
2018-10-29Report scripts and libraries searched for ld --traceAlan Modra6-14/+27
The idea of this change is to make -t output useful for users wanting to package all the object files involved in linking for a bug report. Something like the following should do the trick. gcc hello.c -save-temps -Wl,-t | xargs realpath | sort | uniq > files tar cJf test.tar.xz `cat files` * ldlang.c (load_symbols): When -t, print file names for script files and archives. * ldmain.c (trace_files): Make an int. (add_archive_element): Print archive elements only with multiple -t options, or when archive is thin. * ldmain.h (trace_files): Update. * ldmisc.c (vfinfo): Don't print both original path and path in sysroot. * lexsup.c (parse_args <t>): Increment trace_files.
2018-10-29Remove some ld --trace outputAlan Modra2-3/+9
This output really belongs in ld --verbose. * ldmain.c (main): Print emulation mode and "deleting executable" for --verbose, not --trace. (add_archive_element): Only print "no new IR symbols" for --verbose.
2018-10-29Simplify --sysroot=/Alan Modra2-9/+17
Prepending '/' to absolute paths doesn't gain us much, and results in the current implementation of --trace emitting silly path-in-sysroot output, eg. /lib/ld-linux-x86-64.so.2 (//lib/ld-linux-x86-64.so.2) * ldmain.c (get_sysroot): Return "" for "--sysroot=/".
2018-10-29ld -r script fixesAlan Modra16-35/+58
For ld -r, we generally set the VMA of sections to zero. This is done to make the output of ld -r most similar to that output by the assembler, which generally has sections starting at VMA zero. In some cases that covers for backend bugs which would mis-handle relocatable object files with non-zero section VMAs. This patch fixes a few sections that didn't have zero VMAs for ld -r. A missing zero on .note.gnu.build-id and .eh_frame_hdr doesn't matter much since these are linker generated symbols only output on final link, but it's good to be consistent. * Makefile.am (ei386beos.c, ei386go32.c): Correct dependencies. * Makefile.in: Regenerate. * scripttempl/elf.sc (.note.gnu.build-id, .eh_frame_hdr): Set address with ${RELOCATING-0}. * scripttempl/arclinux.sc: Likewise. * scripttempl/armbpabi.sc: Likewise. * scripttempl/avr.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/mep.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/pru.sc: Likewise. * scripttempl/elf32msp430.sc: Likewise, and for other sections. * scripttempl/epiphany_4x4.sc: Similarly.
2018-10-26ELF: update ld man page on `--gc-sections`Christoph Conrads2-3/+9
Commit 91ae256e33 fixes the behavior of ld when `--gc-sections` and `--gc-keep-exported` are both given on the linker command line. This updates the ld documentation to suit. * ld.texi (--gc-sections): Update.
2018-10-24ELF: Hide symbols defined in discarded input sectionsH.J. Lu6-0/+34
When assigning symbol version, we should hide debug symbols defined in discarded sections from IR objects so that they can be removed later. bfd/ PR ld/23818 * elflink.c (_bfd_elf_link_assign_sym_version): Hide symbols defined in discarded input sections. ld/ PR ld/23818 * testsuite/ld-plugin/lto.exp: Run PR ld/23818 test. * testsuite/ld-plugin/pr23818.d: New file. * testsuite/ld-plugin/pr23818.t: Likewise. * testsuite/ld-plugin/pr23818a.c: Likewise. * testsuite/ld-plugin/pr23818b.c: Likewise.
2018-10-23alpha testsuite fixesAlan Modra3-6/+22
Fixes a couple of ERROR results due to .set difference on alpha. * testsuite/ld-elf/shared.exp: Don't build pr19073 test on alpha. * testsuite/ld-elf/pr18720b.c: Don't use .set on alpha.
2018-10-20Relax a -r --gc-sections requirementAlan Modra2-2/+9
A symbol root is not needed if --gc-keep-exported is also given. * ldlang.c (lang_end): Don't error if no --entry or --undefined is given with -r -gc-sections if --gc-keep-exported.
2018-10-15RISC-V: Adjust __global_pointer$ value to reduce code size.Jim Wilson3-2/+21
ld/ * emulparams/elf32lriscv-defs.sh (DATA_START_SYMBOLS): New. (SDATA_START_SYMBOLS): Define __SDATA_BEGIN__. Don't define __global_pointer$. (OTHER_END_SYMBOLS): New. Define __global_pointer$. * testsuite/ld-riscv-elf/pcrel-lo-addend-2.d (#ld): Add --no-relax.
2018-10-15BFD_INIT_MAGICAlan Modra2-1/+8
This patch performs a run-time test that a shared libbfd.so has been compiled with the same size bfd_vma as that of apps using the library. On a 32-bit host it is easily possible to have one libbfd.so compiled to support 64-bit targets (or configured with --enable-64-bit-bfd) while another only supports 32-bit targets. The two libraries will have differently sized bfd_vma types, and if the wrong one is loaded all sorts of weird behaviour might be seen. bfd/ PR 23534 * init.c (BFD_INIT_MAGIC): Define. (bfd_init): Return BFD_INIT_MAGIC. bfd-in2.h: Regenerate. binutils/ PR 23534 * addr2line.c (main): Exit with fatal error if bfd_init returns an unexpected value. * ar.c (main): Likewise. * dlltool.c (identify_dll_for_implib): Likewise. * nm.c (main): Likewise. * objcopy.c (main): Likewise. * objdump.c (main): Likewise. * size.c (main): Likewise. * strings.c (main): Likewise. * windmc.c (main): Likewise. * windres.c (main): Likewise. gas/ PR 23534 * as.c (main): Exit with fatal error if bfd_init returns an unexpected value. ld/ PR 23534 * ldmain.c (main): Exit with fatal error if bfd_init returns an unexpected value.
2018-10-13ELF ld -r scriptsAlan Modra75-660/+791
"ld -r" generally should not combine object file sections with different names. For example, "ld -r" should not combine ".text", ".text.hot" and ".text.cold" into an output ".text" section. An exception needs to be made for linker created sections, for example, branch trampoline sections that might be created even for ld -r. "ld -r" also should not define symbols in linker scripts. Any definitions are likely to conflict with those defined at final link. A MEMORY spec is also not needed for ld -r. * Makefile.am (eelf32btsmip_fbsd.c, eelf32btsmipn32_fbsd.c), (eelf32epiphany.c, eelf32epiphany_4x4.c, eelf32ltsmip_fbsd.c), (eelf32ltsmipn32_fbsd.c, eelf32xc16x.c, eelf32xc16xl.c), (eelf32xc16xs.c, emcorepe.c, enios2elf.c, enios2linux.c), (eelf64btsmip_fbsd.c, eelf64ltsmip_fbsd.c): Correct dependencies. * Makefile.in: Regenerate. * emulparams/aarch64cloudabi.sh, * emulparams/aarch64fbsd.sh, * emulparams/aarch64linux.sh, * emulparams/aarch64linux32.sh, * emulparams/arc-nps.sh, * emulparams/elf32_spu.sh, * emulparams/elf32_tic6x_le.sh, * emulparams/elf32bmip.sh, * emulparams/elf32btsmipn32.sh, * emulparams/elf32lr5900n32.sh, * emulparams/elf32mep.sh, * emulparams/elf32metag.sh, * emulparams/elf64btsmip.sh, * emulparams/shelf_vxworks.sh, * emulparams/shlelf_fd.sh, * scripttempl/DWARF.sc, * scripttempl/alpha.sc, * scripttempl/alphavms.sc, * scripttempl/arclinux.sc, * scripttempl/armbpabi.sc, * scripttempl/avr.sc, * scripttempl/dlx.sc, * scripttempl/elf.sc, * scripttempl/elf32cr16.sc, * scripttempl/elf32cr16c.sc, * scripttempl/elf32crx.sc, * scripttempl/elf32msp430.sc, * scripttempl/elf32msp430_3.sc, * scripttempl/elf32xc16x.sc, * scripttempl/elf32xc16xl.sc, * scripttempl/elf32xc16xs.sc, * scripttempl/elf64hppa.sc, * scripttempl/elf_chaos.sc, * scripttempl/elfarc.sc, * scripttempl/elfarcv2.sc, * scripttempl/elfd10v.sc, * scripttempl/elfd30v.sc, * scripttempl/elfm68hc11.sc, * scripttempl/elfm68hc12.sc, * scripttempl/elfm9s12z.sc, * scripttempl/elfmicroblaze.sc, * scripttempl/elfxgate.sc, * scripttempl/elfxtensa.sc, * scripttempl/epiphany_4x4.sc, * scripttempl/ft32.sc, * scripttempl/hppaelf.sc, * scripttempl/ia64vms.sc, * scripttempl/ip2k.sc, * scripttempl/iq2000.sc, * scripttempl/mep.sc, * scripttempl/mmo.sc, * scripttempl/nds32elf.sc, * scripttempl/pru.sc, * scripttempl/sh.sc, * scripttempl/v850.sc, * scripttempl/v850_rh850.sc, * scripttempl/visium.sc, * scripttempl/xstormy16.sc: Condition various parts of scripts on ${RELOCATABLE} in order to prevent ld -r merging sections or defining symbols. Remove MEMORY and VERSION definitions from ld -r scripts too. * testsuite/ld-elf/group2.d, * testsuite/ld-elf/group4.d, * testsuite/ld-elf/group5.d, * testsuite/ld-elf/group6.d, * testsuite/ld-elf/group7.d, * testsuite/ld-elf/group8a.d, * testsuite/ld-elf/group8b.d, * testsuite/ld-elf/group9a.d, * testsuite/ld-elf/group9b.d, * testsuite/ld-elf/pr17550a.d, * testsuite/ld-elf/pr17550b.d, * testsuite/ld-elf/pr17550d.d: Don't xfail cr16 and crx. * testsuite/ld-elf/init-fini-arrays.d, * testsuite/ld-elf/pr22677.d: Likewise, and dont' xfail mep.
2018-10-08x86: Don't add GNU_PROPERTY_X86_FEATURE_2_NEEDED for -z separate-codeH.J. Lu4-6/+10
With commit 64029e93683a266c38d19789e780f3748bd6a188 Author: Alan Modra <amodra@gmail.com> Date: Fri Oct 5 11:40:54 2018 +0930 Separate header PT_LOAD for -z separate-code there is no need to add a GNU_PROPERTY_X86_ISA_1_USED note to force program header in in non-code PT_LOAD segment when -z separate-code is used. bfd/ PR ld/23428 * elfxx-x86.c (_bfd_x86_elf_link_setup_gnu_properties): Don't add GNU_PROPERTY_X86_FEATURE_2_NEEDED to force program header in non-code PT_LOAD segment. ld/ PR ld/23428 * testsuite/ld-i386/property-x86-4a.d: Updated. * testsuite/ld-x86-64/property-x86-4a-x32.d: Likewise. * testsuite/ld-x86-64/property-x86-4a.d: Likewise.
2018-10-08ELF: Properly group and place orphan note sectionsH.J. Lu5-56/+140
Properly group orphan note sections. When placing orphan note section as the first note section, place it after the section before all note sections. PR ld/23658 * ldlang.c (lang_insert_orphan): Properly group and place orphan note sections. Properly handle orphan note section before all note sections. * testsuite/ld-elf/pr23658-1.d: Renamed to ... * testsuite/ld-elf/pr23658-1a.d: This. Updated. * testsuite/ld-elf/pr23658-1b.d: New test. * testsuite/ld-elf/pr23658-1c.d: Likewise.
2018-10-08Separate header PT_LOAD for -z separate-codeAlan Modra12-20/+19
This patch, along with previous patches in the series, supports putting the ELF file header and program headers in a PT_LOAD without sections. Logic governing whether headers a loaded has changed a little: The primary reason to include headers is now the presence of SIZEOF_HEADERS in a linker script. However, to support scripts that may have reserved space for headers by hand, we continue to add headers whenever the first section address is past the end of headers modulo page size. include/ * bfdlink.h (struct bfd_link_info): Add load_phdrs field. bfd/ * elf-nacl.c (nacl_modify_segment_map): Cope with header PT_LOAD lacking sections. * elf.c (_bfd_elf_map_sections_to_segments): Assume file and program headers are required when info->load_phdrs. Reorganize code handling program headers. Generate a mapping without sections just for file and program headers when -z separate-code would indicate they should be on a different page to the first section. ld/ * ldexp.c (fold_name <SIZEOF_HEADERS>): Set link_info.load_phdrs. * testsuite/ld-elf/loadaddr1.d: Pass -z noseparate-code. * testsuite/ld-elf/loadaddr2.d: Likewise. * testsuite/ld-i386/vxworks2.sd: Adjust expected output. * testsuite/ld-powerpc/vxworks2.sd: Likewise. * testsuite/ld-elf/overlay.d: Remove spu xfail. * testsuite/ld-spu/ovl.lnk: Don't use SIZEOF_HEADERS. * testsuite/ld-tic6x/dsbt-be.ld: Likewise. * testsuite/ld-tic6x/dsbt-inrange.ld: Likewise. * testsuite/ld-tic6x/dsbt-overflow.ld: Likewise. * testsuite/ld-tic6x/dsbt.ld: Likewise.