Graceful exit with relocatable linking (-r) when outformat != informat
Hans-Peter Nilsson
hans-peter.nilsson@axis.com
Mon May 14 05:38:00 GMT 2001
It's noted in bfdint.texi (and I agree FWIW), that it is not
generally possible to make ld -r work with mixed output formats.
Anyway, I want a slightly more graceful exit than SEGV. To
repeat, try, for --target=cris:
t1.s:
.text
a:
.long b
as-new --em=crisaout -o t1.o t1.s
ld-new -mcriself -r -o t2.o t1.o
Observe the SEGV in elflink.h:elf_bfd_final_link
(bfd_elf32_bfd_final_link).
I guess TRT is to iterate over input objects, checking that
their object flavor is the same as the output object flavor,
otherwise fail linking, emitting an error message. I can check
input bfds and link_info->relocateable in various
target-specific functions, but perhaps it should be better done
for all targets in ldlang.c:lang_check.
Does that sound right, or can someone think of a better
solution? Perhaps it should be the responsibility of each
target, or each object format, to check that they can "ld -r"?
If for each object format; where would it be the best to insert
such tests? *_bfd_final_link?
By the way: the patch
<URL: http://sources.redhat.com/ml/binutils/2001-05/msg00158.html >
is pending review.
brgds, H-P
More information about the Binutils
mailing list