15460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//===- X86RelocationFunction.h --------------------------------------------===// 25460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// 35460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// The MCLinker Project 45460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// 55460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// This file is distributed under the University of Illinois Open Source 65460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// License. See LICENSE.TXT for details. 75460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao// 85460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao//===----------------------------------------------------------------------===// 937b74a387bb3993387029859c2d9d051c41c724eStephen Hines#ifndef TARGET_X86_X86RELOCATIONFUNCTIONS_H_ 1037b74a387bb3993387029859c2d9d051c41c724eStephen Hines#define TARGET_X86_X86RELOCATIONFUNCTIONS_H_ 115460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 1237b74a387bb3993387029859c2d9d051c41c724eStephen Hines#define DECL_X86_32_APPLY_RELOC_FUNC(Name) \ 1337b74a387bb3993387029859c2d9d051c41c724eStephen Hines static X86Relocator::Result Name(Relocation& pEntry, \ 1437b74a387bb3993387029859c2d9d051c41c724eStephen Hines X86_32Relocator& pParent); 155460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 1637b74a387bb3993387029859c2d9d051c41c724eStephen Hines#define DECL_X86_32_APPLY_RELOC_FUNCS \ 1737b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(none) \ 1837b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(abs) \ 1937b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(rel) \ 2037b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(plt32) \ 2137b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(got32) \ 2237b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(gotoff32) \ 2337b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(gotpc32) \ 2437b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(tls_gd) \ 2537b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(tls_ie) \ 2637b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(tls_gotie) \ 2737b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(tls_le) \ 2837b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(tls_ldm) \ 2937b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(tls_ldo_32) \ 3037b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_32_APPLY_RELOC_FUNC(unsupported) 315460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 3237b74a387bb3993387029859c2d9d051c41c724eStephen Hines#define DECL_X86_32_APPLY_RELOC_FUNC_PTRS \ 3337b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 0, "R_386_NONE", 0 }, \ 3437b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &abs, 1, "R_386_32", 32 }, \ 3537b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &rel, 2, "R_386_PC32", 32 }, \ 3637b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &got32, 3, "R_386_GOT32", 32 }, \ 3737b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &plt32, 4, "R_386_PLT32", 32 }, \ 3837b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 5, "R_386_COPY", 0 }, \ 3937b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 6, "R_386_GLOB_DAT", 0 }, \ 4037b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 7, "R_386_JMP_SLOT", 0 }, \ 4137b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 8, "R_386_RELATIVE", 0 }, \ 4237b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &gotoff32, 9, "R_386_GOTOFF", 32 }, \ 4337b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &gotpc32, 10, "R_386_GOTPC", 32 }, \ 4437b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 11, "R_386_32PLT", 0 }, \ 4537b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 12, "", 0 }, \ 4637b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 13, "", 0 }, \ 4737b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 14, "R_386_TLS_TPOFF", 0 }, \ 4837b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &tls_ie, 15, "R_386_TLS_IE", 32 }, \ 4937b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &tls_gotie, 16, "R_386_TLS_GOTIE", 32 }, \ 5037b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &tls_le, 17, "R_386_TLS_LE", 32 }, \ 5137b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &tls_gd, 18, "R_386_TLS_GD", 32 }, \ 5237b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &tls_ldm, 19, "R_386_TLS_LDM", 32 }, \ 5337b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &abs, 20, "R_386_16", 16 }, \ 5437b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &rel, 21, "R_386_PC16", 16 }, \ 5537b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &abs, 22, "R_386_8", 8 }, \ 5637b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &rel, 23, "R_386_PC8", 8 }, \ 5737b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 24, "R_386_TLS_GD_32", 0 }, \ 5837b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 25, "R_386_TLS_GD_PUSH", 0 }, \ 5937b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 26, "R_386_TLS_GD_CALL", 0 }, \ 6037b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 27, "R_386_TLS_GD_POP", 0 }, \ 6137b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 28, "R_386_TLS_LDM_32", 0 }, \ 6237b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 29, "R_386_TLS_LDM_PUSH", 0 }, \ 6337b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 30, "R_386_TLS_LDM_CALL", 0 }, \ 6437b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 31, "R_386_TLS_LDM_POP", 0 }, \ 6537b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &tls_ldo_32, 32, "R_386_TLS_LDO_32", 32 }, \ 6637b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 33, "R_386_TLS_IE_32", 0 }, \ 6737b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 34, "R_386_TLS_LE_32", 0 }, \ 6837b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 35, "R_386_TLS_DTPMOD32", 0 }, \ 6937b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 36, "R_386_TLS_DTPOFF32", 0 }, \ 7037b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 37, "R_386_TLS_TPOFF32", 0 }, \ 7137b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 38, "", 0 }, \ 7237b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 39, "R_386_TLS_GOTDESC", 0 }, \ 7337b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 40, "R_386_TLS_DESC_CALL", 0 }, \ 7437b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 41, "R_386_TLS_DESC", 0 }, \ 7537b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 42, "R_386_IRELATIVE", 0 }, \ 7637b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 43, "R_386_NUM", 0 }, \ 7737b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 44, "R_386_TLS_OPT", 32 } 785460a1f25d9ddecb5c70667267d66d51af177a99Shih-wei Liao 7937b74a387bb3993387029859c2d9d051c41c724eStephen Hines#define DECL_X86_64_APPLY_RELOC_FUNC(Name) \ 8037b74a387bb3993387029859c2d9d051c41c724eStephen Hines static X86Relocator::Result Name(Relocation& pEntry, \ 8137b74a387bb3993387029859c2d9d051c41c724eStephen Hines X86_64Relocator& pParent); 826f75755c9204b1d8817ae5a65a2f7e5af0ec3f70Stephen Hines 8337b74a387bb3993387029859c2d9d051c41c724eStephen Hines#define DECL_X86_64_APPLY_RELOC_FUNCS \ 8437b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_64_APPLY_RELOC_FUNC(none) \ 8537b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_64_APPLY_RELOC_FUNC(abs) \ 8637b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_64_APPLY_RELOC_FUNC(signed32) \ 8737b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_64_APPLY_RELOC_FUNC(gotpcrel) \ 8837b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_64_APPLY_RELOC_FUNC(plt32) \ 8937b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_64_APPLY_RELOC_FUNC(rel) \ 9037b74a387bb3993387029859c2d9d051c41c724eStephen Hines DECL_X86_64_APPLY_RELOC_FUNC(unsupported) 916f75755c9204b1d8817ae5a65a2f7e5af0ec3f70Stephen Hines 9237b74a387bb3993387029859c2d9d051c41c724eStephen Hines#define DECL_X86_64_APPLY_RELOC_FUNC_PTRS \ 9337b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 0, "R_X86_64_NONE", 0 }, \ 9437b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &abs, 1, "R_X86_64_64", 64 }, \ 9537b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &rel, 2, "R_X86_64_PC32", 32 }, \ 9637b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 3, "R_X86_64_GOT32", 32 }, \ 9737b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &plt32, 4, "R_X86_64_PLT32", 32 }, \ 9837b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 5, "R_X86_64_COPY", 0 }, \ 9937b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 6, "R_X86_64_GLOB_DAT", 0 }, \ 10037b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 7, "R_X86_64_JMP_SLOT", 0 }, \ 10137b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 8, "R_X86_64_RELATIVE", 0 }, \ 10237b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &gotpcrel, 9, "R_X86_64_GOTPCREL", 32 }, \ 10337b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &abs, 10, "R_X86_64_32", 32 }, \ 10437b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &signed32, 11, "R_X86_64_32S", 32 }, \ 10537b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &abs, 12, "R_X86_64_16", 16 }, \ 10637b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &rel, 13, "R_X86_64_PC16", 16 }, \ 10737b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &abs, 14, "R_X86_64_8", 8 }, \ 10837b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &rel, 15, "R_X86_64_PC8", 8 }, \ 10937b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 16, "R_X86_64_DTPMOD64", 0 }, \ 11037b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 17, "R_X86_64_DTPOFF64", 0 }, \ 11137b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 18, "R_X86_64_TPOFF64", 0 }, \ 11237b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 19, "R_X86_64_TLSGD", 0 }, \ 11337b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 20, "R_X86_64_TLSLD", 0 }, \ 11437b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 21, "R_X86_64_DTPOFF32", 0 }, \ 11537b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 22, "R_X86_64_GOTTPOFF", 0 }, \ 11637b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 23, "R_X86_64_TPOFF32", 0 }, \ 11737b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 24, "R_X86_64_PC64", 64 }, \ 11837b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 25, "R_X86_64_GOTOFF64", 64 }, \ 11937b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 26, "R_X86_64_GOTPC32", 32 }, \ 12037b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 27, "R_X86_64_GOT64", 64 }, \ 12137b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 28, "R_X86_64_GOTPCREL64", 64 }, \ 12237b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 29, "R_X86_64_GOTPC64", 64 }, \ 12337b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 30, "R_X86_64_GOTPLT64", 64 }, \ 12437b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 31, "R_X86_64_PLTOFF64", 64 }, \ 12537b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 32, "R_X86_64_SIZE32", 32 }, \ 12637b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 33, "R_X86_64_SIZE64", 64 }, \ 12737b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 34, "R_X86_64_GOTPC32_TLSDESC", 0 }, \ 12837b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &unsupported, 35, "R_X86_64_TLSDESC_CALL", 0 }, \ 12937b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 36, "R_X86_64_TLSDESC", 0 }, \ 13037b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 37, "R_X86_64_IRELATIVE", 0 }, \ 13137b74a387bb3993387029859c2d9d051c41c724eStephen Hines { &none, 38, "R_X86_64_RELATIVE64", 0 } 1326f75755c9204b1d8817ae5a65a2f7e5af0ec3f70Stephen Hines 13337b74a387bb3993387029859c2d9d051c41c724eStephen Hines#endif // TARGET_X86_X86RELOCATIONFUNCTIONS_H_ 134