# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Controls whether to enable development-mode features by default.
-development=false
+development=true
# Indicate whether this is a release branch.
experimental=false
offset = i_shdrp[shindex]->sh_offset;
shstrtabsize = i_shdrp[shindex]->sh_size;
- /* Allocate and clear an extra byte at the end, to prevent crashes
- in case the string table is not terminated. */
- if (shstrtabsize + 1 <= 1
+ if (shstrtabsize == 0
|| bfd_seek (abfd, offset, SEEK_SET) != 0
|| (shstrtab
= _bfd_mmap_readonly_persistent (abfd, shstrtabsize)) == NULL)
the string table over and over. */
i_shdrp[shindex]->sh_size = 0;
}
- else if (shstrtab[shstrtabsize - 1] != '\0')
+ else if (shstrtab[shstrtabsize - 1] != 0)
{
/* It is an error if a string table isn't terminated. */
_bfd_error_handler
/* xgettext:c-format */
- (_("%pB(%pA): string table is corrupt"),
- abfd, i_shdrp[shindex]->bfd_section);
- return NULL;
+ (_("%pB: string table [%u] is corrupt"), abfd, shindex);
+ shstrtab[shstrtabsize - 1] = 0;
}
i_shdrp[shindex]->contents = shstrtab;
}
_bfd_error_handler
/* xgettext:c-format */
(_("%pB: DT_STRTAB table is corrupt"), abfd);
- goto error_return;
+ strbuf[dt_strsz - 1] = 0;
}
/* Get the real symbol count from DT_HASH or DT_GNU_HASH. Prefer
In releases, the date is not included in either version strings or
sonames. */
-#define BFD_VERSION_DATE 20240817
+#define BFD_VERSION_DATE 20240912
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
--- /dev/null
+#include <stdio.h>
+
+int foo;
+
+int main()
+{
+ if (foo == 1)
+ printf ("PASS\n");
+
+ return 0;
+}
--- /dev/null
+#include <stdio.h>
+
+int foo;
+
+int main()
+{
+ if (foo == 0)
+ printf ("PASS\n");
+
+ return 0;
+}
--- /dev/null
+int foo;
+
+void
+func (void)
+{
+}
--- /dev/null
+int foo = 1;
"$plug_opt" "-flto $lto_no_fat -fcommon" \
{pr26389.c} \
[list [list "nm" "$plug_opt" "pr26389.d"]]] \
+ [list "Build libdefinition-1.a" \
+ "$plug_opt" \
+ "-O2 -fcommon -flto $lto_no_fat" \
+ {definition-1.c} \
+ {} \
+ "libdefinition-1.a" \
+ ] \
+ [list \
+ "Build common-2a.o" \
+ "" \
+ "-O2 -fcommon -flto $lto_no_fat" \
+ {common-2a.c} \
+ {} \
+ "" \
+ "c" \
+ ] \
+ [list \
+ "Build libcommon-2.a" \
+ "$plug_opt" \
+ "-O2 -fcommon -flto $lto_no_fat" \
+ {common-2b.c} \
+ {} \
+ "libcommon-2.a" \
+ ] \
]
if { [at_least_gcc_version 10 0] && [check_lto_shared_available] } {
{pr26262a.c} "pr26262b" "pass.out" \
"-flto -O2" "c" "" \
""] \
+ [list "Run common-1" \
+ "-O2 -flto" \
+ "" \
+ {common-1.c} \
+ "common-1" \
+ "pass.out" \
+ "-O2 -fcommon -flto $lto_no_fat" \
+ "c" \
+ "" \
+ "tmpdir/libdefinition-1.a" \
+ ] \
]
if { [at_least_gcc_version 4 7] } {
# by some elf tests besides shared libs tests. So, always compile them.
run_cc_link_tests $lto_compile_elf_tests
+# Xfail PR ld/32083 test for GCC without the fix:
+#
+# commit a98dd536b1017c2b814a3465206c6c01b2890998
+# Author: H.J. Lu <hjl.tools@gmail.com>
+# Date: Wed Aug 21 07:25:25 2024 -0700
+#
+# Update LDPT_REGISTER_CLAIM_FILE_HOOK_V2 linker plugin hook
+#
+set exec_output [run_host_cmd "$CC_FOR_TARGET" \
+ "-O2 -fcommon -flto -o tmpdir/common-2 \
+ tmpdir/common-2a.o tmpdir/libcommon-2.a \
+ tmpdir/libcommon-2.a"]
+if [string match "" $exec_output] then {
+ pass "PR ld/32083"
+} elseif { [ regexp "lto1: fatal error: multiple prevailing defs for 'func'" $exec_output ] } {
+ xfail "PR ld/32083"
+} else {
+ fail "PR ld/32083"
+}
+
# Restrict these to ELF targets that support shared libs and PIC.
if { [is_elf_format] && [check_lto_shared_available] } {
run_cc_link_tests $lto_link_elf_tests