@mkdir -p $(dir $(_BIN))
@echo [LD] -o $(BIN) $(OBJ)
@$(LD) $(LDFLAGS) -o $(_BIN) $(OBJ) $(shell $(CC) -print-libgcc-file-name)
- @$(DISASM) -S $(_BIN) > $(_OBJPREFIX)$(BIN).dsm
+ @$(DISASM) -D -S $(_BIN) > $(_OBJPREFIX)$(BIN).dsm
$(_OBJPREFIX)%.o: %.c
@echo [CC] -o $@
svc #0x1001
mov pc, lr
+
+@ >r0: PC
+@ >r1: Pointer to item count
+@ <r0: Address
+@ STUBBED
+__gnu_Unwind_Find_exidx:
+ mov r0, #0
+ str r0, [r1]
+ mov pc, lr
+
.section .data
.globl _errno
_errno: .long 0 @ Placed in .text, to allow use of relative addressing
// - Will be reversed at the end of the function
for( i = 0; i < iSegmentCount; i ++ )
{
- if(phtab[i].Type == PT_LOAD && phtab[i].Flags & PF_R ) {
+ if(phtab[i].Type == PT_LOAD && !(phtab[i].Flags & PF_W) ) {
uintptr_t addr = phtab[i].VAddr + iBaseDiff;
uintptr_t end = addr + phtab[i].MemSize;
for( ; addr < end; addr += PAGE_SIZE )
// Re-set readonly
for( i = 0; i < iSegmentCount; i ++ )
{
- if(phtab[i].Type == PT_LOAD && phtab[i].Flags & PF_R ) {
+ // If load and not writable
+ if(phtab[i].Type == PT_LOAD && !(phtab[i].Flags & PF_W) ) {
uintptr_t addr = phtab[i].VAddr + iBaseDiff;
uintptr_t end = addr + phtab[i].MemSize;
for( ; addr < end; addr += PAGE_SIZE )
}
// Relocation function
+ auto int _Elf64DoReloc(Elf64_Xword r_info, void *ptr, Elf64_Sxword addend);
int _Elf64DoReloc(Elf64_Xword r_info, void *ptr, Elf64_Sxword addend)
{
int sym = ELF64_R_SYM(r_info);
int type = ELF64_R_TYPE(r_info);
const char *symname = strtab + symtab[sym].st_name;
void *symval;
+ //DEBUGS("_Elf64DoReloc: %s", symname);
switch( type )
{
case R_X86_64_NONE:
SysDebug("ld-acess - _Elf64DoReloc: Unknown relocation type %i", type);
return 2;
}
+ //DEBUGS("_Elf64DoReloc: - Good");
return 0;
}
extern uint32_t __udivsi3(uint32_t Num, uint32_t Den);
extern uint32_t __umodsi3(uint32_t Num, uint32_t Den);
-
#define _STR(x) #x
#define STR(x) _STR(x)
#define EXP(sym) {&sym, STR(sym)}
#define __ASSEMBLER__
#include "arch/syscalls.s.h"
#undef __ASSEMBLER__
+
+ #ifdef ARCHDIR_is_armv7
+ {0, "__gnu_Unwind_Find_exidx"},
+ {0, "__cxa_call_unexpected"},
+ {0, "__cxa_type_match"},
+ {0, "__cxa_begin_cleanup"},
+ #endif
#if 0
EXP(__umoddi3),
EXP(__udivdi3),
INCFILES := stdio.h stdlib.h\r
\r
OBJ = stub.o heap.o stdlib.o env.o fileIO.o string.o select.o rand.o\r
-OBJ += perror.o scanf.o\r
+OBJ += perror.o scanf.o signals.o\r
OBJ += arch/$(ARCHDIR).ao\r
# signals.o\r
DEPFILES := $(OBJ:%.o=%.d)\r
#ifndef _SIGNAL_H_
#define _SIGNAL_H_
+typedef void (*sighandler_t)(int);
+
#define SIG_DFL ((void*)0)
#define SIG_ERR ((void*)-1)
#define SIGPIPE 1001
#define SIGCHLD 1002
+extern int raise(int sig);
+
#endif
extern long strtol(const char *ptr, char **end, int base);\r
extern int atoi(const char *ptr);\r
extern void exit(int status) __attribute__((noreturn));\r
+extern void abort(void);\r
extern void atexit(void (*__func)(void));\r
extern void qsort(void *base, size_t nmemb, size_t size, int(*compar)(const void *, const void *));\r
extern int abs(int j);\r
* AcessOS Basic C Library
* signals.c
*/
-#include <syscalls.h>
+//#include <acess/sys.h>
#include <stdlib.h>
#include <signal.h>
#include "lib.h"
sighandlers[num] = handler;
return prev;
}
+
+int raise(int signal)
+{
+ if( signal < 0 || signal > NUM_SIGNALS )
+ return 1;
+ switch(signal)
+ {
+ case SIGABRT:
+ abort();
+ break;
+ }
+ return 0;
+}
+
+void abort(void)
+{
+ // raise(SIGABRT);
+ _exit(-1);
+}