- if ((sec->output_section == NULL
- && (sec->owner->flags & DYNAMIC) != 0)
-
- /* Here follow the cases where the relocation value must
- be zero (or when further handling is simplified when
- zero). I can't claim to understand the various
- conditions and they weren't described in the files
- where I copied them from (elf32-m68k.c and
- elf32-i386.c), but let's mention examples of where
- they happen. FIXME: Perhaps define and use a
- dynamic_symbol_p function like ia64.
-
- - When creating a shared library, we can have an
- ordinary relocation for a symbol defined in a shared
- library (perhaps the one we create). We then make
- the relocation value zero, as the value seen now will
- be added into the relocation addend in this shared
- library, but must be handled only at dynamic-link
- time. FIXME: Not sure this example covers the
- h->elf_link_hash_flags test, though it's there in
- other targets. */
- || (info->shared
- && ((! info->symbolic && h->dynindx != -1)
- || (h->elf_link_hash_flags
- & ELF_LINK_HASH_DEF_REGULAR) == 0)
- && (input_section->flags & SEC_ALLOC) != 0
- && (r_type == R_CRIS_8
- || r_type == R_CRIS_16
- || r_type == R_CRIS_32
- || r_type == R_CRIS_8_PCREL
- || r_type == R_CRIS_16_PCREL
- || r_type == R_CRIS_32_PCREL)))
+ && (sec->owner->flags & DYNAMIC) != 0)
+ relocation = 0;
+
+ else if (h->root.type == bfd_link_hash_defined
+ || h->root.type == bfd_link_hash_defweak)
+ {
+ /* Here follow the cases where the relocation value must
+ be zero (or when further handling is simplified when
+ zero). I can't claim to understand the various
+ conditions and they weren't described in the files
+ where I copied them from (elf32-m68k.c and
+ elf32-i386.c), but let's mention examples of where
+ they happen. FIXME: Perhaps define and use a
+ dynamic_symbol_p function like ia64.
+
+ - When creating a shared library, we can have an
+ ordinary relocation for a symbol defined in a shared
+ library (perhaps the one we create). We then make
+ the relocation value zero, as the value seen now will
+ be added into the relocation addend in this shared
+ library, but must be handled only at dynamic-link
+ time. FIXME: Not sure this example covers the
+ h->elf_link_hash_flags test, though it's there in
+ other targets. */
+ if (info->shared
+ && ((! info->symbolic && h->dynindx != -1)
+ || !h->def_regular)
+ && (input_section->flags & SEC_ALLOC) != 0
+ && (r_type == R_CRIS_8
+ || r_type == R_CRIS_16
+ || r_type == R_CRIS_32
+ || r_type == R_CRIS_8_PCREL
+ || r_type == R_CRIS_16_PCREL
+ || r_type == R_CRIS_32_PCREL))