More just-syms changes

* ldlang.c (lang_check): Don't complain about relocs or merge
	attributes from --just-symbols input.
	* testsuite/ld-misc/just-symbols.exp: Just dump .data section.
	Don't run test on a number of targets.
This commit is contained in:
Alan Modra 2020-07-28 11:44:16 +09:30
parent c38166b376
commit f437dadd89
3 changed files with 22 additions and 7 deletions

View file

@ -1,3 +1,10 @@
2020-07-28 Alan Modra <amodra@gmail.com>
* ldlang.c (lang_check): Don't complain about relocs or merge
attributes from --just-symbols input.
* testsuite/ld-misc/just-symbols.exp: Just dump .data section.
Don't run test on a number of targets.
2020-07-28 Alan Modra <amodra@gmail.com> 2020-07-28 Alan Modra <amodra@gmail.com>
* testsuite/ld-misc/just-symbols-1.dd: Revert last change. * testsuite/ld-misc/just-symbols-1.dd: Revert last change.

View file

@ -7001,7 +7001,8 @@ lang_check (void)
input format may not have equivalent representations in input format may not have equivalent representations in
the output format (and besides BFD does not translate the output format (and besides BFD does not translate
relocs for other link purposes than a final link). */ relocs for other link purposes than a final link). */
if ((bfd_link_relocatable (&link_info) if (!file->flags.just_syms
&& (bfd_link_relocatable (&link_info)
|| link_info.emitrelocations) || link_info.emitrelocations)
&& (compatible == NULL && (compatible == NULL
|| (bfd_get_flavour (input_bfd) || (bfd_get_flavour (input_bfd)
@ -7026,8 +7027,9 @@ lang_check (void)
/* If the input bfd has no contents, it shouldn't set the /* If the input bfd has no contents, it shouldn't set the
private data of the output bfd. */ private data of the output bfd. */
else if ((input_bfd->flags & DYNAMIC) != 0 else if (!file->flags.just_syms
|| bfd_count_sections (input_bfd) != 0) && ((input_bfd->flags & DYNAMIC) != 0
|| bfd_count_sections (input_bfd) != 0))
{ {
bfd_error_handler_type pfn = NULL; bfd_error_handler_type pfn = NULL;

View file

@ -20,7 +20,13 @@
# #
# SH/PE targets complain about zero VMA. # SH/PE targets complain about zero VMA.
if { [istarget sh-*-pe] } { # i386-msdos doesn't have .data
# tic30-coff has a weird 32-bit reloc that divides sym value by four
# alpha-dec-vms wants a bunch of libs to link
if { [istarget sh-*-pe]
|| [istarget *-*-msdos]
|| [istarget *c30-*-*]
|| [istarget alpha-*-vms] } {
return return
} }
@ -49,13 +55,13 @@ run_ld_link_tests [list \
"$LDFLAGS -e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0.o" "" \ "$LDFLAGS -e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0.o" "" \
"" \ "" \
{just-symbols-1.s} \ {just-symbols-1.s} \
{{objdump -s just-symbols-1.dd}} \ {{objdump {-s -j .data} just-symbols-1.dd}} \
"just-symbols-1obj"] \ "just-symbols-1obj"] \
[list "Executable with --just-symbols test" \ [list "Executable with --just-symbols test" \
"$LDFLAGS -e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0" "" \ "$LDFLAGS -e 0 -T just-symbols.ld --just-symbols=tmpdir/just-symbols-0" "" \
"" \ "" \
{just-symbols-1.s} \ {just-symbols-1.s} \
{{objdump -s just-symbols-1.dd}} \ {{objdump {-s -j .data} just-symbols-1.dd}} \
"just-symbols-1exe"] \ "just-symbols-1exe"] \
] ]