mirror of
https://github.com/corda/corda.git
synced 2025-01-19 11:16:54 +00:00
enable powerpc build for process=interpret (won't run yet, though)
This commit is contained in:
parent
9e0f0a17a7
commit
f375f6e85c
2
makefile
2
makefile
@ -346,7 +346,7 @@ $(binaryToMacho): $(src)/binaryToMacho.cpp
|
||||
$(classpath-object): $(build)/classpath.jar $(binaryToMacho)
|
||||
@echo "creating $(@)"
|
||||
ifeq ($(platform),darwin)
|
||||
$(binaryToMacho) $(build)/classpath.jar \
|
||||
$(binaryToMacho) $(asm) $(build)/classpath.jar \
|
||||
__binary_classpath_jar_start __binary_classpath_jar_end > $(@)
|
||||
else
|
||||
(wd=$$(pwd); \
|
||||
|
@ -20,6 +20,8 @@
|
||||
#include "mach-o/loader.h"
|
||||
#include "mach-o/nlist.h"
|
||||
|
||||
|
||||
|
||||
namespace {
|
||||
|
||||
inline unsigned
|
||||
@ -29,16 +31,27 @@ pad(unsigned n)
|
||||
}
|
||||
|
||||
void
|
||||
writeObject(FILE* out, const uint8_t* data, unsigned size,
|
||||
writeObject(const char* architecture,
|
||||
FILE* out, const uint8_t* data, unsigned size,
|
||||
const char* startName, const char* endName)
|
||||
{
|
||||
unsigned startNameLength = strlen(startName) + 1;
|
||||
unsigned endNameLength = strlen(endName) + 1;
|
||||
|
||||
cpu_type_t cpuType;
|
||||
cpu_subtype_t cpuSubtype;
|
||||
if (strcmp(architecture, "x86") == 0) {
|
||||
cpuType = CPU_TYPE_I386;
|
||||
cpuSubtype = CPU_SUBTYPE_I386_ALL;
|
||||
} else if (strcmp(architecture, "powerpc") == 0) {
|
||||
cpuType = CPU_TYPE_POWERPC;
|
||||
cpuSubtype = CPU_SUBTYPE_POWERPC_ALL;
|
||||
}
|
||||
|
||||
mach_header header = {
|
||||
MH_MAGIC, // magic
|
||||
CPU_TYPE_I386, // cputype
|
||||
CPU_SUBTYPE_I386_ALL, // cpusubtype
|
||||
cpuType,
|
||||
cpuSubtype,
|
||||
MH_OBJECT, // filetype,
|
||||
2, // ncmds
|
||||
sizeof(segment_command)
|
||||
@ -136,16 +149,17 @@ writeObject(FILE* out, const uint8_t* data, unsigned size,
|
||||
int
|
||||
main(int argc, const char** argv)
|
||||
{
|
||||
if (argc != 4) {
|
||||
if (argc != 5) {
|
||||
fprintf(stderr,
|
||||
"usage: %s <input file> <start symbol name> <end symbol name>\n",
|
||||
"usage: %s <architecture> <input file> <start symbol name> "
|
||||
"<end symbol name>\n",
|
||||
argv[0]);
|
||||
return -1;
|
||||
}
|
||||
|
||||
uint8_t* data = 0;
|
||||
unsigned size;
|
||||
int fd = open(argv[1], O_RDONLY);
|
||||
int fd = open(argv[2], O_RDONLY);
|
||||
if (fd != -1) {
|
||||
struct stat s;
|
||||
int r = fstat(fd, &s);
|
||||
@ -158,7 +172,7 @@ main(int argc, const char** argv)
|
||||
}
|
||||
|
||||
if (data) {
|
||||
writeObject(stdout, data, size, argv[2], argv[3]);
|
||||
writeObject(argv[1], stdout, data, size, argv[3], argv[4]);
|
||||
munmap(data, size);
|
||||
return 0;
|
||||
} else {
|
||||
|
@ -29,3 +29,12 @@ vmNativeCall:
|
||||
;; mtlr r0 ; into the link register
|
||||
;; addi r1,r1,spaceToSaveAligned ; restore stack pointer
|
||||
blr ; and branch to the return address
|
||||
|
||||
#ifdef __APPLE__
|
||||
.globl _vmJump
|
||||
_vmJump:
|
||||
#else
|
||||
.globl vmJump
|
||||
vmJump:
|
||||
#endif
|
||||
blr
|
||||
|
Loading…
Reference in New Issue
Block a user