Skip to content
Snippets Groups Projects
Commit 3771cea7 authored by Anders Blomdell's avatar Anders Blomdell
Browse files

Added fixes for Darwin.

Exposed constructor for generated code in case automatic calling not
supported on platform.
parent ed186dc8
No related branches found
No related tags found
No related merge requests found
......@@ -197,6 +197,7 @@ aspect C_CodeGen {
getDecl(i).C_emitSizeofDeclaration(env);
env.println("");
}
C_emitConstructorDeclaration(env);
C_emitForAll(env);
}
......@@ -943,6 +944,17 @@ aspect C_Signature {
}
public void ASTNode.C_emitConstructorDeclaration(C_env env) {
throw new Error(this.getClass().getName() +
".C_emitConstructorDeclaration(C_env env)" +
" not declared");
}
public void Program.C_emitConstructorDeclaration(C_env env) {
env.println("LABCOMM_CONSTRUCTOR void init_" +
env.prefix + "_signatures(void);");
}
}
aspect C_Sizeof {
......
## Macros
CC=gcc
CFLAGS=-g -Wall -Werror -O3 -I. -Itest
LDFLAGS=-L.
LDLIBS_TEST=-llabcomm -lrt
UNAME_S=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
CC=gcc
CFLAGS=-g -Wall -Werror -O3 -I. -Itest
LDFLAGS=-L.
LDLIBS=-llabcomm -lrt
MAKESHARED=gcc -o $1 -shared -Wl,-soname,$2 $3 -lc -lrt
else ifeq ($(UNAME_S),Darwin)
CC=clang
CFLAGS=-g -Wall -Werror -O3 -I. -Itest
-DLABCOMM_COMPAT=\"labcomm_compat_osx.h\" \
-Wno-tautological-compare -Wno-unused-function
LDLIBS=-llabcomm
MAKESHARED=clang -o $1 -shared -Wl,-install_name,$2 $3 -lc
else
$(error Unknown system $(UNAME_S))
endif
OBJS=labcomm_memory.o \
labcomm_error.o \
......@@ -50,6 +62,7 @@ liblabcomm.a: $(OBJS)
ar -r $@ $^
liblabcomm.so.1: $(OBJS:%.o=%.pic.o)
$(call MAKESHARED,$@,$@,$^)
gcc -shared -Wl,-soname,$@ -o $@ $^ -lc -lrt
labcomm.o : labcomm.c labcomm.h labcomm_private.h
......@@ -72,7 +85,7 @@ $(TEST_DIR)/%.o: $(TEST_DIR)/%.c
.PRECIOUS: $(TEST_DIR)/%
$(TEST_DIR)/%: $(TEST_DIR)/%.o
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(LDLIBS_TEST)
$(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(TEST_DIR)/gen:
mkdir -p $@
......
#ifndef __APPLE__
#error "__APPLE__" not defined
#endif
#ifndef LABCOMM_COMPAT_OSX
#define LABCOMM_COMPAT_OSX
#include <machine/endian.h>
#include <stdio.h>
#include <time.h>
#include <mach/clock.h>
#include <mach/mach.h>
#define CLOCK_REALTIME 0
static void clock_gettime(int garbage, struct timespec *ts)
{
(void) garbage;
clock_serv_t cclock;
mach_timespec_t mts;
host_get_clock_service(mach_host_self(), CALENDAR_CLOCK, &cclock);
clock_get_time(cclock, &mts);
mach_port_deallocate(mach_task_self(), cclock);
ts->tv_sec = mts.tv_sec;
ts->tv_nsec = mts.tv_nsec;
}
#endif
......@@ -27,6 +27,10 @@
#include "labcomm_scheduler_private.h"
#include "labcomm_pthread_scheduler.h"
#ifdef LABCOMM_COMPAT
#include LABCOMM_COMPAT
#endif
struct pthread_time {
struct labcomm_time time;
struct labcomm_memory *memory;
......
File mode changed from 100644 to 100755
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment