в файле glibc-src/elf/dl-reloc.c находим строку "relocation processing: %s":
в процедуре
_dl_relocate_object (struct link_map *l, struct r_scope_elem *scope[], int reloc_mode, int consider_profiling)
написано:
Код:
  if (__builtin_expect (GLRO(dl_debug_mask) & DL_DEBUG_RELOC, 0))
    _dl_debug_printf ("\nrelocation processing: %s%s\n",
                  l->l_name[0] ? l->l_name : rtld_progname,
                  lazy ? " (lazy)" : "");

  /* DT_TEXTREL is now in level 2 and might phase out at some time.
     But we rewrite the DT_FLAGS entry to a DT_TEXTREL entry to make
     testing easier and therefore it will be available at all time.  */
  if (__builtin_expect (l->l_info[DT_TEXTREL] != NULL, 0))
    {
      /* Bletch.  We must make read-only segments writable
       long enough to relocate them.  */
      const ElfW(Phdr) *ph;
      for (ph = l->l_phdr; ph < &l->l_phdr[l->l_phnum]; ++ph)
      if (ph->p_type == PT_LOAD && (ph->p_flags & PF_W) == 0)
        { /* read-only секция выполняемого кода (p_type==PT_LOAD) будет сделана writable перед патчингом, он же relocation; сделает это функция __mprotect */
          struct textrels *newp;

          newp = (struct textrels *) alloca (sizeof (*newp));
          newp->len = (((ph->p_vaddr + ph->p_memsz + GLRO(dl_pagesize) - 1)
                    & ~(GLRO(dl_pagesize) - 1))
                   - (ph->p_vaddr & ~(GLRO(dl_pagesize) - 1)));
          newp->start = ((ph->p_vaddr & ~(GLRO(dl_pagesize) - 1))
                     + (caddr_t) l->l_addr);

          if (__mprotect (newp->start, newp->len, PROT_READ|PROT_WRITE) < 0) // секция выполняемого кода  writable если функция __mprotect вернёт код возврата >=0
            {
            errstring = N_("cannot make segment writable for relocation");
            call_error:
            _dl_signal_error (errno, l->l_name, NULL, errstring);
            }

#if (PF_R | PF_W | PF_X) == 7 && (PROT_READ | PROT_WRITE | PROT_EXEC) == 7
          newp->prot = (PF_TO_PROT
                    >> ((ph->p_flags & (PF_R | PF_W | PF_X)) * 4)) & 0xf;
#else
          newp->prot = 0;
          if (ph->p_flags & PF_R)
            newp->prot |= PROT_READ;
          if (ph->p_flags & PF_W)
            newp->prot |= PROT_WRITE;
          if (ph->p_flags & PF_X)
            newp->prot |= PROT_EXEC;
#endif
          newp->next = textrels;
          textrels = newp;
        }
    }