summaryrefslogtreecommitdiff
path: root/ld
Commit message (Collapse)AuthorAgeFilesLines
* ld/testsuite: disable ilp32 tests for aarch64-qnxClément Chigot2023-03-1639-0/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | aarch64nto32 emulation isn't supported. The tests will then fall back on aarch64elf32. It does work but some extra warnings are being generated because the "-z relro" being added aarch64nto but ignored by aarch64elf32 emulation. Skip the tests to avoid any problems. ld/ChangeLog: * testsuite/ld-aarch64/emit-relocs-112-overflow.d: Skip for aarch64nto. * testsuite/ld-aarch64/emit-relocs-112.d: Likewise. * testsuite/ld-aarch64/emit-relocs-113.d: Likewise. * testsuite/ld-aarch64/emit-relocs-114-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-114.d: Likewise. * testsuite/ld-aarch64/emit-relocs-115.d: Likewise. * testsuite/ld-aarch64/emit-relocs-116-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-116.d: Likewise. * testsuite/ld-aarch64/emit-relocs-117.d: Likewise. * testsuite/ld-aarch64/emit-relocs-118-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-118.d: Likewise. * testsuite/ld-aarch64/emit-relocs-119.d: Likewise. * testsuite/ld-aarch64/emit-relocs-22.d: Likewise. * testsuite/ld-aarch64/emit-relocs-23.d: Likewise. * testsuite/ld-aarch64/emit-relocs-28.d: Likewise. * testsuite/ld-aarch64/emit-relocs-86-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-86.d: Likewise. * testsuite/ld-aarch64/emit-relocs-87.d: Likewise. * testsuite/ld-aarch64/emit-relocs-88-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-88.d: Likewise. * testsuite/ld-aarch64/emit-relocs-89.d: Likewise. * testsuite/ld-aarch64/emit-relocs-90-overflow.d: Likewise. * testsuite/ld-aarch64/emit-relocs-90.d: Likewise. * testsuite/ld-aarch64/emit-relocs-92.d: Likewise. * testsuite/ld-aarch64/tls-desc-ie-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-all-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-gd-ie-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-gd-le-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-gdesc-le-2-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-gdesc-le-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-ie-le-2-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-ie-le-3-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-ie-le-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-ld-le-small-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-relax-ld-le-tiny-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-tiny-desc-ie-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-tiny-desc-le-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-tiny-gd-ie-ilp32.d: Likewise. * testsuite/ld-aarch64/tls-tiny-gd-le-ilp32.d: Likewise.
* ld/testsuite: add aarch64nto to ld-aarch64Clément Chigot2023-03-161-0/+3
| | | | | | | ld/ChangeLog: * testsuite/ld-aarch64/aarch64-elf.exp: Add support for aarch64nto.
* ld: add support of QNX stack arguments for aarch64ntoClément Chigot2023-03-166-1/+220
| | | | | | | | | | | | | | | | | | | QNX is handling the stack argument using a .note section. Generate it according to ELF argument -zexecstack, -zstack-size and a new NTO argument --lazy-stack. Another NTO argument --stack mimicking -zstack-size is added in order to ensure compatibility with previously made NTO linkers. This requires a new emultempl nto.em which is applied above the default ${ARCH}elf.em. ld/ChangeLog: * emulparams/aarch64nto.sh: Move to nto.em. * emultempl/nto.em: New file. * testsuite/ld-aarch64/aarch64-nto.exp: New test. * testsuite/ld-aarch64/nto-stack-note-1.d: New test. * testsuite/ld-aarch64/nto-stack-note-2.d: New test. * testsuite/ld-aarch64/start.s: New test.
* configure: add new target aarch64-*-nto*Clément Chigot2023-03-164-0/+49
| | | | This target has its own ld emulation based on aarch64elf.em.
* Re: Add --enable-linker-verssionAlan Modra2023-03-1638-87/+70
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Output sections without any input sections to initialise their flags have their flags initialised by data statements to LOAD, ALLOC, HAS_CONTENTS by default. This is wrong for .comment. Fix that by making the script initialise the section type to INFO, one of the noalloc section types. That also allows the address of .comment to be set to zero, as is usual for non-alloc sections. Also, use source_sh for all of the sourced scripts to set up make dependencies. PR 30187 * scripttempl/misc-sections.sc: Set .comment address to zero and type to INFO. * scripttempl/ft32.sc: Fix breakages from last edit. * scripttempl/arclinux.sc: Use source_sh to source DWARF.sc and misc-sections.sc. * scripttempl/avr.sc: Likewise. * scripttempl/dlx.sc: Likewise. * scripttempl/elf.sc: Likewise. * scripttempl/elf32cr16.sc: Likewise. * scripttempl/elf32crx.sc: Likewise. * scripttempl/elf32msp430.sc: Likewise. * scripttempl/elf64bpf.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Likewise. * scripttempl/elfarcv2.sc: Likewise. * scripttempl/elfd10v.sc: Likewise. * scripttempl/elfd30v.sc: Likewise. * scripttempl/elfm68hc11.sc: Likewise. * scripttempl/elfm68hc12.sc: Likewise. * scripttempl/elfm9s12z.sc: Likewise. * scripttempl/elfmicroblaze.sc: Likewise. * scripttempl/elfxgate.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/epiphany_4x4.sc: Likewise. * scripttempl/i386beos.sc: Likewise. * scripttempl/i386go32.sc: Likewise. * scripttempl/ia64vms.sc: Likewise. * scripttempl/ip2k.sc: Likewise. * scripttempl/iq2000.sc: Likewise. * scripttempl/mep.sc: Likewise. * scripttempl/mmo.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/pru.sc: Likewise. * scripttempl/v850.sc: Likewise. * scripttempl/v850_rh850.sc: Likewise. * scripttempl/visium.sc: Likewise. * scripttempl/xstormy16.sc: Likewise. * scripttempl/z80.sc: Likewise. * testsuite/ld-scripts/ld-version-2.d: Don't skip ft32 or pru.
* Add --enable-linker-version option to bfd linker to add an entry in the ↵Nick Clifton2023-03-1546-278/+243
| | | | | | | .comment section. PR 30187 * NEWS: Mention the new feature. * ld.texi: Document the new feature. * ldgram.y: Handle LINKER_VERSION token. * ldlang.c (lang_add_version): New function. (enable_linker_version): New global variable. * ldlang.h (land_add_version): Prototype. (enable_linker_version): Export. * ldlex.h (OPTION_ENABLE_LINKER_VERSION): Define. (OPTION_DISABLE_LINKER_VERSION): Define. * ldlex.l (LINKER_VERSION): Add token. * lexsup.c (ld_options): Add --enable-linker-version and --disable-linker-version. (parse_args): Handle the new options. * scripttempl/arclinux.sc: Remove stabs and comment sections and replace with inclusion of misc-sections.sc * scripttempl/avr.sc: Likewise. * scripttempl/dlx.sc: Likewise. * scripttempl/elf.sc: Likewise. * scripttempl/elf32cr16.sc: Likewise. * scripttempl/elf32crx.sc: Likewise. * scripttempl/elf32msp430.sc: Likewise. * scripttempl/elf64bpf.sc: Likewise. * scripttempl/elf64hppa.sc: Likewise. * scripttempl/elf_chaos.sc: Likewise. * scripttempl/elfarc.sc: Likewise. * scripttempl/elfarcv2.sc: Likewise. * scripttempl/elfd10v.sc: Likewise. * scripttempl/elfd30v.sc: Likewise. * scripttempl/elfm68hc11.sc: Likewise. * scripttempl/elfm68hc12.sc: Likewise. * scripttempl/elfm9s12z.sc: Likewise. * scripttempl/elfmicroblaze.sc: Likewise. * scripttempl/elfxgate.sc: Likewise. * scripttempl/elfxtensa.sc: Likewise. * scripttempl/epiphany_4x4.sc: Likewise. * scripttempl/ft32.sc: Likewise. * scripttempl/ip2k.sc: Likewise. * scripttempl/iq2000.sc: Likewise. * scripttempl/mep.sc: Likewise. * scripttempl/nds32elf.sc: Likewise. * scripttempl/pru.sc: Likewise. * scripttempl/v850.sc: Likewise. * scripttempl/v850_rh850.sc: Likewise. * scripttempl/visium.sc: Likewise. * scripttempl/xstormy16.sc: Likewise. * scripttempl/z80.sc: Likewise. * testsuite/ld-scripts/script.exp: Run new tests. * scripttempl/misc-sections.sc: New file. * testsuite/ld-scripts/ld-version-2.d: New file. * testsuite/ld-scripts/ld-version.d: New file. * testsuite/ld-scripts/ld-version.t: New file.
* Revert ld ASCII supportAlan Modra2023-03-1011-213/+33
| | | | | | | | | | | | Revert "Prevent the ASCII linker script directive from generating huge amounts of padding if the size expression is not a constant." This reverts commit adbe951fc95943016325af08d677f18e8c177ac1. Revert "ld test asciz and ascii fails" This reverts the ascii.d part of commit 5f497256bee624f0fa470949aa41534093bc5b25. Revert "Add support for the ASCII directive inside linker scripts." This mostly reverts commit 9fe129a4105bb59398f73ce96938a94f19265b79 leaving the asciz.d and asciz.t changes in place.
* Revert ld DIGEST supportAlan Modra2023-03-1076-3903/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a hopefully temporary reversion of new ld features for embedded processors by Ulf Samuelsson, plus some followup patches. Squashed together from the following: Revert "lddigest 32-bit support and gcc-4 compile errors" This reverts commit d7ee19be87110a8f5342cec6e323d83d01c641d1. Revert "ld: Use correct types for crc64 calculations" This reverts commit 9a534b9f8e3d0f3cdb5a20f19ff165693fbb84d2. Revert "Re: DIGEST: testsuite" This reverts commit c8e85484d8a0fe9f7b88e00a6b9ae63bcb53ba32. Revert "Regen potfiles" This reverts commit 4d98c966f8bf305ab25badd34cb295631873cf7c. Revert "DIGEST: Makefile.*" This reverts commit 78ef6ab03f56ce83a606d974bb8a9f34b5d6e0b7. Revert "DIGEST: calculation" This reverts commit 5243990191e683d5066d3dd622c76deaba0bf15c. Revert "DIGEST: ldlang.*: add timestamp" This reverts commit bd9466d4aa277a469a9d8b12f0a6e6fa51678e36. Revert "DIGEST: ldmain.c" This reverts commit c8f8653fa7eeb3dc0769ac23039eadb5c5f09dff. Revert "DIGEST: ldgram.y" This reverts commit d73c01be2669e9c5267fab669a269f95a32048c9. Revert "DIGEST: ldlex.l" This reverts commit 48b5163a9dd5759cc87171331bbd6e902c547b5a. Revert "DIGEST: testsuite" This reverts commit a4135d1a4886400ea29af2da782dd8dd40ccad23. Revert "DIGEST: Documentation" This reverts commit 3ec28966c3e4c63704212778f96c517cbf2e0090. Revert "DIGEST: NEWS" This reverts commit 099bf2927d446424e8585a60cf4ce63209999aa2. Revert "DIGEST: LICENSING" This reverts commit 5c8a0c6654fb55926985edf3b360b62d4f20691d.
* lddigest 32-bit support and gcc-4 compile errorsAlan Modra2023-03-098-49/+82
| | | | | | | | | | | | | | * ld.texi: Revert 2023-03-08 commit 9a534b9f8e3d. * testsuite/ld-scripts/crc64-poly.d: Likewise. * testsuite/ld-scripts/crc64-poly.t: Likewise. * lddigest.c: Formatting. (get_uint64_t): New function. (lang_add_digest): Take etree_type* args. Replace "illegal" with "invalid" in error message. * lddigest.h (lang_add_digest): Update prototype. * lddigest_tab.c (algorithms): Work around gcc-4 errors. * ldgram.y (polynome): Adjust lang_add_digest call. * testsuite/ld-scripts/crc64-poly-size.d: Update expected error.
* ld: Use correct types for crc64 calculationsNick Clifton2023-03-086-44/+70
|
* Re: DIGEST: testsuiteAlan Modra2023-03-0815-50/+25
| | | | | | | Correct test target/skip lines to fix fails on alpha-dec-vms, alpha-linux-gnuecoff, i386-bsd, i386-msdos, ns32k-openbsd, ns32k-pc532-mach, pdp11-dec-aout, rs6000-aix*, tic4x-coff, and tic54x-coff.
* Regen potfilesAlan Modra2023-03-081-0/+7
|
* Build ldintUlf Samuelsson2023-03-072-8/+61
| | | | Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* DIGEST: Makefile.*Ulf Samuelsson2023-03-072-0/+18
| | | | | | | | | | | | | | The Makefile.in was generated using automake after adding a few files. When adding the ldreflect.* files, the autotools versions were wrong. After upgrading the host OS, autotools were upgraded to 2.71 reinstalling the desired 2.69 still generates a lot of changes. Makefile.ini has therefore been manually edited. Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* DIGEST: calculationUlf Samuelsson2023-03-077-0/+1717
| | | | Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* DIGEST: ldlang.*: add timestampUlf Samuelsson2023-03-072-0/+10
| | | | Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* DIGEST: ldmain.cUlf Samuelsson2023-03-071-0/+2
| | | | Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* DIGEST: ldgram.yUlf Samuelsson2023-03-071-1/+60
| | | | Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* DIGEST: ldlex.lUlf Samuelsson2023-03-071-0/+7
| | | | Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* DIGEST: testsuiteUlf Samuelsson2023-03-0757-0/+1411
| | | | Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* DIGEST: DocumentationUlf Samuelsson2023-03-071-4/+494
| | | | Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* DIGEST: NEWSUlf Samuelsson2023-03-071-4/+73
| | | | Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* DIGEST: LICENSINGUlf Samuelsson2023-03-072-0/+70
| | | | Signed-off-by: Ulf Samuelsson <ulf@emagii.com>
* Prevent the ASCII linker script directive from generating huge amounts of ↵Nick Clifton2023-03-032-1/+9
| | | | | | padding if the size expression is not a constant. PR 30193 * ldgram.y (ASCII): Fail if the size is not a constant.
* Fix typo with my email addressNick Clifton2023-03-011-1/+1
|
* ld: Sort section contributions in PDB filesMark Harmstone2023-02-282-22/+66
| | | | | | Microsoft's DIA library, and thus also MSVC and WinDbg, expects section contributions to be ordered by section number and offset, otherwise it's unable to resolve line numbers.
* testsuite: prune DOS drive letter in test outputsClément Chigot2023-02-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | On DOS systems, absolute paths start with the drive letter. This can trigger failures in the regexp from dump tests, especially for those checking for warnings or errors. They are usually skipping everything before the first ":" as it has to be the file path. | [^:]*: warning: ... In order to avoid modifying many regexps to allow such drive letters, prune them from all the outputs if they are found at the beginning of a line. binutils/ChangeLog: * testsuite/lib/binutils-common.exp (prune_dump_output): New (run_dump_test): Use it. ld/ChangeLog: * testsuite/ld-elf/noinit-sections-2.l: Remove DOS drive letter handler.
* PR30155, ld segfault in _bfd_nearby_sectionAlan Modra2023-02-241-13/+52
| | | | | | | | | | | | | | | | | The segfault was a symptom of messing with the absolute section next field, confusing bfd_section_removed_from_list in linker.c:fix_syms. That's not all that was going wrong. The INSERT list of output sections was being inserted into itself, ie. lost from the main list of linker statements. PR 30155 * ldlang.c (process_insert_statements): Handle pathological case of the insert script being inserted before the first output section statement in the default script. (output_prev_sec_find): Don't test section owner here. (insert_os_after): Change parameter to a list union pointer. (lang_insert_orphan): Test section owner here and adjust insert_os_after call.
* RISC-V: Add --[no-]relax-gp to ldFangrui Song2023-02-236-1/+69
| | | | | | | | | | | | | | | | | | | | | | | | | --relax enables all relaxations. --no-relax-gp disables GP relaxation to allow measuring its effect. The option can test effectiveness of GP relaxation and support some ABI variants that use GP for other purposes. Link: https://github.com/riscv-non-isa/riscv-elf-psabi-doc/issues/298 bfd/ * elfnn-riscv.c (struct riscv_elf_link_hash_table): Add params. (riscv_elfNN_set_options): New. (riscv_info_to_howto_rela): Check relax_gp. (_bfd_riscv_relax_section): Likewise. * elfxx-riscv.h (struct riscv_elf_params): New. (riscv_elf32_set_options): New. (riscv_elf64_set_options): New. ld/ * emultempl/riscvelf.em: Add option parsing. * testsuite/ld-riscv-elf/code-model-relax-medlow-01-norelaxgp.d: New. * testsuite/ld-riscv-elf/pcgp-relax-01-norelaxgp.d: New. * testsuite/ld-riscv-elf/pcgp-relax-02.d: Test --relax --relax-gp can be used together.
* bfd: xtensa: fix __stop_SECTION literal dropAlexey Lapshin2023-02-234-0/+30
|
* ld/testsuite: don't output to /dev/nullClément Chigot2023-02-211-1/+3
| | | | | | | | | | | | Mingw doesn't have /dev/null and thus "-o /dev/null" will fail. Currently, all the options are checked using this "-o /dev/null", resulting in them being disabled on mingw hosts. Fix that by outputting to a real file for all targets. ld/ChangeLog: * testsuite/config/default.exp: Replace "-o /dev/null" by a file.
* Both FAIL and PASS "check sections 2"?Alan Modra2023-02-211-9/+10
| | | | | * testsuite/ld-checks/checks.exp (check sections 2): Don't continue on with rest of test past first fail.
* ld-libs test on alpha-vmsAlan Modra2023-02-211-0/+5
| | | | * testsuite/ld-libs/libs.exp: Don't run for alpha-vms.
* alpha-*-vms missing librariesAlan Modra2023-02-211-1/+1
| | | | | | | | | | | | | | | | For this: ./ld-new: cannot find -limagelib: No such file or directory ./ld-new: cannot find -lstarlet: No such file or directory ./ld-new: cannot find -lsys$public_vectors: No such file or directory the logs showed creating dummy tmpdir/libimagelib: creating dummy No creating dummy such etc. So rubbish instead of tmpdir/libimagelib.a and the other required libs. * testsuite/config/default.exp: Correct regex detecting missing libraries automatically searched by alpha-dec-vms-ld.
* ld/testsuite: handle Windows drive letter in a noinit testClément Chigot2023-02-201-2/+2
| | | | | | | | | | | The regexp in "noinit sections (ld -r)" is skipping the file path before the first ":". However, on Windows, a path can start with "C:". Adjust the regexp to allow such cases. ld/ChangeLog: * testsuite/ld-elf/noinit-sections-2.l: Allow Windows paths (starting with C:).
* ld/testsuite: adjust to Windows path separator.Clément Chigot2023-02-207-7/+7
| | | | | | | | | | | | | | | | In some tests, the path reported on Windows will have a \ instead of a /. This occurs when a file is concatened with the search path in ldfile.c.: "ld -Ltmpdir -ltext" will result into "tmpdir\libtext.a". ld/ChangeLog: * testsuite/ld-elf/retain5.map: Allow \ path separator. * testsuite/ld-plugin/plugin-10.d: Likewise. * testsuite/ld-plugin/plugin-11.d: Likewise. * testsuite/ld-plugin/plugin-18.d: Likewise. * testsuite/ld-plugin/plugin-19.d: Likewise. * testsuite/ld-plugin/plugin-20.d: Likewise. * testsuite/ld-plugin/plugin-22.d: Likewise.
* So the linker from producing an export data table when run with ↵Nick Clifton2023-02-202-1/+8
| | | | | | --exclude-all-symbols. PR 30004 * pe-dll.c (pe_dll_build_sections): Do not build an edata section if all symbols are being excluded.
* ld test asciz and ascii failsAlan Modra2023-02-172-5/+5
| | | | | | | | | | | | | | | | | | | Fix these fails: alpha-dec-vms +FAIL: ld-scripts/asciz alpha-dec-vms +FAIL: ld-scripts/ascii i386-go32 +FAIL: ld-scripts/asciz sh-coff +FAIL: ld-scripts/asciz It's better to positively select targets for .section support than to try to exclude all targets that don't. Make a new is_coff_format so we can easily select such. binutils/ * testsuite/lib/binutils-common.exp (is_coff_format): New. ld/ * testsuite/ld-scripts/ascii.d: Use is_elf_format and is_coff_format to select targets, exclude ti coff. * testsuite/ld-scripts/asciz.d: Likewise. Accept trailing zeros.
* Add support for the ASCII directive inside linker scripts.Nick Clifton2023-02-1613-59/+221
| | | | | | | | | | | | | | | * ldlex.l: Add ASCII token. * ldgram.y: Add parsing of the ASCII command. * ldlang.c (lang_add_string): Add maximum size parameter. Move escape character handling code into separate function. * ldlang.h (lang_add_string): Update prototype. * NEWS: Mention the new feature. * ld.texi (Output Section Data): Document the new directives. * testsuite/ld-scripts/asciz.t: Adjust to work on more architectures and to test more aspects of the ASCIZ directive. * testsuite/ld-scripts/asciz.d: Adjust to match the changes to the test linker script. * testsuite/ld-scripts/ascii.d: New test driver. * testsuite/ld-scripts/ascii.s: New test assembler source. * testsuite/ld-scripts/ascii.t: New test script. * testsuite/ld-scripts/script.exp: Run the new test.
* Delete PROGRESS macrosAlan Modra2023-02-161-5/+0
| | | | | | | | | | | | | | | | | | | | | I don't see much point in cluttering the source with the PROGRESS macros, which of course do nothing at all with the definitions in progress.h. progress.h is unchanged apart from the copyright comment since commit d4d4c53c68f0 in 1994. binutils/ * ar.c: Don't include progress.h, or invoke PROGRESS macros. * nm.c: Likewise. * objcopy.c: Likewise. * objdump.c: Likewise. gas/ * as.h: Don't include progress.h. * as.c: Don't invoke PROGRESS macros. * write.c: Likewise. include/ * progress.h: Delete. ld/ * ldmain.c: Don't include progress.h, or invoke PROGRESS macros.
* Fix the linker's merge4 test for the HPPA architecture.Nick Clifton2023-02-152-5/+12
| | | | PR 30078 * testsuite/ld-elf/merge4b.s: Use .asciz instead of .string in order to avoid the special behaviour of the .string directive on HPPA architectures.
* Mention that the -plugin command line option is used to load plugins.Nick Clifton2023-02-142-0/+8
|
* ASCIZ Command for output sectionUlf Samuelsson2023-02-1410-3/+157
| | | | | Adds a new directive to the linker script syntax: ASCIZ. This inserts a zero-terminated string into the output at the place where it is used.
* Fix PR30079: abort on mingwMichael Matz2023-02-131-1/+2
| | | | | | | | the early-out in wild_sort is not enough, it might still be that filenames are equal _and_ the wildcard list doesn't specify a sort order either. Don't call compare_section then. Tested on all targets.
* objdump -D of bss sections and -s with -jAlan Modra2023-02-1113-56/+53
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There is some inconsistency between the behaviour of objdump -D and objdump -s, both supposedly operating on all sections by default. objdump -s ignores bss sections, while objdump -D dissassembles the zeros. Fix this by making objdump -D ignore bss sections too. Furthermore, "objdump -s -j .bss" doesn't dump .bss as it should, since the user is specifically asking to look at all those zeros. This change does find some tests that used objdump -D with expected output in bss-style sections. I've updated all the msp430 tests that just wanted to find a non-empty section to look at section headers instead, making the tests slightly more stringent. The ppc xcoff and spu tests are fixed by adding -j options to objdump, which makes the tests somewhat more lenient. binutils/ * objdump.c (disassemble_section): Ignore sections without contents, unless overridden by -j. (dump_section): Allow -j to override the default of not displaying sections without contents. * doc/binutils.texi (objdump options): Update -D, -s and -j description. gas/ * testsuite/gas/ppc/xcoff-tls-32.d: Select wanted objdump sections with -j. * testsuite/gas/ppc/xcoff-tls-64.d: Likewise. ld/ * testsuite/ld-msp430-elf/main-bss-lower.d, * testsuite/ld-msp430-elf/main-bss-upper.d, * testsuite/ld-msp430-elf/main-const-lower.d, * testsuite/ld-msp430-elf/main-const-upper.d, * testsuite/ld-msp430-elf/main-text-lower.d, * testsuite/ld-msp430-elf/main-text-upper.d, * testsuite/ld-msp430-elf/main-var-lower.d, * testsuite/ld-msp430-elf/main-var-upper.d: Expect -wh output. * testsuite/ld-msp430-elf/msp430-elf.exp: Use objdump -wh rather than objdump -D or objdump -d with tests checking for non-empty given sections. * testsuite/ld-spu/ear.d, * testsuite/ld-spu/icache1.d, * testsuite/ld-spu/ovl.d, * testsuite/ld-spu/ovl2.d: Select wanted objdump sections.
* RISC-V: Reduce effective linker relaxation passsesTsukasa OI2023-02-101-1/+1
| | | | | | | | | | | | | | | | | | | | | Commit 43025f01a0c9 ("RISC-V: Improve link time complexity.") reduced the time complexity of the linker relaxation but some code portions did not reflect this change. This commit fixes a comment describing each relaxation pass and reduces actual number of passes for the RISC-V linker relaxation from 3 to 2. Though it does not change the functionality, it marginally improves the performance while linking large programs (with many relocations). bfd/ChangeLog: * elfnn-riscv.c (_bfd_riscv_relax_section): Fix a comment to reflect current roles of each relaxation pass. ld/ChangeLog: * emultempl/riscvelf.em: Reduce the number of linker relaxation passes from 3 to 2.
* ppc32 and "LOAD segment with RWX permissions"Alan Modra2023-02-062-0/+10
| | | | | | | | | | | | | | | | | | | | | When using a bss-plt we'll always trigger the RWX warning, which disturbs gcc test results. On the other hand, there may be reason to want the warning when gcc is configured with --enable-secureplt. So turning off the warning entirely for powerpc might not be the best solution. Instead, we'll turn off the warning whenever a bss-plt is generated, unless the user explicitly asked for the warning. bfd/ * elf32-ppc.c (ppc_elf_select_plt_layout): Set no_warn_rwx_segments on generating a bss plt, unless explicity enabled by the user. Also show the bss-plt warning when --warn-rwx-segments is given without --bss-plt. include/ * bfdlink.h (struct bfd_link_info): Add user_warn_rwx_segments. ld/ * lexsup.c (parse_args): Set user_warn_rwx_segments. * testsuite/ld-elf/elf.exp: Pass --secure-plt for powerpc to the rwx tests.
* [PR 30082] Pass $JANSSON_LIBS and $ZSTD_LIBS to ld-bootstrap/bootrap.expRomain Geissler2023-02-063-2/+4
|
* ld: pru: Add optional section alignmentsDimitar Dimitrov2023-02-041-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Texas Instruments SoCs with AARCH64 host processors have stricter alignment requirements than ones with ARM32 host processors. It's not only the requirement for resource_table to be aligned to 8. But also any loadable segment size must be a multiple of 4 [1]. The current PRU default linker script may output a segment size not aligned to 4, which would cause firmware load failure on AARCH64 hosts. Fix this by using COMMONPAGESIZE and MAXPAGESIZE to signify respectively the section memory size requirement and the resource table section's start address alignment. This would avoid penalizing the ARM32 hosts, for which the default values (1 and 1) are sufficient. For AARCH64 hosts, the alignments would be overwritten from GCC spec files using the linker command line, e.g.: -z common-page-size=4 -z max-page-size=8 [1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/remoteproc/pru_rproc.c?h=v6.1#n555 ld/ChangeLog: * scripttempl/pru.sc (_data_end): Remove the alignment. (.data): Align output section size to COMMONPAGESIZE. (.resource_table): Ditto. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>
* ld: pru: Merge the bss input sections into dataDimitar Dimitrov2023-02-042-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The popular method to load PRU firmware is through the remoteproc Linux kernel driver. In order to save a few bytes from the firmware, the PRU CRT0 is spared from calling memset for the bss segment [1]. Instead the host loader is supposed to zero out the bss segment. This is important for PRU, which typically has only 8KB for instruction memory. The legacy non-mainline PRU host driver relied on the default behaviour of the kernel core remoteproc [2]. That default is to zero out the loadable memory regions not backed by file storage (i.e. the bss sections). This worked for the libgloss' CRT0. But the PRU loader merged in mainline Linux explicitly changes the default behaviour [3]. It no longer is zeroing out memory regions. Hence the bss sections are not initialized - neither by CRT0, nor by the host loader. This patch fixes the issue by aligning the GNU LD default linker script with the mainline Linux kernel expectation. Since the mainline kernel driver is submitted by the PRU manufacturer itself (Text Instruments), we can consider that as defining the ABI. This change has been tested on Beaglebone AI-64 [4]. Static counter variables in the firmware are now always starting from zero, as expected. There was only one new toolchain test failure in orphan3.d, due to reordering of the output sections. I believe this is a harmless issue. I could not rewrite the PASS criteria to ignore the output section ordering, so I have disabled that test case for PRU. [1] https://sourceware.org/git/?p=newlib-cygwin.git;a=blob;f=libgloss/pru/crt0.S;h=b3f0d53a93acc372f461007553e7688ca77753c9;hb=HEAD#l40 [2] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/remoteproc/remoteproc_elf_loader.c?h=v6.1#n228 [3] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/remoteproc/pru_rproc.c?h=v6.1#n641 [4] https://beagleboard.org/ai-64 ld/ChangeLog: * scripttempl/pru.sc (.data): Merge .bss input sections into the .data output section. * testsuite/ld-elf/orphan3.d: Disable for PRU. Signed-off-by: Dimitar Dimitrov <dimitar@dinux.eu>