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

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

Issue 1714623002: [fusl] clang-format fusl (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: headers too Created 4 years, 10 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
OLDNEW
1 #ifndef _INTERNAL_RELOC_H 1 #ifndef _INTERNAL_RELOC_H
2 #define _INTERNAL_RELOC_H 2 #define _INTERNAL_RELOC_H
3 3
4 #include <features.h> 4 #include <features.h>
5 #include <elf.h> 5 #include <elf.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #if UINTPTR_MAX == 0xffffffff 8 #if UINTPTR_MAX == 0xffffffff
9 typedef Elf32_Ehdr Ehdr; 9 typedef Elf32_Ehdr Ehdr;
10 typedef Elf32_Phdr Phdr; 10 typedef Elf32_Phdr Phdr;
11 typedef Elf32_Sym Sym; 11 typedef Elf32_Sym Sym;
12 #define R_TYPE(x) ((x)&255) 12 #define R_TYPE(x) ((x)&255)
13 #define R_SYM(x) ((x)>>8) 13 #define R_SYM(x) ((x) >> 8)
14 #else 14 #else
15 typedef Elf64_Ehdr Ehdr; 15 typedef Elf64_Ehdr Ehdr;
16 typedef Elf64_Phdr Phdr; 16 typedef Elf64_Phdr Phdr;
17 typedef Elf64_Sym Sym; 17 typedef Elf64_Sym Sym;
18 #define R_TYPE(x) ((x)&0x7fffffff) 18 #define R_TYPE(x) ((x)&0x7fffffff)
19 #define R_SYM(x) ((x)>>32) 19 #define R_SYM(x) ((x) >> 32)
20 #endif 20 #endif
21 21
22 /* These enum constants provide unmatchable default values for 22 /* These enum constants provide unmatchable default values for
23 * any relocation type the arch does not use. */ 23 * any relocation type the arch does not use. */
24 enum { 24 enum {
25 » REL_NONE = 0, 25 REL_NONE = 0,
26 » REL_SYMBOLIC = -100, 26 REL_SYMBOLIC = -100,
27 » REL_GOT, 27 REL_GOT,
28 » REL_PLT, 28 REL_PLT,
29 » REL_RELATIVE, 29 REL_RELATIVE,
30 » REL_OFFSET, 30 REL_OFFSET,
31 » REL_OFFSET32, 31 REL_OFFSET32,
32 » REL_COPY, 32 REL_COPY,
33 » REL_SYM_OR_REL, 33 REL_SYM_OR_REL,
34 » REL_DTPMOD, 34 REL_DTPMOD,
35 » REL_DTPOFF, 35 REL_DTPOFF,
36 » REL_TPOFF, 36 REL_TPOFF,
37 » REL_TPOFF_NEG, 37 REL_TPOFF_NEG,
38 » REL_TLSDESC, 38 REL_TLSDESC,
39 » REL_FUNCDESC, 39 REL_FUNCDESC,
40 » REL_FUNCDESC_VAL, 40 REL_FUNCDESC_VAL,
41 }; 41 };
42 42
43 struct fdpic_loadseg { 43 struct fdpic_loadseg {
44 » uintptr_t addr, p_vaddr, p_memsz; 44 uintptr_t addr, p_vaddr, p_memsz;
45 }; 45 };
46 46
47 struct fdpic_loadmap { 47 struct fdpic_loadmap {
48 » unsigned short version, nsegs; 48 unsigned short version, nsegs;
49 » struct fdpic_loadseg segs[]; 49 struct fdpic_loadseg segs[];
50 }; 50 };
51 51
52 struct fdpic_dummy_loadmap { 52 struct fdpic_dummy_loadmap {
53 » unsigned short version, nsegs; 53 unsigned short version, nsegs;
54 » struct fdpic_loadseg segs[1]; 54 struct fdpic_loadseg segs[1];
55 }; 55 };
56 56
57 #include "reloc.h" 57 #include "reloc.h"
58 58
59 #ifndef FDPIC_CONSTDISP_FLAG 59 #ifndef FDPIC_CONSTDISP_FLAG
60 #define FDPIC_CONSTDISP_FLAG 0 60 #define FDPIC_CONSTDISP_FLAG 0
61 #endif 61 #endif
62 62
63 #ifndef DL_FDPIC 63 #ifndef DL_FDPIC
64 #define DL_FDPIC 0 64 #define DL_FDPIC 0
65 #endif 65 #endif
66 66
67 #ifndef DL_NOMMU_SUPPORT 67 #ifndef DL_NOMMU_SUPPORT
68 #define DL_NOMMU_SUPPORT 0 68 #define DL_NOMMU_SUPPORT 0
69 #endif 69 #endif
70 70
71 #if !DL_FDPIC 71 #if !DL_FDPIC
72 #define IS_RELATIVE(x,s) ( \ 72 #define IS_RELATIVE(x, s) \
73 » (R_TYPE(x) == REL_RELATIVE) || \ 73 ((R_TYPE(x) == REL_RELATIVE) || (R_TYPE(x) == REL_SYM_OR_REL && !R_SYM(x)))
74 » (R_TYPE(x) == REL_SYM_OR_REL && !R_SYM(x)) )
75 #else 74 #else
76 #define IS_RELATIVE(x,s) ( ( \ 75 #define IS_RELATIVE(x, s) \
77 » (R_TYPE(x) == REL_FUNCDESC_VAL) || \ 76 (((R_TYPE(x) == REL_FUNCDESC_VAL) || (R_TYPE(x) == REL_SYMBOLIC)) && \
78 » (R_TYPE(x) == REL_SYMBOLIC) ) \ 77 (((s)[R_SYM(x)].st_info & 0xf) == STT_SECTION))
79 » && (((s)[R_SYM(x)].st_info & 0xf) == STT_SECTION) )
80 #endif 78 #endif
81 79
82 #ifndef NEED_MIPS_GOT_RELOCS 80 #ifndef NEED_MIPS_GOT_RELOCS
83 #define NEED_MIPS_GOT_RELOCS 0 81 #define NEED_MIPS_GOT_RELOCS 0
84 #endif 82 #endif
85 83
86 #ifndef DT_DEBUG_INDIRECT 84 #ifndef DT_DEBUG_INDIRECT
87 #define DT_DEBUG_INDIRECT 0 85 #define DT_DEBUG_INDIRECT 0
88 #endif 86 #endif
89 87
90 #define AUX_CNT 32 88 #define AUX_CNT 32
91 #define DYN_CNT 32 89 #define DYN_CNT 32
92 90
93 typedef void (*stage2_func)(unsigned char *, size_t *); 91 typedef void (*stage2_func)(unsigned char*, size_t*);
94 typedef _Noreturn void (*stage3_func)(size_t *); 92 typedef _Noreturn void (*stage3_func)(size_t*);
95 93
96 #endif 94 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698