diff --git a/reactos/tools/ppc-build/alink/alink.h b/reactos/tools/ppc-build/alink/alink.h index 86f032ab8da..f18dc00a1e3 100644 --- a/reactos/tools/ppc-build/alink/alink.h +++ b/reactos/tools/ppc-build/alink/alink.h @@ -375,6 +375,7 @@ typedef enum segframe_t { #define R_PPC_ADDR16_HI 5 #define R_PPC_ADDR16_HA 6 #define R_PPC_REL24 10 +#define R_PPC_PLTREL24 18 #define R_PPC_UADDR32 24 #define R_PPC_REL32 26 #define R_PPC_SECTOFF 33 @@ -397,6 +398,11 @@ typedef enum segframe_t { #define IMAGE_REL_PPC_SECRELLO 0x13 #define IMAGE_REL_PPC_SECRELHI 0x14 #define IMAGE_REL_PPC_GPREL 0x15 +#define IMAGE_REL_BASED_ABSOLUTE 0 +#define IMAGE_REL_BASED_HIGH 1 +#define IMAGE_REL_BASED_LOW 2 +#define IMAGE_REL_BASED_HIGHLOW 3 +#define IMAGE_REL_BASED_HIGHADJ 4 #define OUTPUT_COM 1 #define OUTPUT_EXE 2 diff --git a/reactos/tools/ppc-build/alink/elf.cpp b/reactos/tools/ppc-build/alink/elf.cpp index 3537ca59bf4..4c47b4f9cd4 100755 --- a/reactos/tools/ppc-build/alink/elf.cpp +++ b/reactos/tools/ppc-build/alink/elf.cpp @@ -306,12 +306,22 @@ void loadelf(FILE *objfile) elf32sym.st_name); #if 0 + const char *segname = + elf32sym.st_shndx & 0x8000 ? + "*SPC*" : + (char *) + (&stringList[0] + + stringListOffsets[elf32hdr.e_shtrndx] + + elf32shdr[elf32sym.st_shndx].sh_name); + fprintf(stderr, "S[%05x] value %08x size %08x info %08x " - "other %08x shndx %08x %s\n", + "other %08x shndx %08x (%-10s) %s\n", j, elf32sym.st_value, elf32sym.st_size, elf32sym.st_info, - elf32sym.st_other, elf32sym.st_shndx, sym[j].name.c_str()); + elf32sym.st_other, elf32sym.st_shndx, + segname, + sym[j].name.c_str()); #endif if(!case_sensitive) @@ -608,6 +618,7 @@ void loadelf(FILE *objfile) reloc->rtype = FIX_PPC_ADDR24; break; + case R_PPC_PLTREL24: case R_PPC_REL24: reloc->rtype = FIX_PPC_REL24; break; diff --git a/reactos/tools/ppc-build/alink/output.cpp b/reactos/tools/ppc-build/alink/output.cpp index 262fbb810ee..fac9fc16a29 100644 --- a/reactos/tools/ppc-build/alink/output.cpp +++ b/reactos/tools/ppc-build/alink/output.cpp @@ -1216,6 +1216,9 @@ void BuildPERelocs(long relocSectNum,PUCHAR objectTable) case FIX_SELF_OFS16_2: case FIX_SELF_LBYTE: case FIX_RVA32: + case FIX_REL32: + case FIX_PPC_REL24: + case FIX_PPC_SECTOFF: continue; /* self-relative fixups and RVA fixups don't relocate */ default: break; @@ -1260,8 +1263,20 @@ void BuildPERelocs(long relocSectNum,PUCHAR objectTable) break; case FIX_PTR1632: case FIX_OFS32: - case FIX_OFS32_2: + case FIX_OFS32_2: j|= PE_REL_OFS32; + + case FIX_ADDR32: + j = (IMAGE_REL_BASED_HIGHLOW << 12) | (j & 0xfff); + break; + + case FIX_PPC_RVA16LO: + j = (IMAGE_REL_BASED_LOW << 12) | (j & 0xfff); + break; + + case FIX_PPC_RVA16HA: + j = (IMAGE_REL_BASED_HIGHADJ << 12) | (j & 0xfff); + break; } /* store relocation */ put16(relocSect->data, relocSect->length, j); @@ -2382,6 +2397,7 @@ void OutputWin32file(const std::string &outname) for(i=0;igetbase(), outlist[i]->name.c_str()); if(outlist[i] && ((outlist[i]->attr&SEG_ALIGN) !=SEG_ABS)) { /* ensure section is aligned to file-Align */