This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
ARM: Raise incompatibility errors for shared objects
- From: Daniel Jacobowitz <drow at mvista dot com>
- To: binutils at sources dot redhat dot com
- Date: Mon, 27 Oct 2003 10:35:06 -0500
- Subject: ARM: Raise incompatibility errors for shared objects
I was recently told that the ARM linker didn't complain when it used a
shared object marked as VFP and a binary marked FPA, or vice versa. The
problem turned out to be some code in elf32_arm_merge_private_bfd_data
designed to skip archives with no contents; if I remember right this was
added for the linux kernel because the empty archives seemed to have the
wrong flags (since they were uninitialized).
Unfortunately, shared objects are linked by removing their sections, to
prevent them from being copied into the output file. If one is used for
building new sections (e.g. .dynamic) then the warning triggers; if it
isn't, then the warning does not trigger. This patch prevents skipping
DYNAMIC objects.
Patch is against 2.14 but also applies to HEAD. OK?
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
2003-10-24 Daniel Jacobowitz <drow@mvista.com>
* elf32-arm.h (elf32_arm_merge_private_bfd_data): Never skip dynamic
objects.
--- binutils-2.14/bfd/elf32-arm.h.orig 2003-10-24 17:50:16.000000000 -0400
+++ binutils-2.14/bfd/elf32-arm.h 2003-10-24 17:53:25.000000000 -0400
@@ -2491,21 +2491,27 @@ elf32_arm_merge_private_bfd_data (ibfd,
if (in_flags == out_flags)
return TRUE;
- /* Check to see if the input BFD actually contains any sections.
- If not, its flags may not have been initialised either, but it cannot
- actually cause any incompatibility. */
- for (sec = ibfd->sections; sec != NULL; sec = sec->next)
- {
- /* Ignore synthetic glue sections. */
- if (strcmp (sec->name, ".glue_7")
- && strcmp (sec->name, ".glue_7t"))
- {
- null_input_bfd = FALSE;
- break;
+ /* Check to see if the input BFD actually contains any sections. If
+ not, its flags may not have been initialised either, but it
+ cannot actually cause any incompatibility. Do not short-circuit
+ dynamic objects; their section list may be emptied by
+ elf_link_add_object_symbols. */
+
+ if (!(ibfd->flags & DYNAMIC))
+ {
+ for (sec = ibfd->sections; sec != NULL; sec = sec->next)
+ {
+ /* Ignore synthetic glue sections. */
+ if (strcmp (sec->name, ".glue_7")
+ && strcmp (sec->name, ".glue_7t"))
+ {
+ null_input_bfd = FALSE;
+ break;
+ }
}
+ if (null_input_bfd)
+ return TRUE;
}
- if (null_input_bfd)
- return TRUE;
/* Complain about various flag mismatches. */
if (EF_ARM_EABI_VERSION (in_flags) != EF_ARM_EABI_VERSION (out_flags))