[PATCH] Write references to Native format in NativeReferenceIvarsV2.
Rui Ueyama
ruiu at google.com
Mon Nov 18 12:39:13 PST 2013
Fine. Then let's break the compatibility of V1.
Looking at the other structs in NativeFileFormat.h, all file offsets are in
uint32_t, so NativeFormat seems to be a 32-bit file format. Here's the
definition of NativeReferencesIvarsV1.
struct NativeReferenceIvarsV1 {
uint16_t offsetInAtom;
int16_t kind;
uint16_t targetIndex;
uint16_t addendIndex;
};
Here's what I'm going to change.
- targetIndex needs changing to uint32_t
- offsetInAtom also needs changing to uint32_t, because otherwise there's
no way to represent a relocation pointing to a location 65535 or more bytes
far from the beginning of an atom
- addendIndex needs changing to uint32_t because of the similar reason as
offsetInAtom. It's unlikely there's a file containing so much different
addends. However, Native format is a general format that have to be able to
represent any file that could be given as a valid input. And if addend has
32 bit, we can directly store addend to that field.
So I'd suggest using this data structure.
struct NativeReferenceIvarsV1 {
uint32_t offsetInAtom;
uint32_t targetIndex;
uint32_t addend;
int16_t kind;
int16_t _pad;
};
We also should remove NativeReferenceIvarV2 structure as it's not used by
anyone.
http://llvm-reviews.chandlerc.com/D2217
More information about the llvm-commits
mailing list