adjust_eh_frame_local_symbols (const asection *sec,
                               struct elf_reloc_cookie *cookie)
 {
-  unsigned int shndx;
-  Elf_Internal_Sym *sym;
-  Elf_Internal_Sym *end_sym;
   int adjusted = 0;
 
-  shndx = elf_section_data (sec)->this_idx;
-  end_sym = cookie->locsyms + cookie->locsymcount;
-  for (sym = cookie->locsyms + 1; sym < end_sym; ++sym)
-    if (sym->st_info <= ELF_ST_INFO (STB_LOCAL, STT_OBJECT)
-       && sym->st_shndx == shndx)
-      {
-       bfd_signed_vma delta = offset_adjust (sym->st_value, sec);
+  if (cookie->locsymcount > 1)
+    {
+      unsigned int shndx = elf_section_data (sec)->this_idx;
+      Elf_Internal_Sym *end_sym = cookie->locsyms + cookie->locsymcount;
+      Elf_Internal_Sym *sym;
 
-       if (delta != 0)
+      for (sym = cookie->locsyms + 1; sym < end_sym; ++sym)
+       if (sym->st_info <= ELF_ST_INFO (STB_LOCAL, STT_OBJECT)
+           && sym->st_shndx == shndx)
          {
-           adjusted = 1;
-           sym->st_value += delta;
+           bfd_signed_vma delta = offset_adjust (sym->st_value, sec);
+
+           if (delta != 0)
+             {
+               adjusted = 1;
+               sym->st_value += delta;
+             }
          }
-      }
+    }
   return adjusted;
 }
 
 
     else
       pp = &s->next;
 
-  if (strip_zero_sized_plt)
+  if (strip_zero_sized_plt && sdynamic->size != 0)
     for (extdyn = sdynamic->contents;
         extdyn < sdynamic->contents + sdynamic->size;
         extdyn = next)
 
       bed = get_elf_backend_data (hash_table->dynobj);
       sdyn = bfd_get_linker_section (hash_table->dynobj, ".dynamic");
-      if (sdyn != NULL)
+      if (sdyn != NULL && sdyn->size != 0)
        for (extdyn = sdyn->contents;
             extdyn < sdyn->contents + sdyn->size;
             extdyn += bed->s->sizeof_dyn)
 
   /* Update all .dynamic entries referencing .dynstr strings.  */
   for (extdyn = sdyn->contents;
-       extdyn < sdyn->contents + sdyn->size;
+       extdyn < PTR_ADD (sdyn->contents, sdyn->size);
        extdyn += bed->s->sizeof_dyn)
     {
       Elf_Internal_Dyn dyn;
                       | DYN_NO_NEEDED)) == 0;
 
       s = bfd_get_section_by_name (abfd, ".dynamic");
-      if (s != NULL)
+      if (s != NULL && s->size != 0)
        {
          bfd_byte *dynbuf;
          bfd_byte *extdyn;
        (_("%pB: plugin needed to handle lto object"), abfd);
     }
 
-  for (isym = isymbuf, isymend = isymbuf + extsymcount;
+  for (isym = isymbuf, isymend = PTR_ADD (isymbuf, extsymcount);
        isym < isymend;
        isym++, sym_hash++, ever = (ever != NULL ? ever + 1 : NULL))
     {
   /* Find local symbol sections and adjust values of symbols in
      SEC_MERGE sections.  Write out those local symbols we know are
      going into the output file.  */
-  isymend = isymbuf + locsymcount;
+  isymend = PTR_ADD (isymbuf, locsymcount);
   for (isym = isymbuf, pindex = flinfo->indices, ppsection = flinfo->sections;
        isym < isymend;
        isym++, pindex++, ppsection++)
 
              irela = internal_relocs;
              irelaend = irela + o->reloc_count;
-             rel_hash = esdo->rel.hashes + esdo->rel.count;
+             rel_hash = PTR_ADD (esdo->rel.hashes, esdo->rel.count);
              /* We start processing the REL relocs, if any.  When we reach
                 IRELAMID in the loop, we switch to the RELA relocs.  */
              irelamid = irela;
 
                  if (irela == irelamid)
                    {
-                     rel_hash = esdo->rela.hashes + esdo->rela.count;
+                     rel_hash = PTR_ADD (esdo->rela.hashes, esdo->rela.count);
                      rela_hash_list = rel_hash;
                      rela_normal = bed->rela_normal;
                    }
       BFD_ASSERT (o != NULL);
 
       dyncon = o->contents;
-      dynconend = o->contents + o->size;
+      dynconend = PTR_ADD (o->contents, o->size);
       for (; dyncon < dynconend; dyncon += bed->s->sizeof_dyn)
        {
          Elf_Internal_Dyn dyn;
 
       /* Check for DT_TEXTREL (late, in case the backend removes it).  */
       if (bfd_link_textrel_check (info)
-         && (o = bfd_get_linker_section (dynobj, ".dynamic")) != NULL)
+         && (o = bfd_get_linker_section (dynobj, ".dynamic")) != NULL
+         && o->size != 0)
        {
          bfd_byte *dyncon, *dynconend;
 
     extsymcount -= elf_tdata (abfd)->symtab_hdr.sh_info;
 
   sym_hashes = elf_sym_hashes (abfd);
-  sym_hashes_end = sym_hashes + extsymcount;
+  sym_hashes_end = PTR_ADD (sym_hashes, extsymcount);
 
   /* Hunt down the child symbol, which is in this section at the same
      offset as the relocation.  */