Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(590)

Side by Side Diff: fusl/src/internal/fdpic_crt.h

Issue 1573973002: Add a "fork" of musl as //fusl. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fusl/src/internal/dynlink.h ('k') | fusl/src/internal/floatscan.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #include <stdint.h>
2
3 __attribute__((__visibility__("hidden")))
4 void *__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 }
OLDNEW
« no previous file with comments | « fusl/src/internal/dynlink.h ('k') | fusl/src/internal/floatscan.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698