source: asp3_tinet_ecnl_rx/trunk/musl-1.1.18/src/internal/fdpic_crt.h@ 337

Last change on this file since 337 was 337, checked in by coas-nagasima, 6 years ago

ASP3版ECNLを追加

  • Property svn:eol-style set to native
  • Property svn:mime-type set to text/x-chdr;charset=UTF-8
File size: 871 bytes
Line 
1#include <stdint.h>
2
3__attribute__((__visibility__("hidden")))
4void *__fdpic_fixup(void *map, uintptr_t *a, uintptr_t *z)
5{
6 /* If map is a null pointer, the program was loaded by a
7 * non-FDPIC-aware ELF loader, and fixups are not needed,
8 * but the value for the GOT pointer is. */
9 if (!map) return (void *)z[-1];
10
11 struct {
12 unsigned short version, nsegs;
13 struct fdpic_loadseg {
14 uintptr_t addr, p_vaddr, p_memsz;
15 } segs[];
16 } *lm = map;
17 int nsegs = lm->nsegs, rseg = 0, vseg = 0;
18 for (;;) {
19 while (*a-lm->segs[rseg].p_vaddr >= lm->segs[rseg].p_memsz)
20 if (++rseg == nsegs) rseg = 0;
21 uintptr_t *r = (uintptr_t *)
22 (*a + lm->segs[rseg].addr - lm->segs[rseg].p_vaddr);
23 if (++a == z) return r;
24 while (*r-lm->segs[vseg].p_vaddr >= lm->segs[vseg].p_memsz)
25 if (++vseg == nsegs) vseg = 0;
26 *r += lm->segs[vseg].addr - lm->segs[vseg].p_vaddr;
27 }
28}
Note: See TracBrowser for help on using the repository browser.