From 7a84e3daf81a4008972728f1c0e714901c5b14f3 Mon Sep 17 00:00:00 2001 From: Bernd Schmidt Date: Mon, 11 Feb 2008 16:04:51 +0000 Subject: [PATCH] * elf32-bfin.c (bfin_relocate_section): Set up dynobj before using it if necessary. (elf32_bfin_merge_private_bfd_data): Simplify, and ensure object type mismatches are detected. --- bfd/ChangeLog | 7 +++++++ bfd/elf32-bfin.c | 42 +++++++++++------------------------------- 2 files changed, 18 insertions(+), 31 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 3045a389f9..9e0346c39b 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2008-02-11 Bernd Schmidt + + * elf32-bfin.c (bfin_relocate_section): Set up dynobj before using it + if necessary. + (elf32_bfin_merge_private_bfd_data): Simplify, and ensure object type + mismatches are detected. + 2008-02-11 Daniel Jacobowitz * cache.c (cache_bread): Set bfd_error_file_truncated if EOF diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c index 091e74ed8b..93d07aa447 100644 --- a/bfd/elf32-bfin.c +++ b/bfd/elf32-bfin.c @@ -2924,6 +2924,14 @@ bfin_relocate_section (bfd * output_bfd, { bfd_vma off; + if (dynobj == NULL) + { + /* Create the .got section. */ + elf_hash_table (info)->dynobj = dynobj = output_bfd; + if (!_bfd_elf_create_got_section (dynobj, info)) + return FALSE; + } + if (sgot == NULL) { sgot = bfd_get_section_by_name (dynobj, ".got"); @@ -4795,8 +4803,7 @@ elf32_bfin_print_private_bfd_data (bfd * abfd, PTR ptr) static bfd_boolean elf32_bfin_merge_private_bfd_data (bfd *ibfd, bfd *obfd) { - flagword old_flags, old_partial; - flagword new_flags, new_partial; + flagword old_flags, new_flags; bfd_boolean error = FALSE; new_flags = elf_elfheader (ibfd)->e_flags; @@ -4814,37 +4821,10 @@ elf32_bfin_merge_private_bfd_data (bfd *ibfd, bfd *obfd) if (!elf_flags_init (obfd)) /* First call, no flags set. */ { elf_flags_init (obfd) = TRUE; - old_flags = new_flags; + elf_elfheader (obfd)->e_flags = new_flags; } - else if (new_flags == old_flags) /* Compatible flags are ok. */ - ; - - else /* Possibly incompatible flags. */ - { - /* We don't have to do anything if the pic flags are the same, or the new - module(s) were compiled with -mlibrary-pic. */ - new_partial = (new_flags & EF_BFIN_PIC_FLAGS); - old_partial = (old_flags & EF_BFIN_PIC_FLAGS); - if (new_partial == old_partial) - ; - - /* If we have mixtures of -fpic and -fPIC, or in both bits. */ - else if (new_partial != 0 && old_partial != 0) - old_flags |= new_partial; - - /* One module was compiled for pic and the other was not, see if we have - had any relocations that are not pic-safe. */ - else - old_flags |= new_partial; - - } - - /* Update the old flags now with changes made above. */ - elf_elfheader (obfd)->e_flags = old_flags; - - if (((new_flags & EF_BFIN_FDPIC) == 0) - != (! IS_FDPIC (ibfd))) + if (((new_flags & EF_BFIN_FDPIC) == 0) != (! IS_FDPIC (obfd))) { error = TRUE; if (IS_FDPIC (obfd)) -- 2.34.1