mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-02-21 21:29:41 +00:00
MC/Mach-O: Implement EmitValue using data fragments + fixups instead of fill fragment.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@96091 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
3a30b827a5
commit
45f4874611
@ -333,7 +333,23 @@ void MCMachOStreamer::EmitBytes(StringRef Data, unsigned AddrSpace) {
|
||||
|
||||
void MCMachOStreamer::EmitValue(const MCExpr *Value, unsigned Size,
|
||||
unsigned AddrSpace) {
|
||||
new MCFillFragment(*AddValueSymbols(Value), Size, 1, CurSectionData);
|
||||
// Assume the front-end will have evaluate things absolute expressions, so
|
||||
// just create data + fixup.
|
||||
MCDataFragment *DF = dyn_cast_or_null<MCDataFragment>(getCurrentFragment());
|
||||
if (!DF)
|
||||
DF = new MCDataFragment(CurSectionData);
|
||||
|
||||
// Avoid fixups when possible.
|
||||
int64_t AbsValue;
|
||||
if (Value->EvaluateAsAbsolute(AbsValue)) {
|
||||
// FIXME: Endianness assumption.
|
||||
for (unsigned i = 0; i != Size; ++i)
|
||||
DF->getContents().push_back(uint8_t(AbsValue >> (i * 8)));
|
||||
} else {
|
||||
DF->getFixups().push_back(MCAsmFixup(DF->getContents().size(),
|
||||
*AddValueSymbols(Value), Size));
|
||||
DF->getContents().resize(DF->getContents().size() + Size, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void MCMachOStreamer::EmitValueToAlignment(unsigned ByteAlignment,
|
||||
|
Loading…
x
Reference in New Issue
Block a user