tic6x FAIL: ld-elf/pr3455
Checks
Commit Message
This fixes a fail for a recently added testcase, the underlying cause
being that tic6x-ld target defaults to "elf32-tic6x-elf-le", while
tic6x-as target defaults to "elf32-tic6x-le". I don't know why that
is the case, so rather than reconciling the difference I decided to
tackle the reason why tic6x-ld --shared doesn't create dynamic sections
unless an input object contains relocations. The fix is to relax the
input object test where this normally occurs to match other places
that test object suitability for dynamic sections.
bfd/
* elflink.c (elf_link_add_object_symbols): Use compatible_format
rather than requiring an exact target match when creating
dynamic sections for a dynamic output object.
ld/
* testsuite/ld-elf/elf.exp: Use append.
* testsuite/ld-elf/pr24718-1.d: Don't xfail tic6x.
* testsuite/ld-elf/pr27128a.d: Likewise.
* testsuite/ld-elf/pr27128b.d: Likewise.
* testsuite/ld-elf/pr27128c.d: Likewise.
* testsuite/ld-elf/pr27128d.d: Likewise.
* testsuite/ld-elf/pr27128e.d: Likewise.
Comments
On Mon, Aug 31, 2026 at 07:48:59AM +0930, Alan Modra wrote:
> This fixes a fail for a recently added testcase
Oops, subject should have been "tic6x FAIL: ld-elf/pr34550".
In commit ee7896781dc7 I moved a !htab->dynamic_sections_created test
earlier, thinking "let's do the easy test first". Bad idea. We might
not have an elf hash table, eg. ld-elf/pr21884. So that test must
come after verifying the type of hash table (in compatible_format).
In fact, we might as well let bfd_elf_link_create_dynamic_sections run
as it will return early if dynamic sections are already created.
* elflink.c (elf_link_add_object_symbols): Don't test for
dynamic sections already created.
diff --git a/bfd/elflink.c b/bfd/elflink.c
index 172cb439b6b..d5956b8bd2f 100644
--- a/bfd/elflink.c
+++ b/bfd/elflink.c
@@ -4633,7 +4633,6 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
are no input BFD's of the same format as the output, we can't
make a shared library. */
if (!just_syms
- && !htab->dynamic_sections_created
&& (bfd_link_pic (info)
|| (!bfd_link_relocatable (info)
&& info->nointerp
@@ -4633,13 +4633,12 @@ elf_link_add_object_symbols (bfd *abfd, struct bfd_link_info *info)
are no input BFD's of the same format as the output, we can't
make a shared library. */
if (!just_syms
+ && !htab->dynamic_sections_created
&& (bfd_link_pic (info)
|| (!bfd_link_relocatable (info)
&& info->nointerp
&& (info->export_dynamic || info->dynamic)))
- && is_elf_hash_table (&htab->root)
- && info->output_bfd->xvec == abfd->xvec
- && !htab->dynamic_sections_created)
+ && compatible_format (info, abfd))
{
if (!bfd_elf_link_create_dynamic_sections (info))
goto error_return;
@@ -40,7 +40,7 @@ proc riscv_little_endian { } {
set old_ldflags $LDFLAGS
if { [istarget spu*-*-*] } {
- set LDFLAGS "$LDFLAGS --local-store 0:0"
+ append LDFLAGS " --local-store 0:0"
}
# hpux .comm differs from everyone else
@@ -48,7 +48,7 @@ set hpux ""
set old_asflags $ASFLAGS
if [istarget "*-*-hpux*"] {
set hpux "--defsym HPUX=1"
- set ASFLAGS "$ASFLAGS --defsym HPUX=1"
+ append ASFLAGS " --defsym HPUX=1"
}
# Some tests expect 32-bit addresses. Force the executable to low addresses.
@@ -60,7 +60,7 @@ proc alpha_ld_flags { } {
}
if { [istarget alpha*-*-* ] } {
- set ASFLAGS "$ASFLAGS --defsym NO_SET=1"
+ append ASFLAGS " --defsym NO_SET=1"
}
if [istarget "tic6x-*-*"] {
@@ -1,8 +1,6 @@
#ld: -shared -version-script pr24718-1.t
#readelf: -V
#target: [check_shared_lib_support]
-#xfail: tic6x-*-*
-# tic6x requires a non-default emulation.
#...
Version definition section '\.gnu\.version_d' contains 3 entries:
@@ -4,8 +4,6 @@
#target: [check_shared_lib_support]
#notarget: [is_underscore_target]
# _Zrm1XS_ doesn't have an extra underscore.
-#xfail: tic6x-*-*
-# tic6x DYN lacks dynamic sections for this testcase
#...
VERS_2\.0 A 0+
@@ -4,8 +4,8 @@
#target: [check_shared_lib_support]
#notarget: [is_underscore_target]
# _Zrm1XS_ doesn't have an extra underscore.
-#xfail: hppa64-*-* tic6x-*-*
-# hppa64 uses dot-symbols, tic6x DYN lacks dynamic sections for this testcase
+#xfail: hppa64-*-*
+# hppa64 uses dot-symbols
#...
VERS_2\.0 A 0+
@@ -4,8 +4,6 @@
#target: [check_shared_lib_support]
#notarget: [is_underscore_target]
# _Zrm1XS_ doesn't have an extra underscore.
-#xfail: tic6x-*-*
-# tic6x DYN lacks dynamic sections for this testcase
#...
VERS_2\.0 +\|0+\| +A +\| +OBJECT\| +\| +\|\*ABS\*
@@ -4,8 +4,8 @@
#target: [check_shared_lib_support]
#notarget: [is_underscore_target]
# _Zrm1XS_ doesn't have an extra underscore.
-#xfail: hppa64-*-* tic6x-*-*
-# hppa64 uses dot-symbols, tic6x DYN lacks dynamic sections for this testcase
+#xfail: hppa64-*-*
+# hppa64 uses dot-symbols
#...
VERS_2\.0 +\|0+\| +A +\| +OBJECT\| +\| +\|\*ABS\*
@@ -4,8 +4,8 @@
#target: [check_shared_lib_support]
#notarget: [is_underscore_target]
# _Zrm1XS_ doesn't have an extra underscore.
-#xfail: hppa64-*-* tic6x-*-*
-# hppa64 uses dot-symbols, tic6x DYN lacks dynamic sections for this testcase
+#xfail: hppa64-*-*
+# hppa64 uses dot-symbols
#...
VERS_2\.0 A 0+