OSDN Git Service

resolved conflicts for merge of f4cb6313 to lmp-mr1-dev-plus-aosp
authorDmitriy Ivanov <dimitry@google.com>
Thu, 2 Oct 2014 19:33:10 +0000 (12:33 -0700)
committerDmitriy Ivanov <dimitry@google.com>
Thu, 2 Oct 2014 19:33:10 +0000 (12:33 -0700)
Change-Id: I9c033fa82c7bf07e06157227f5162d603804b7d6

1  2 
linker/linker.cpp
linker/linker.h
tests/libs/Android.mk

@@@ -2168,90 -2112,78 +2160,78 @@@ bool soinfo::LinkImage(const android_dl
  #endif
  
  #if defined(USE_RELA)
 -    if (rela != nullptr) {
 -        DEBUG("[ relocating %s ]", name);
 -        if (Relocate(rela, rela_count)) {
 -            return false;
 -        }
 +  if (rela != nullptr) {
 +    DEBUG("[ relocating %s ]", name);
 +    if (Relocate(rela, rela_count)) {
 +      return false;
      }
 -    if (plt_rela != nullptr) {
 -        DEBUG("[ relocating %s plt ]", name);
 -        if (Relocate(plt_rela, plt_rela_count)) {
 -            return false;
 -        }
 +  }
 +  if (plt_rela != nullptr) {
 +    DEBUG("[ relocating %s plt ]", name);
 +    if (Relocate(plt_rela, plt_rela_count)) {
 +      return false;
      }
 +  }
  #else
 -    if (rel != nullptr) {
 -        DEBUG("[ relocating %s ]", name);
 -        if (Relocate(rel, rel_count)) {
 -            return false;
 -        }
 +  if (rel != nullptr) {
 +    DEBUG("[ relocating %s ]", name);
 +    if (Relocate(rel, rel_count)) {
 +      return false;
      }
 -    if (plt_rel != nullptr) {
 -        DEBUG("[ relocating %s plt ]", name);
 -        if (Relocate(plt_rel, plt_rel_count)) {
 -            return false;
 -        }
 +  }
 +  if (plt_rel != nullptr) {
 +    DEBUG("[ relocating %s plt ]", name);
 +    if (Relocate(plt_rel, plt_rel_count)) {
 +      return false;
      }
 +  }
  #endif
  
-     // if there are ifuncs, we need to do an additional relocation pass.
-     // they cannot be resolved until the rest of the relocations are done
-     // because we need to call the resolution function which may be waiting
-     // on relocations.
-     if(get_has_ifuncs()) {
- #if defined(__i386__)
-       soinfo_ifunc_relocate(this, plt_rel, plt_rel_count);
- #elif defined(__x86_64__)
-       soinfo_ifunc_relocate(this, plt_rela, plt_rela_count);
- #endif
-     }
  #if defined(__mips__)
 -    if (!mips_relocate_got(this)) {
 -        return false;
 -    }
 +  if (!mips_relocate_got(this)) {
 +    return false;
 +  }
  #endif
  
 -    DEBUG("[ finished linking %s ]", name);
 +  DEBUG("[ finished linking %s ]", name);
  
  #if !defined(__LP64__)
 -    if (has_text_relocations) {
 -        // All relocations are done, we can protect our segments back to read-only.
 -        if (phdr_table_protect_segments(phdr, phnum, load_bias) < 0) {
 -            DL_ERR("can't protect segments for \"%s\": %s",
 -                   name, strerror(errno));
 -            return false;
 -        }
 +  if (has_text_relocations) {
 +    // All relocations are done, we can protect our segments back to read-only.
 +    if (phdr_table_protect_segments(phdr, phnum, load_bias) < 0) {
 +      DL_ERR("can't protect segments for \"%s\": %s",
 +             name, strerror(errno));
 +      return false;
      }
 +  }
  #endif
  
 -    /* We can also turn on GNU RELRO protection */
 -    if (phdr_table_protect_gnu_relro(phdr, phnum, load_bias) < 0) {
 -        DL_ERR("can't enable GNU RELRO protection for \"%s\": %s",
 -               name, strerror(errno));
 -        return false;
 -    }
 +  /* We can also turn on GNU RELRO protection */
 +  if (phdr_table_protect_gnu_relro(phdr, phnum, load_bias) < 0) {
 +    DL_ERR("can't enable GNU RELRO protection for \"%s\": %s",
 +           name, strerror(errno));
 +    return false;
 +  }
  
 -    /* Handle serializing/sharing the RELRO segment */
 -    if (extinfo && (extinfo->flags & ANDROID_DLEXT_WRITE_RELRO)) {
 -      if (phdr_table_serialize_gnu_relro(phdr, phnum, load_bias,
 -                                         extinfo->relro_fd) < 0) {
 -        DL_ERR("failed serializing GNU RELRO section for \"%s\": %s",
 -               name, strerror(errno));
 -        return false;
 -      }
 -    } else if (extinfo && (extinfo->flags & ANDROID_DLEXT_USE_RELRO)) {
 -      if (phdr_table_map_gnu_relro(phdr, phnum, load_bias,
 -                                   extinfo->relro_fd) < 0) {
 -        DL_ERR("failed mapping GNU RELRO section for \"%s\": %s",
 -               name, strerror(errno));
 -        return false;
 -      }
 +  /* Handle serializing/sharing the RELRO segment */
 +  if (extinfo && (extinfo->flags & ANDROID_DLEXT_WRITE_RELRO)) {
 +    if (phdr_table_serialize_gnu_relro(phdr, phnum, load_bias,
 +                                       extinfo->relro_fd) < 0) {
 +      DL_ERR("failed serializing GNU RELRO section for \"%s\": %s",
 +             name, strerror(errno));
 +      return false;
      }
 +  } else if (extinfo && (extinfo->flags & ANDROID_DLEXT_USE_RELRO)) {
 +    if (phdr_table_map_gnu_relro(phdr, phnum, load_bias,
 +                                 extinfo->relro_fd) < 0) {
 +      DL_ERR("failed mapping GNU RELRO section for \"%s\": %s",
 +             name, strerror(errno));
 +      return false;
 +    }
 +  }
  
 -    notify_gdb_of_load(this);
 -    return true;
 +  notify_gdb_of_load(this);
 +  return true;
  }
  
  /*
diff --cc linker/linker.h
@@@ -214,15 -214,9 +214,13 @@@ struct soinfo 
  
    void set_st_dev(dev_t st_dev);
    void set_st_ino(ino_t st_ino);
-   void set_has_ifuncs(bool ifunc);
    ino_t get_st_ino();
    dev_t get_st_dev();
-   bool get_has_ifuncs();
  
 +
 +
 +  int get_rtld_flags();
 +
    soinfo_list_t& get_children();
    soinfo_list_t& get_parents();
  
Simple merge