File tree Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Expand file tree Collapse file tree 2 files changed +44
-2
lines changed Original file line number Diff line number Diff line change @@ -28,6 +28,28 @@ class TargetAsmBackend {
28
28
29
29
const Target &getTarget () const { return TheTarget; }
30
30
31
+ // / hasAbsolutizedSet - Check whether this target "absolutizes"
32
+ // / assignments. That is, given code like:
33
+ // / a:
34
+ // / ...
35
+ // / b:
36
+ // / tmp = a - b
37
+ // / .long tmp
38
+ // / will the value of 'tmp' be a relocatable expression, or the assembly time
39
+ // / value of L0 - L1. This distinction is only relevant for platforms that
40
+ // / support scattered symbols, since in the absence of scattered symbols (a -
41
+ // / b) cannot change after assembly.
42
+ virtual bool hasAbsolutizedSet () const { return false ; }
43
+
44
+ // / hasScatteredSymbols - Check whether this target supports scattered
45
+ // / symbols. If so, the assembler should assume that atoms can be scattered by
46
+ // / the linker. In particular, this means that the offsets between symbols
47
+ // / which are in distinct atoms is not known at link time, and the assembler
48
+ // / must generate fixups and relocations appropriately.
49
+ // /
50
+ // / Note that the assembler currently does not reason about atoms, instead it
51
+ // / assumes all temporary symbols reside in the "current atom".
52
+ virtual bool hasScatteredSymbols () const { return false ; }
31
53
};
32
54
33
55
} // End llvm namespace
Original file line number Diff line number Diff line change @@ -21,14 +21,34 @@ class X86AsmBackend : public TargetAsmBackend {
21
21
: TargetAsmBackend(T) {}
22
22
};
23
23
24
+ class DarwinX86AsmBackend : public X86AsmBackend {
25
+ public:
26
+ DarwinX86AsmBackend (const Target &T)
27
+ : X86AsmBackend(T) {}
28
+
29
+ virtual bool hasAbsolutizedSet () const { return true ; }
30
+
31
+ virtual bool hasScatteredSymbols () const { return true ; }
32
+ };
33
+
24
34
}
25
35
26
36
TargetAsmBackend *llvm::createX86_32AsmBackend (const Target &T,
27
37
const std::string &TT) {
28
- return new X86AsmBackend (T);
38
+ switch (Triple (TT).getOS ()) {
39
+ case Triple::Darwin:
40
+ return new DarwinX86AsmBackend (T);
41
+ default :
42
+ return new X86AsmBackend (T);
43
+ }
29
44
}
30
45
31
46
TargetAsmBackend *llvm::createX86_64AsmBackend (const Target &T,
32
47
const std::string &TT) {
33
- return new X86AsmBackend (T);
48
+ switch (Triple (TT).getOS ()) {
49
+ case Triple::Darwin:
50
+ return new DarwinX86AsmBackend (T);
51
+ default :
52
+ return new X86AsmBackend (T);
53
+ }
34
54
}
You can’t perform that action at this time.
0 commit comments