Replace deprecated EXTRA_CFLAGS with CFLAGS_$@.
[ksplice.git] / objcommon.h
blob7785024a86b0cc3e8c048b9488f805f710b70417
1 #include <bfd.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <string.h>
6 #define DIE do { printf("ksplice: died at line %d of %s\n", __LINE__, __FILE__); fflush(0); exit(1); } while(0)
7 #define assert(x) do { if(!(x)) DIE; } while(0)
8 #define align(x, n) ((((x)+(n)-1)/(n))*(n))
10 #ifndef bfd_get_section_size
11 #define bfd_get_section_size(x) ((x)->_cooked_size)
12 #endif
14 struct supersect {
15 bfd *parent;
16 char *name;
17 void *contents;
18 int contents_size;
19 arelent **relocs;
20 int num_relocs;
21 struct supersect *next;
24 long get_syms(bfd *abfd, asymbol ***syms_ptr);
25 struct supersect *fetch_supersect(bfd *abfd, asection *sect, asymbol **sympp);
27 #define starts_with(str, prefix) \
28 (strncmp(str, prefix, strlen(prefix)) == 0)
29 #define ends_with(str, suffix) \
30 (strlen(str) >= strlen(suffix) && \
31 strcmp(&str[strlen(str) - strlen(suffix)], suffix) == 0)
33 int label_offset(const char *sym_name);
34 const char *only_label(const char *sym_name);
35 const char *dup_wolabel(const char *sym_name);