|
From: <and...@us...> - 2010-07-31 19:31:21
|
Revision: 2006
http://edk2-buildtools.svn.sourceforge.net/edk2-buildtools/?rev=2006&view=rev
Author: andrewfish
Date: 2010-07-31 19:31:14 +0000 (Sat, 31 Jul 2010)
Log Message:
-----------
Update GwnFw to skip all known ARM PC relative relocations. PC rel relocation are really only needed for object files. This way GenFw will only fail if it hits a relocation that needs a mapping in PE/COFF.
Modified Paths:
--------------
trunk/BaseTools/Source/C/GenFw/Elf32Convert.c
trunk/BaseTools/Source/C/GenFw/elf_common.h
Modified: trunk/BaseTools/Source/C/GenFw/Elf32Convert.c
===================================================================
--- trunk/BaseTools/Source/C/GenFw/Elf32Convert.c 2010-07-31 14:07:54 UTC (rev 2005)
+++ trunk/BaseTools/Source/C/GenFw/Elf32Convert.c 2010-07-31 19:31:14 UTC (rev 2006)
@@ -632,6 +632,7 @@
switch (ELF32_R_TYPE(Rel->r_info)) {
case R_ARM_RBASE:
// No relocation - no action required
+ // break skipped
case R_ARM_PC24:
case R_ARM_XPC25:
@@ -639,6 +640,35 @@
case R_ARM_THM_JUMP19:
case R_ARM_CALL:
case R_ARM_JMP24:
+ case R_ARM_THM_JUMP24:
+ case R_ARM_PREL31:
+ case R_ARM_MOVW_PREL_NC:
+ case R_ARM_MOVT_PREL:
+ case R_ARM_THM_MOVW_PREL_NC:
+ case R_ARM_THM_MOVT_PREL:
+ case R_ARM_THM_JMP6:
+ case R_ARM_THM_ALU_PREL_11_0:
+ case R_ARM_THM_PC12:
+ case R_ARM_REL32_NOI:
+ case R_ARM_ALU_PC_G0_NC:
+ case R_ARM_ALU_PC_G0:
+ case R_ARM_ALU_PC_G1_NC:
+ case R_ARM_ALU_PC_G1:
+ case R_ARM_ALU_PC_G2:
+ case R_ARM_LDR_PC_G1:
+ case R_ARM_LDR_PC_G2:
+ case R_ARM_LDRS_PC_G0:
+ case R_ARM_LDRS_PC_G1:
+ case R_ARM_LDRS_PC_G2:
+ case R_ARM_LDC_PC_G0:
+ case R_ARM_LDC_PC_G1:
+ case R_ARM_LDC_PC_G2:
+ case R_ARM_GOT_PREL:
+ case R_ARM_THM_JUMP11:
+ case R_ARM_THM_JUMP8:
+ case R_ARM_TLS_GD32:
+ case R_ARM_TLS_LDM32:
+ case R_ARM_TLS_IE32:
// Thease are all PC-relative relocations and don't require modification
// GCC does not seem to have the concept of a application that just needs to get relocated.
break;
@@ -736,14 +766,45 @@
}
} else if (mEhdr->e_machine == EM_ARM) {
switch (ELF32_R_TYPE(Rel->r_info)) {
- case R_ARM_RBASE:
+ case R_ARM_RBASE:
// No relocation - no action required
+ // break skipped
+
case R_ARM_PC24:
case R_ARM_XPC25:
case R_ARM_THM_PC22:
case R_ARM_THM_JUMP19:
case R_ARM_CALL:
case R_ARM_JMP24:
+ case R_ARM_THM_JUMP24:
+ case R_ARM_PREL31:
+ case R_ARM_MOVW_PREL_NC:
+ case R_ARM_MOVT_PREL:
+ case R_ARM_THM_MOVW_PREL_NC:
+ case R_ARM_THM_MOVT_PREL:
+ case R_ARM_THM_JMP6:
+ case R_ARM_THM_ALU_PREL_11_0:
+ case R_ARM_THM_PC12:
+ case R_ARM_REL32_NOI:
+ case R_ARM_ALU_PC_G0_NC:
+ case R_ARM_ALU_PC_G0:
+ case R_ARM_ALU_PC_G1_NC:
+ case R_ARM_ALU_PC_G1:
+ case R_ARM_ALU_PC_G2:
+ case R_ARM_LDR_PC_G1:
+ case R_ARM_LDR_PC_G2:
+ case R_ARM_LDRS_PC_G0:
+ case R_ARM_LDRS_PC_G1:
+ case R_ARM_LDRS_PC_G2:
+ case R_ARM_LDC_PC_G0:
+ case R_ARM_LDC_PC_G1:
+ case R_ARM_LDC_PC_G2:
+ case R_ARM_GOT_PREL:
+ case R_ARM_THM_JUMP11:
+ case R_ARM_THM_JUMP8:
+ case R_ARM_TLS_GD32:
+ case R_ARM_TLS_LDM32:
+ case R_ARM_TLS_IE32:
// Thease are all PC-relative relocations and don't require modification
break;
Modified: trunk/BaseTools/Source/C/GenFw/elf_common.h
===================================================================
--- trunk/BaseTools/Source/C/GenFw/elf_common.h 2010-07-31 14:07:54 UTC (rev 2005)
+++ trunk/BaseTools/Source/C/GenFw/elf_common.h 2010-07-31 19:31:14 UTC (rev 2006)
@@ -602,6 +602,38 @@
#define R_ARM_THM_MOVW_ABS_NC 47
#define R_ARM_THM_MOVT_ABS 48
+// Block of PC-relative relocations added to work around gcc putting
+// object relocations in static executables.
+#define R_ARM_THM_JUMP24 30
+#define R_ARM_PREL31 42
+#define R_ARM_MOVW_PREL_NC 45
+#define R_ARM_MOVT_PREL 46
+#define R_ARM_THM_MOVW_PREL_NC 49
+#define R_ARM_THM_MOVT_PREL 50
+#define R_ARM_THM_JMP6 52
+#define R_ARM_THM_ALU_PREL_11_0 53
+#define R_ARM_THM_PC12 54
+#define R_ARM_REL32_NOI 56
+#define R_ARM_ALU_PC_G0_NC 57
+#define R_ARM_ALU_PC_G0 58
+#define R_ARM_ALU_PC_G1_NC 59
+#define R_ARM_ALU_PC_G1 60
+#define R_ARM_ALU_PC_G2 61
+#define R_ARM_LDR_PC_G1 62
+#define R_ARM_LDR_PC_G2 63
+#define R_ARM_LDRS_PC_G0 64
+#define R_ARM_LDRS_PC_G1 65
+#define R_ARM_LDRS_PC_G2 66
+#define R_ARM_LDC_PC_G0 67
+#define R_ARM_LDC_PC_G1 68
+#define R_ARM_LDC_PC_G2 69
+#define R_ARM_GOT_PREL 96
+#define R_ARM_THM_JUMP11 102
+#define R_ARM_THM_JUMP8 103
+#define R_ARM_TLS_GD32 104
+#define R_ARM_TLS_LDM32 105
+#define R_ARM_TLS_IE32 107
+
#define R_ARM_THM_JUMP19 51
#define R_ARM_GNU_VTENTRY 100
#define R_ARM_GNU_VTINHERIT 101
@@ -612,6 +644,8 @@
#define R_ARM_RPC24 254
#define R_ARM_RBASE 255
+
+
/* Name Value Field Calculation */
#define R_IA_64_NONE 0 /* None */
#define R_IA_64_IMM14 0x21 /* immediate14 S + A */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|