aboutsummaryrefslogtreecommitdiffhomepage
path: root/obj/obj.h
blob: 0b2eb6c45d36f155cc97ffffdb4c4071f5aaf79e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include "../common.h"

extern struct objfile {
   const char *infile, *outfile;
   uchar *textbegin, *textend;
   uchar *code;
   uchar dataalign, rodataalign, bssalign;
   uint nbss;
   vec_of(uchar) data, rodata;
} objout;

enum relockind {
   REL_ABS64,
   REL_ABS32,
   REL_ABS32S,
   REL_PCREL32,
   REL_PLT32,
   REL_GOTPCRELX,
   REL_GOTPCRELX_REX,
   REL_CALL26,
   REL_ADR_PREL_LO21,
   REL_ADR_PREL_PG_HI21,
   REL_ADD_ABS_LO12_NC,
   NRELOCKIND,
};
enum section { Snone, Stext, Srodata, Sdata, Sbss };

void objini(const char *infile, const char *outfile);
void objdeffunc(internstr nam, bool globl, uint off, uint siz);
enum section objhassym(internstr name, uint *off);
uint objnewdat(internstr name, enum section, bool globl, uint siz, uint align);
void objreloc(internstr sym, enum relockind, enum section, uint off, vlong addend);
void objfini(void);

/* vim:set ts=3 sw=3 expandtab: */