Okay, no knowing WHERE the segfault was coming from was definitly hindering me (kept trying to modify _start & main bytes) so I removed all but the essential syscall from _start() and still got a segfault, tried adding in a .text segment and still got the error, I've removed the old upload and here is a new upload, got gospel soon so just gonna hope someone can pin point where I'm going wrong there. By the way readelf is for some reason saying the segment size reported is less than the size it thinks they are, if you can figure out why that is despite me using sizeof(elsh64_t) then please be my gest, here's the typedef along with the enum I used:
Code:
enum {
ELSH_SHT_NULL = 0,
ELSH_SHT_PROGBITS,
ELSH_SHT_SYMTAB,
ELSH_SHT_STRTAB,
ELSH_SHT_RELA,
ELSH_SHT_HASH, // Used this one, haven'y found the note that states which one to use just yet
ELSH_SHT_DYNAMIC,
ELSH_SHT_NOTE,
ELSH_SHT_NOBITS,
ELSH_SHT_SHLIB,
ELSH_SHT_DYNSYM,
ELSH_SHT_INIT_ARRAY = 0xE,
ELSH_SHT_FINI_ARRAY,
ELSH_SHT_PREINIT_ARRAY,
ELSH_SHT_GROUP,
ELSH_SHT_SYMTAB_SHNDX,
ELSH_SHT_NUM,
ELSH_SHT_LOOS = 0x60000000,
ELSH_SHT_HIOS = 0x6FFFFFFF,
ELSH_SHT_LOPROC = 0x70000000,
ELSH_SHT_HIPROC = 0x7FFFFFFF
};
typedef struct __attribute__((packed)) {
d32 sh_name; // stored directly before the entrypoint after both the program header/s and segment header/s
u32 sh_type;
u64 sh_flags;
u64 sh_addr;
d64 sh_offset;
u32 sh_link;
u32 sh_info;
u64 sh_adralign;
u64 sh_entsize;
} elsh64_t;