-
Notifications
You must be signed in to change notification settings - Fork 5
/
objectfile.d
40 lines (37 loc) · 930 Bytes
/
objectfile.d
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
36
37
38
39
40
import datafile;
import modules;
import omflibraryfile;
import omfobjectfile;
import cofflibraryfile;
import coffobjectfile;
import sectiontable;
import symboltable;
import workqueue;
abstract class ObjectFile : Module
{
this(string name)
{
super(name);
}
static ObjectFile detectFormat(DataFile f)
{
switch(f.peekByte())
{
case 0x80:
return new OmfObjectFile(f);
case 0xF0:
return new OmfLibraryFile(f);
case 0x4C:
return new CoffObjectFile(f);
case 0x00:
return new CoffImportFile(f);
case 0x21:
return new CoffLibraryFile(f);
default:
return null;
}
}
abstract void dump();
abstract void loadSymbols(SymbolTable symtab, SectionTable segtab, WorkQueue!string queue, WorkQueue!ObjectFile objects);
abstract void loadData(uint tlsBase);
}