corda/src/bootimage-fields.cpp
Joel Dice c537dcfd34 generate read-only code image in bootimage build
This avoids the requirement of putting the code image in a
section/segment which is both writable and executable, which is good
for security and avoids trouble with systems like iOS which disallow
such things.

The implementation relies on relative addressing such that the offset
of the desired address is fixed as a compile-time constant relative to
the start of the memory area of interest (e.g. the code image, heap
image, or thunk table).  At runtime, the base pointer to the memory
area is retrieved from the thread structure and added to the offset to
compute the final address.  Using the thread pointer allows us to
generate read-only, position-independent code while avoiding the use
of IP-relative addressing, which is not available on all
architectures.
2011-09-20 16:30:30 -06:00

44 lines
688 B
C++

#ifndef FIELD
# define FIELD(name)
# define FIELD_DEFINED
#endif
FIELD(magic)
FIELD(heapSize)
FIELD(codeSize)
FIELD(bootClassCount)
FIELD(appClassCount)
FIELD(stringCount)
FIELD(callCount)
FIELD(bootLoader)
FIELD(appLoader)
FIELD(types)
FIELD(methodTree)
FIELD(methodTreeSentinal)
FIELD(virtualThunks)
#ifdef FIELD_DEFINED
# undef FIELD
# undef FIELD_DEFINED
#endif
#ifndef THUNK_FIELD
# define THUNK_FIELD(name)
# define THUNK_FIELD_DEFINED
#endif
THUNK_FIELD(default_);
THUNK_FIELD(defaultVirtual);
THUNK_FIELD(native);
THUNK_FIELD(aioob);
THUNK_FIELD(stackOverflow);
THUNK_FIELD(table);
#ifdef THUNK_FIELD_DEFINED
# undef THUNK_FIELD
# undef THUNK_FIELD_DEFINED
#endif