7 #define unlikely(expr) __builtin_expect (expr, 0)
8 #define likely(expr) __builtin_expect (expr, 1)
10 #define MIN(a,b) ((a)<(b)?(a):(b)) /* no side effects in arguments allowed! */
12 typedef int (*section_match_fn_t)(Elf *, Elf_Scn *, void *);
13 void map_over_sections(Elf *, section_match_fn_t, void *);
15 typedef int (*segment_match_fn_t)(Elf *, Elf32_Phdr *, void *);
16 void map_over_segments(Elf *, segment_match_fn_t, void *);
25 static inline void get_section_info(Elf_Scn *sect, section_info_t *info)
28 info->data = elf_getdata(sect, 0);
29 info->hdr = elf32_getshdr(sect);
30 info->index = elf_ndxscn(sect);
33 static inline int is_host_little(void)
36 return ((char *)&val)[0] != 0;
39 static inline long switch_endianness(long val)
42 ((char *)&newval)[3] = ((char *)&val)[0];
43 ((char *)&newval)[2] = ((char *)&val)[1];
44 ((char *)&newval)[1] = ((char *)&val)[2];
45 ((char *)&newval)[0] = ((char *)&val)[3];