[Bug ld/30374] ld: Add --remap-inputs-file= to remap input files
https://sourceware.org/bugzilla/show_bug.cgi?id=30374 --- Comment #5 from Fangrui Song --- (In reply to Nick Clifton from comment #4) > OK, I have decided to commit my patch now, so that it gets into the next > release. If there are problems we can always reopen this PR. Thank you! I have tested the feature. It looks great. > ld foo.o --remap-inputs=foo.o=bar.o > > will not rename foo.o to bar.o, [...] I hope that this will be fine. Users can get adapted to this limitation. > One other thing: I wondered if we ought to accept the "@file" syntax in the > --remap-inputs option, as a synonym for --remap-inputs-file. What do you > think ? I think no. --remap-inputs @1.map would require extra work and the syntax is probably not conventional. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/30595] New: strings crashes when told to search for strings of size 0xFFFFFFFF
https://sourceware.org/bugzilla/show_bug.cgi?id=30595 Bug ID: 30595 Summary: strings crashes when told to search for strings of size 0x Product: binutils Version: 2.41 (HEAD) Status: UNCONFIRMED Severity: normal Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: gabravier at gmail dot com Target Milestone: --- Version of the utility: $ ./binutils/strings --version GNU strings (GNU Binutils) 2.40.50.20230629 Copyright (C) 2023 Free Software Foundation, Inc. This program is free software; you may redistribute it under the terms of the GNU General Public License version 3 or (at your option) any later version. This program has absolutely no warranty. Patches: None, the source code used is current HEAD (git commit 3933413e7887045bf1eed302040177bcfee92c2f) Type of machine used, OS and version number: $ uname -a Linux fedora 6.3.8-200.fc38.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Jun 15 02:15:40 UTC 2023 x86_64 GNU/Linux Compiler used to compile the utilities: $ gcc --version gcc (GCC) 13.1.1 20230614 (Red Hat 13.1.1-4) Copyright (C) 2023 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Command arguments used to reproduce the bug: $ ./binutils/strings -n0x <(echo aa) double free or corruption (out) Aborted (core dumped) Behavior I observe that I believe is incorrect: strings crashes. I believe it should output nothing as there are no strings longer than 4294967295 characters in the provided input file. The bug appears to be caused by the following code: char *buf = (char *) xmalloc (sizeof (char) * (string_min + 1)); which ends up passing a value of 0 to xmalloc, which makes it allocate a 1-byte buffer, which strings then proceeds to immediately overflow while trying to read string_min characters into it. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/30595] strings crashes when told to search for strings of size 0xFFFFFFFF
https://sourceware.org/bugzilla/show_bug.cgi?id=30595 --- Comment #1 from Gabriel Ravier --- PS: this also occurs for seemingly any string size above 0x, for instance: $ ./binutils/strings -n39281421894129759127589125 <(echo aa) double free or corruption (out) Aborted (core dumped) -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/30596] New: "/usr/lib6464" in riscv64 search paths
https://sourceware.org/bugzilla/show_bug.cgi?id=30596 Bug ID: 30596 Summary: "/usr/lib6464" in riscv64 search paths Product: binutils Version: 2.40 Status: UNCONFIRMED Severity: minor Priority: P2 Component: binutils Assignee: unassigned at sourceware dot org Reporter: david.abdurachmanov at gmail dot com Target Milestone: --- I was checking default search paths reported by ld on Fedora/RISCv, GNU ld version 2.40-10.0.riscv64.fc38. SEARCH_DIR("=/usr/riscv64-redhat-linux/lib64/lp64d") SEARCH_DIR("=/usr/riscv64-redhat-linux/lib64") SEARCH_DIR("=/usr/riscv64-redhat-linux/lib6464/lp64d") SEARCH_DIR("=/usr/lib6464/lp64d") SEARCH_DIR("=/usr/lib64") SEARCH_DIR("=/usr/local/lib64/lp64d") SEARCH_DIR("=/usr/local/lib64") SEARCH_DIR("=/lib64/lp64d") SEARCH_DIR("=/lib64") SEARCH_DIR("=/usr/lib64/lp64d") SEARCH_DIR("=/usr/riscv64-redhat-linux/lib") SEARCH_DIR("=/usr/local/lib") SEARCH_DIR("=/lib") SEARCH_DIR("=/usr/lib") There seem to be a couple of "lib6464" paths there. Could someone double check that? -- You are receiving this mail because: You are on the CC list for the bug.
[Bug binutils/30596] "/usr/lib6464" in riscv64 search paths
https://sourceware.org/bugzilla/show_bug.cgi?id=30596 --- Comment #1 from Andreas Schwab --- That appears to be specific to a native build, it doesn't happen in a cross configuration. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/25617] ld should reconstruct dynamic symbol table from PT_DYNAMIC when there is no section header
https://sourceware.org/bugzilla/show_bug.cgi?id=25617 --- Comment #45 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=02c1ba6c94d4bb3f53dfeeb4401c8434c7834a32 commit 02c1ba6c94d4bb3f53dfeeb4401c8434c7834a32 Author: H.J. Lu Date: Wed May 31 12:36:49 2023 -0700 ELF: Discard non-alloc sections without section header Discard non-alloc sections when section headers are stripped. bfd/ PR ld/25617 * elf.c (_bfd_elf_assign_file_positions_for_non_load): Skip non-load sections without section header. (_bfd_elf_write_object_contents): Don't set the sh_name field without section header. Write out the .shstrtab section only if its sh_offset field isn't -1. binutils/ PR ld/25617 * objcopy.c (is_strip_section_1): Remove non-alloc sections for --strip-section-headers. ld/ PR ld/25617 * ldlang.c (lang_discard_section_p): Discard non-alloc sections if we are stripping section headers. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/25617] ld should reconstruct dynamic symbol table from PT_DYNAMIC when there is no section header
https://sourceware.org/bugzilla/show_bug.cgi?id=25617 --- Comment #44 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=96cc7918c18cdb7bd0331d836fa7f05341732580 commit 96cc7918c18cdb7bd0331d836fa7f05341732580 Author: Kaylee Blake Date: Wed Mar 4 19:18:07 2020 +1030 ELF: Strip section header in ELF objects Section header isn't mandatory on ELF executable nor shared library. This patch adds a new linker option, -z nosectionheader, to omit ELF section header, a new objcopy and strip option, --strip-section-headers, to remove ELF section headers. bfd/ 2023-06-06 H.J. Lu Kaylee Blake PR ld/25617 * bfd.c (BFD_NO_SECTION_HEADER): New. (BFD_FLAGS_SAVED): Add BFD_NO_SECTION_HEADER. (BFD_FLAGS_FOR_BFD_USE_MASK): Likewise. * elfcode.h (elf_swap_ehdr_out): Omit section header with BFD_NO_SECTION_HEADER. (elf_write_shdrs_and_ehdr): Likewise. * elfxx-target.h (TARGET_BIG_SYM): Add BFD_NO_SECTION_HEADER to object_flags. (TARGET_LITTLE_SYM): Likewise. * bfd-in2.h: Regenerated. binutils/ 2023-06-06 H.J. Lu PR ld/25617 * NEWS: Mention --strip-section-headers for objcopy and strip. * objcopy.c (strip_section_headers): New. (command_line_switch): Add OPTION_STRIP_SECTION_HEADERS. (strip_options): Add --strip-section-headers. (copy_options): Likewise. (copy_usage): Add --strip-section-headers. (strip_usage): Likewise. (copy_object): Handle --strip-section-headers for ELF files. (strip_main): Handle OPTION_STRIP_SECTION_HEADERS. (copy_main): Likewise. * doc/binutils.texi: Document --strip-section-headers for objcopy and strip. ld/ 2023-06-06 H.J. Lu Kaylee Blake PR ld/25617 * NEWS: Mention -z nosectionheader. * emultempl/elf.em: Support -z sectionheader and -z nosectionheader. * ld.h (ld_config_type): Add no_section_header. * ld.texi: Document -z sectionheader and -z nosectionheader. * ldlang.c (ldlang_open_output): Handle config.no_section_header. * lexsup.c (parse_args): Enable --strip-all with -z nosectionheader. Disallow -r with -z nosectionheader. (elf_static_list_options): Add -z sectionheader and -z nosectionheader. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/25617] ld should reconstruct dynamic symbol table from PT_DYNAMIC when there is no section header
https://sourceware.org/bugzilla/show_bug.cgi?id=25617 --- Comment #47 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=0a06ea7a767579aade45ff779170f2fa81dfcb11 commit 0a06ea7a767579aade45ff779170f2fa81dfcb11 Author: Kaylee Blake Date: Thu Mar 5 13:42:31 2020 +1030 ld: Add simple tests for -z nosectionheader 2020-06-06 Kaylee Blake H.J. Lu PR ld/25617 * testsuite/ld-elf/nosectionheader-1.d: New file. * testsuite/ld-elf/nosectionheader-2.d: Likewise. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/25617] ld should reconstruct dynamic symbol table from PT_DYNAMIC when there is no section header
https://sourceware.org/bugzilla/show_bug.cgi?id=25617 --- Comment #46 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=46675b6b8160e97485583522852ad86507bd9072 commit 46675b6b8160e97485583522852ad86507bd9072 Author: H.J. Lu Date: Wed Mar 4 20:32:35 2020 -0800 bfd: Improve nm and objdump without section header When there is no section header in an executable or shared library, we reconstruct dynamic symbol table from the PT_DYNAMIC segment, which contains DT_HASH/DT_GNU_HASH/DT_MIPS_XHASH, DT_STRTAB, DT_SYMTAB, DT_STRSZ, and DT_SYMENT entries, to improve nm and objdump. For DT_HASH, the number of dynamic symbol table entries equals the number of chains. For DT_GNU_HASH/DT_MIPS_XHASH, only defined symbols with non-STB_LOCAL indings are in hash table. Since DT_GNU_HASH/DT_MIPS_XHASH place all symbols with STB_LOCAL binding before symbols with other bindings and all undefined symbols defined ones in dynamic symbol table, the highest symbol index in DT_GNU_HASH/DT_MIPS_XHASH is the highest dynamic symbol table index. We can also get symbol version from DT_VERSYM, DT_VERDEF and DT_VERNEED entries. dt_symtab, dt_versym, dt_verdef, dt_verneed, dt_symtab_count, dt_verdef_count, dt_verneed_count and dt_strtab are added to elf_obj_tdata to store dynamic symbol table information. PR ld/25617 * elf-bfd.h (elf_obj_tdata): Add dt_symtab, dt_verdef, dt_verneed, dt_symtab_count, dt_verdef_count, dt_verneed_count and dt_strtab. (elf_use_dt_symtab_p): New. (_bfd_elf_get_dynamic_symbols): Likewise. (_bfd_elf_get_section_from_dynamic_symbol): Likewise. * elf.c (bfd_elf_get_elf_syms): Use dynamic symbol table if neeeded. (_bfd_elf_get_dynamic_symtab_upper_bound): Likewise. (_bfd_elf_slurp_version_tables): Likewise. (offset_from_vma): New function. (get_hash_table_data): Likewise. (_bfd_elf_get_dynamic_symbols): Likewise. (_bfd_elf_get_section_from_dynamic_symbol): Likewise. (_bfd_elf_get_symbol_version_name): Likewise. * elfcode.h (elf_object_p): Call _bfd_elf_get_dynamic_symbols to reconstruct dynamic symbol table from PT_DYNAMIC segment if there is no section header. (elf_slurp_symbol_table): Use dynamic symbol table if neeeded. Don't free isymbuf when dynamic symbol table is used. * elflink.c (elf_link_is_defined_archive_symbol): Return wrong format error when dynamic symbol table is used. (elf_link_add_object_symbols): Likewise. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/25617] ld should reconstruct dynamic symbol table from PT_DYNAMIC when there is no section header
https://sourceware.org/bugzilla/show_bug.cgi?id=25617 --- Comment #49 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3da917d534954ae727a2174039a3786b474dd712 commit 3da917d534954ae727a2174039a3786b474dd712 Author: H.J. Lu Date: Sat Mar 7 08:24:35 2020 -0800 ld: Add tests for -z nosectionheader and --strip-section-headers Add tests to verify that the linker option, -z nosectionheader and objcopy and strip option, --strip-section-headers, work correctly as well as linker issues an error when dynamic symbol table from PT_DYNAMIC segment is used. PR ld/25617 * testsuite/ld-elf/hash-2.d: New file. * testsuite/ld-elf/no-section-header.exp: Likewise. * testsuite/ld-elf/pr25617-1-no-sec-hdr.nd: Likewise. * testsuite/ld-elf/pr25617-1-no-sec-hdr.rd: Likewise. * testsuite/ld-elf/pr25617-1-static-no-sec-hdr.rd: Likewise. * testsuite/ld-elf/pr25617-1a-no-sec-hdr.nd: Likewise. * testsuite/ld-elf/pr25617-1a-no-sec-hdr.rd: Likewise. * testsuite/ld-elf/pr25617-1a-sec-hdr.rd: Likewise. * testsuite/ld-elf/pr25617-1a.c: Likewise. * testsuite/ld-elf/pr25617-1b.c: Likewise. * testsuite/ld-elf/start-noheader.rd: Likewise. * testsuite/ld-elf/start-shared-noheader-gnu.rd: Likewise. * testsuite/ld-elf/start-shared-noheader-sysv.rd: Likewise. * testsuite/ld-elf/start-shared-noheader.nd: Likewise. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/25617] ld should reconstruct dynamic symbol table from PT_DYNAMIC when there is no section header
https://sourceware.org/bugzilla/show_bug.cgi?id=25617 --- Comment #48 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=1ad1b8865c19598326ef9bbb125ab60e4e462b55 commit 1ad1b8865c19598326ef9bbb125ab60e4e462b55 Author: H.J. Lu Date: Sat Mar 7 05:27:12 2020 -0800 binutils: Add a --strip-section-headers test PR ld/25617 * testsuite/binutils-all/objcopy.exp: Run strip-section-headers-1. * testsuite/binutils-all/strip-section-headers-1.d: New file. -- You are receiving this mail because: You are on the CC list for the bug.
[Bug ld/25617] ld should reconstruct dynamic symbol table from PT_DYNAMIC when there is no section header
https://sourceware.org/bugzilla/show_bug.cgi?id=25617 --- Comment #50 from cvs-commit at gcc dot gnu.org --- The master branch has been updated by H.J. Lu : https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b7b6f36275d5ff6a9e2bf679a5e3d354e531648a commit b7b6f36275d5ff6a9e2bf679a5e3d354e531648a Author: H.J. Lu Date: Mon Mar 9 14:37:26 2020 -0700 ld: Add -z nosectionheader test to bootstrap.exp PR ld/25617 * testsuite/ld-bootstrap/bootstrap.exp: Add -z nosectionheader test. -- You are receiving this mail because: You are on the CC list for the bug.