diff --git a/src/bin/ld/addlibrary.c b/src/bin/ld/addlibrary.c index b75f814..71eec3b 100644 --- a/src/bin/ld/addlibrary.c +++ b/src/bin/ld/addlibrary.c @@ -48,14 +48,22 @@ for (i=0;ilinkerHeader->ePhnum;i++) { switch (tmpLib->linkerProgramHeader[i].phType) { - case 1: - case 2: + case PT_LOAD: + case PT_DYNAMIC: newLoc = (char *)tmpLib->linkerProgramHeader[i].phVaddr + (uInt32)tmpLib->output; fseek(linkerFd,tmpLib->linkerProgramHeader[i].phOffset,0); fread(newLoc,tmpLib->linkerProgramHeader[i].phFilesz,1,linkerFd); break; + case PT_GNU_STACK: + /* Tells us if the stack should be executable. Failsafe to + executable until we add checking */ + break; + case PT_PAX_FLAGS: + /* Not sure... */ + break; default: - printf("Unhandled Header\n"); + printf("Unhandled Header : %08x\n", + tmpLib->linkerProgramHeader[i].phType); break; } } diff --git a/src/bin/ld/elf.h b/src/bin/ld/elf.h index 0d2c17b..919bf80 100644 --- a/src/bin/ld/elf.h +++ b/src/bin/ld/elf.h @@ -72,6 +72,18 @@ #define PT_NULL 0 #define PT_LOAD 1 #define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_LOOS 0x60000000 +#define PT_HIOS 0x6fffffff +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff +#define PT_GNU_EH_FRAME 0x6474e550 +#define PT_GNU_STACK (PT_LOOS + 0x474e551) +#define PT_GNU_RELRO (PT_LOOS + 0x474e552) +#define PT_PAX_FLAGS (PT_LOOS + 0x5041580) /* End Elf Program Header Types */ typedef struct { diff --git a/src/sys/include/ubixos/elf.h b/src/sys/include/ubixos/elf.h index b24becb..b4a7299 100644 --- a/src/sys/include/ubixos/elf.h +++ b/src/sys/include/ubixos/elf.h @@ -78,6 +78,19 @@ #define PT_NULL 0 #define PT_LOAD 1 #define PT_DYNAMIC 2 +#define PT_INTERP 3 +#define PT_NOTE 4 +#define PT_SHLIB 5 +#define PT_PHDR 6 +#define PT_LOOS 0x60000000 +#define PT_HIOS 0x6fffffff +#define PT_LOPROC 0x70000000 +#define PT_HIPROC 0x7fffffff +#define PT_GNU_EH_FRAME 0x6474e550 +#define PT_GNU_STACK (PT_LOOS + 0x474e551) +#define PT_GNU_RELRO (PT_LOOS + 0x474e552) +#define PT_PAX_FLAGS (PT_LOOS + 0x5041580) + /* End Elf Program Header Types */ typedef struct { @@ -150,6 +163,9 @@ /*** $Log$ + Revision 1.6 2004/06/16 14:04:51 reddawg + Renamed a typedef + Revision 1.5 2004/06/14 12:20:54 reddawg notes: many bugs repaired and ld works 100% now. diff --git a/src/sys/kernel/ld.c b/src/sys/kernel/ld.c index c8e898c..156429b 100644 --- a/src/sys/kernel/ld.c +++ b/src/sys/kernel/ld.c @@ -82,8 +82,8 @@ for (i=0;iePhnum;i++) { switch (programHeader[i].phType) { - case 1: - case 2: + case PT_LOAD: + case PT_DYNAMIC: newLoc = (char *)programHeader[i].phVaddr + LD_START; /* Allocate Memory Im Going To Have To Make This Load Memory With Correct @@ -99,8 +99,15 @@ fseek(ldFd,programHeader[i].phOffset,0x0); fread(newLoc,programHeader[i].phFilesz,1,ldFd); break; + case PT_GNU_STACK: + /* Tells us if the stack should be executable. Failsafe to executable + until we add checking */ + break; + case PT_PAX_FLAGS: + /* Not sure... */ + break; default: - kprintf("Unhandled Header : %d\n", programHeader[i].phType); + kprintf("Unhandled Header : %08x\n", programHeader[i].phType); break; } } @@ -164,6 +171,9 @@ /*** $Log$ + Revision 1.34 2004/09/07 22:00:20 apwillia + Fix gcc 2.95 being retarded and not follwing the C99 specs + Revision 1.33 2004/07/28 15:05:43 reddawg Major: Pages now have strict security enforcement.