directly emit codeimage as a object (binaryToObject is statically linked in), as a stepping stone to including extra symbols in said codeimage

This commit is contained in:
Joshua Warner
2012-05-01 13:16:32 -06:00
parent 99bc9b1d55
commit b742c58055
6 changed files with 122 additions and 56 deletions

View File

@ -45,7 +45,7 @@ writeObject(uint8_t* data, size_t size, OutputStream* out, const char* startName
const char* architecture, unsigned alignment, bool writable,
bool executable)
{
Platform* platform = Platform::getPlatform(PlatformInfo(os, architecture));
Platform* platform = Platform::getPlatform(PlatformInfo(PlatformInfo::osFromString(os), PlatformInfo::archFromString(architecture)));
if(!platform) {
fprintf(stderr, "unsupported platform: %s/%s\n", os, architecture);

View File

@ -11,6 +11,8 @@
#ifndef AVIAN_TOOLS_H_
#define AVIAN_TOOLS_H_
#include "environment.h"
namespace avian {
namespace tools {
@ -96,11 +98,18 @@ public:
class PlatformInfo {
public:
enum OperatingSystem {
Linux, Windows, Darwin, UnknownOS
Linux = AVIAN_PLATFORM_LINUX,
Windows = AVIAN_PLATFORM_WINDOWS,
Darwin = AVIAN_PLATFORM_DARWIN,
UnknownOS = AVIAN_PLATFORM_UNKNOWN
};
enum Architecture {
x86, x86_64, PowerPC, Arm, UnknownArch
x86 = AVIAN_ARCH_X86,
x86_64 = AVIAN_ARCH_X86_64,
PowerPC = AVIAN_ARCH_POWERPC,
Arm = AVIAN_ARCH_ARM,
UnknownArch = AVIAN_ARCH_UNKNOWN
};
const OperatingSystem os;
@ -113,10 +122,6 @@ public:
os(os),
arch(arch) {}
inline PlatformInfo(const char* os, const char* arch):
os(osFromString(os)),
arch(archFromString(arch)) {}
inline bool operator == (const PlatformInfo& other) {
return os == other.os && arch == other.arch;
}