From: Alan Modra Date: Sat, 3 Dec 2011 10:29:01 +0000 (+0000) Subject: PR ld/13468 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=be7b303d27c7f45f989ac6f2b348c5311a66119d;p=binutils-gdb.git PR ld/13468 * elflink.c (bfd_elf_final_link): Don't segfault when checking for DT_TEXTREL and .dynamic does not exist. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 12c332a90e9..77d6ad8be37 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,9 @@ +2011-12-03 Alan Modra + + PR ld/13468 + * elflink.c (bfd_elf_final_link): Don't segfault when checking + for DT_TEXTREL and .dynamic does not exist. + 2011-12-03 Alan Modra PR ld/13470 diff --git a/bfd/elflink.c b/bfd/elflink.c index 3448bfc5e13..ac95c223325 100644 --- a/bfd/elflink.c +++ b/bfd/elflink.c @@ -11188,15 +11188,12 @@ bfd_elf_final_link (bfd *abfd, struct bfd_link_info *info) goto error_return; /* Check for DT_TEXTREL (late, in case the backend removes it). */ - if ((info->warn_shared_textrel && info->shared) - || info->error_textrel) + if (((info->warn_shared_textrel && info->shared) + || info->error_textrel) + && (o = bfd_get_section_by_name (dynobj, ".dynamic")) != NULL) { bfd_byte *dyncon, *dynconend; - /* Fix up .dynamic entries. */ - o = bfd_get_section_by_name (dynobj, ".dynamic"); - BFD_ASSERT (o != NULL); - dyncon = o->contents; dynconend = o->contents + o->size; for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)