From 2b933aacc1673ae153363f923bdf9097312e550f Mon Sep 17 00:00:00 2001 From: Peter Jones Date: Fri, 13 Feb 2009 21:19:50 +0000 Subject: [PATCH] - Pad sections out in the provided linker scripts to make sure they all of some content. --- gnu-efi-3.0d-callwrap.patch | 518 ++++++++++++++++++++++++++++ gnu-efi-3.0d-relocfmt.patch | 173 ++++++++++ gnu-efi-3.0d-section-attribs.patch | 12 + gnu-efi-3.0d-setjmp.patch | 170 +++++++++ gnu-efi-3.0e-pad-all-sections.patch | 243 +++++++++++++ gnu-efi.spec | 16 +- 6 files changed, 1127 insertions(+), 5 deletions(-) create mode 100644 gnu-efi-3.0d-callwrap.patch create mode 100644 gnu-efi-3.0d-relocfmt.patch create mode 100644 gnu-efi-3.0d-section-attribs.patch create mode 100644 gnu-efi-3.0d-setjmp.patch create mode 100644 gnu-efi-3.0e-pad-all-sections.patch diff --git a/gnu-efi-3.0d-callwrap.patch b/gnu-efi-3.0d-callwrap.patch new file mode 100644 index 0000000..066f94e --- /dev/null +++ b/gnu-efi-3.0d-callwrap.patch @@ -0,0 +1,518 @@ +diff -urpN /dev/null gnu-efi-3.0d/gnuefi/callwrap_ia32.c +--- /dev/null 2008-04-24 00:20:49.271011245 -0400 ++++ gnu-efi-3.0d/gnuefi/callwrap_ia32.c 2008-04-29 15:40:43.000000000 -0400 +@@ -0,0 +1,103 @@ ++ ++typedef unsigned long EFI_STATUS; ++ ++typedef EFI_STATUS (*func0)(void); ++typedef EFI_STATUS (*func1)(unsigned long); ++typedef EFI_STATUS (*func2)(unsigned long, unsigned long); ++typedef EFI_STATUS (*func3)(unsigned long, unsigned long, unsigned long); ++typedef EFI_STATUS (*func4)(unsigned long, unsigned long, unsigned long, ++ unsigned long); ++typedef EFI_STATUS (*func5)(unsigned long, unsigned long, unsigned long, ++ unsigned long, unsigned long); ++typedef EFI_STATUS (*func6)(unsigned long, unsigned long, unsigned long, ++ unsigned long, unsigned long, unsigned long); ++typedef EFI_STATUS (*func7)(unsigned long, unsigned long, unsigned long, ++ unsigned long, unsigned long, unsigned long, ++ unsigned long); ++typedef EFI_STATUS (*func8)(unsigned long, unsigned long, unsigned long, ++ unsigned long, unsigned long, unsigned long, ++ unsigned long, unsigned long); ++typedef EFI_STATUS (*func9)(unsigned long, unsigned long, unsigned long, ++ unsigned long, unsigned long, unsigned long, ++ unsigned long, unsigned long, unsigned long); ++typedef EFI_STATUS (*func10)(unsigned long, unsigned long, unsigned long, ++ unsigned long, unsigned long, unsigned long, ++ unsigned long, unsigned long, unsigned long, ++ unsigned long); ++ ++EFI_STATUS gnuefi_call0 (unsigned long func) ++{ ++ return ((func0)func)(); ++} ++ ++EFI_STATUS gnuefi_call1 (unsigned long func, unsigned long a) ++{ ++ return ((func1)func)(a); ++} ++ ++EFI_STATUS gnuefi_call2 (unsigned long func, unsigned long a, unsigned long b) ++{ ++ return ((func2)func)(a, b); ++} ++ ++EFI_STATUS gnuefi_call3 (unsigned long func, unsigned long a, ++ unsigned long b, unsigned long c) ++{ ++ return ((func3)func)(a, b, c); ++} ++ ++EFI_STATUS gnuefi_call4 (unsigned long func, unsigned long a, ++ unsigned long b, unsigned long c, unsigned long d) ++{ ++ return ((func4)func)(a, b, c, d); ++} ++ ++EFI_STATUS gnuefi_call5 (unsigned long func, unsigned long a, ++ unsigned long b, unsigned long c, ++ unsigned long d, unsigned long e) ++{ ++ return ((func5)func)(a, b, c, d, e); ++} ++ ++EFI_STATUS gnuefi_call6 (unsigned long func, unsigned long a, ++ unsigned long b, unsigned long c, ++ unsigned long d, unsigned long e, unsigned long f) ++{ ++ return ((func6)func)(a, b, c, d, e, f); ++} ++ ++EFI_STATUS gnuefi_call7 (unsigned long func, unsigned long a, ++ unsigned long b, unsigned long c, ++ unsigned long d, unsigned long e, ++ unsigned long f, unsigned long g) ++{ ++ return ((func7)func)(a, b, c, d, e, f, g); ++} ++ ++EFI_STATUS gnuefi_call8 (unsigned long func, unsigned long a, ++ unsigned long b, unsigned long c, ++ unsigned long d, unsigned long e, ++ unsigned long f, unsigned long g, ++ unsigned long h) ++{ ++ return ((func8)func)(a, b, c, d, e, f, g, h); ++} ++ ++EFI_STATUS gnuefi_call9 (unsigned long func, unsigned long a, ++ unsigned long b, unsigned long c, ++ unsigned long d, unsigned long e, ++ unsigned long f, unsigned long g, ++ unsigned long h, unsigned long i) ++{ ++ return ((func9)func)(a, b, c, d, e, f, g, h, i); ++} ++ ++EFI_STATUS gnuefi_call10(unsigned long func, unsigned long a, ++ unsigned long b, unsigned long c, ++ unsigned long d, unsigned long e, ++ unsigned long f, unsigned long g, ++ unsigned long h, unsigned long i, ++ unsigned long j) ++{ ++ return ((func10)func)(a, b, c, d, e, f, g, h, i, j); ++} +diff -urpN /dev/null gnu-efi-3.0d/gnuefi/callwrap_x86_64.c +--- /dev/null 2008-04-24 00:20:49.271011245 -0400 ++++ gnu-efi-3.0d/gnuefi/callwrap_x86_64.c 2008-04-29 15:40:07.000000000 -0400 +@@ -0,0 +1,395 @@ ++/* ++ * Copyright (C) 2006 Giridhar Pemmasani ++ * Copyright (C) 2007-2010 Intel Corp ++ * Contributed by Chandramouli Narayanan ++ * Adapted wrapper macros for Linux to windows calls from ++ * NDIS wrapper project (http:/ndiswrapper.sourceforge.net) ++ * ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ */ ++ ++#define alloc_win_stack_frame(argc) \ ++ "subq $" #argc "*8, %%rsp\n\t" ++#define free_win_stack_frame(argc) \ ++ "addq $" #argc "*8, %%rsp\n\t" ++ ++/* m is index of Windows arg required, n is total number of args to ++ * function Windows arg 1 should be at 0(%rsp), arg 2 at 8(%rsp) and ++ * so on, after stack frame is allocated, which starts at -n*8(%rsp) ++ * when stack frame is allocated. 4 > m >= n. ++*/ ++ ++#define lin2win_win_arg(m,n) "(" #m "-1-" #n ")*8(%%rsp)" ++ ++/* volatile args for Windows function must be in clobber / output list */ ++extern unsigned long long gnuefi_call0(void *func); ++extern unsigned long long gnuefi_call1(void *func, unsigned long long arg1); ++extern unsigned long long gnuefi_call2(void *func, unsigned long long arg1, unsigned long long arg2); ++extern unsigned long long gnuefi_call3( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3); ++extern unsigned long long gnuefi_call4( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4); ++extern unsigned long long gnuefi_call5( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5); ++extern unsigned long long gnuefi_call6( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5, ++ unsigned long long arg6); ++extern unsigned long long gnuefi_call7( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5, ++ unsigned long long arg6, ++ unsigned long long arg7); ++extern unsigned long long gnuefi_call8( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5, ++ unsigned long long arg6, ++ unsigned long long arg7, ++ unsigned long long arg8); ++extern unsigned long long gnuefi_call9( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5, ++ unsigned long long arg6, ++ unsigned long long arg7, ++ unsigned long long arg8, ++ unsigned long long arg9); ++extern unsigned long long gnuefi_call10( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5, ++ unsigned long long arg6, ++ unsigned long long arg7, ++ unsigned long long arg8, ++ unsigned long long arg9, ++ unsigned long long arg10); ++ ++ ++unsigned long long gnuefi_call0(void *func) ++{ ++ unsigned long long ret, dummy; ++ register unsigned long long r8 __asm__("r8"); ++ register unsigned long long r9 __asm__("r9"); ++ register unsigned long long r10 __asm__("r10"); ++ register unsigned long long r11 __asm__("r11"); ++ __asm__ __volatile__( ++ alloc_win_stack_frame(4) ++ "call *%[fptr]\n\t" ++ free_win_stack_frame(4) ++ : "=a" (ret), "=c" (dummy), "=d" (dummy), ++ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11) ++ : [fptr] "r" (func)); ++ return ret; ++} ++ ++unsigned long long gnuefi_call1(void *func, unsigned long long arg1) ++{ ++ unsigned long long ret, dummy; ++ register unsigned long long r8 __asm__("r8"); ++ register unsigned long long r9 __asm__("r9"); ++ register unsigned long long r10 __asm__("r10"); ++ register unsigned long long r11 __asm__("r11"); ++ __asm__ __volatile__( ++ alloc_win_stack_frame(4) ++ "call *%[fptr]\n\t" ++ free_win_stack_frame(4) ++ : "=a" (ret), "=c" (dummy), "=d" (dummy), ++ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11) ++ : "c" (arg1), ++ [fptr] "r" (func)); ++ return ret; ++} ++ ++unsigned long long gnuefi_call2(void *func, unsigned long long arg1, unsigned long long arg2) ++{ ++ unsigned long long ret, dummy; ++ register unsigned long long r8 __asm__("r8"); ++ register unsigned long long r9 __asm__("r9"); ++ register unsigned long long r10 __asm__("r10"); ++ register unsigned long long r11 __asm__("r11"); ++ __asm__ __volatile__( ++ alloc_win_stack_frame(4) ++ "call *%[fptr]\n\t" ++ free_win_stack_frame(4) ++ : "=a" (ret), "=c" (dummy), "=d" (dummy), ++ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11) ++ : "c" (arg1), "d" (arg2), ++ [fptr] "r" (func)); ++ return ret; ++} ++ ++unsigned long long gnuefi_call3( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3) ++{ ++ unsigned long long ret, dummy; ++ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3; ++ register unsigned long long r9 __asm__("r9"); ++ register unsigned long long r10 __asm__("r10"); ++ register unsigned long long r11 __asm__("r11"); ++ __asm__ __volatile__( ++ alloc_win_stack_frame(4) ++ "call *%[fptr]\n\t" ++ free_win_stack_frame(4) ++ : "=a" (ret), "=c" (dummy), "=d" (dummy), ++ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11) ++ : "c" (arg1), "d" (arg2), "r" (r8), ++ [fptr] "r" (func)); ++ return ret; ++} ++ ++unsigned long long gnuefi_call4( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4) ++{ ++ unsigned long long ret, dummy; ++ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3; ++ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4; ++ register unsigned long long r10 __asm__("r10"); ++ register unsigned long long r11 __asm__("r11"); ++ __asm__ __volatile__( ++ alloc_win_stack_frame(4) ++ "call *%[fptr]\n\t" ++ free_win_stack_frame(4) ++ : "=a" (ret), "=c" (dummy), "=d" (dummy), ++ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11) ++ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9), ++ [fptr] "r" (func)); ++ return ret; ++} ++ ++unsigned long long gnuefi_call5( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5) ++{ ++ unsigned long long ret, dummy; ++ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3; ++ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4; ++ register unsigned long long r10 __asm__("r10"); ++ register unsigned long long r11 __asm__("r11"); ++ __asm__ __volatile__( ++ "mov %[rarg5], " lin2win_win_arg(5,6) "\n\t" ++ alloc_win_stack_frame(6) ++ "call *%[fptr]\n\t" ++ free_win_stack_frame(6) ++ : "=a" (ret), "=c" (dummy), "=d" (dummy), ++ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11) ++ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9), ++ [rarg5] "r" ((unsigned long long)arg5), ++ [fptr] "r" (func)); ++ return ret; ++} ++ ++unsigned long long gnuefi_call6( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5, ++ unsigned long long arg6) ++{ ++ unsigned long long ret, dummy; ++ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3; ++ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4; ++ register unsigned long long r10 __asm__("r10"); ++ register unsigned long long r11 __asm__("r11"); ++ __asm__ __volatile__( ++ "movq %[rarg5], " lin2win_win_arg(5,6) "\n\t" ++ "movq %[rarg6], " lin2win_win_arg(6,6) "\n\t" ++ alloc_win_stack_frame(6) ++ "call *%[fptr]\n\t" ++ free_win_stack_frame(6) ++ : "=a" (ret), "=c" (dummy), "=d" (dummy), ++ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11) ++ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9), ++ [rarg5] "r" ((unsigned long long)arg5), [rarg6] "r" ((unsigned long long)arg6), ++ [fptr] "r" (func)); ++ return ret; ++} ++ ++unsigned long long gnuefi_call7( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5, ++ unsigned long long arg6, ++ unsigned long long arg7) ++{ ++ unsigned long long ret, dummy; ++ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3; ++ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4; ++ register unsigned long long r10 __asm__("r10"); ++ register unsigned long long r11 __asm__("r11"); ++ __asm__ __volatile__( ++ "movq %[rarg5], " lin2win_win_arg(5,7) "\n\t" ++ "movq %[rarg6], " lin2win_win_arg(6,7) "\n\t" ++ "movq %[rarg7], " lin2win_win_arg(7,7) "\n\t" ++ alloc_win_stack_frame(7) ++ "call *%[fptr]\n\t" ++ free_win_stack_frame(7) ++ : "=a" (ret), "=c" (dummy), "=d" (dummy), ++ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11) ++ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9), ++ [rarg5] "r" ((unsigned long long)arg5), [rarg6] "r" ((unsigned long long)arg6), ++ [rarg7] "r" ((unsigned long long)arg7), [fptr] "r" (func)); ++ return ret; ++} ++ ++unsigned long long gnuefi_call8( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5, ++ unsigned long long arg6, ++ unsigned long long arg7, ++ unsigned long long arg8) ++{ ++ unsigned long long ret, dummy; ++ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3; ++ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4; ++ register unsigned long long r10 __asm__("r10"); ++ register unsigned long long r11 __asm__("r11"); ++ __asm__ __volatile__( ++ "movq %[rarg5], " lin2win_win_arg(5,8) "\n\t" ++ "movq %[rarg6], " lin2win_win_arg(6,8) "\n\t" ++ "movq %[rarg7], " lin2win_win_arg(7,8) "\n\t" ++ "movq %[rarg8], " lin2win_win_arg(8,8) "\n\t" ++ alloc_win_stack_frame(8) ++ "call *%[fptr]\n\t" ++ free_win_stack_frame(8) ++ : "=a" (ret), "=c" (dummy), "=d" (dummy), ++ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11) ++ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9), ++ [rarg5] "r" ((unsigned long long)arg5), [rarg6] "r" ((unsigned long long)arg6), ++ [rarg7] "r" ((unsigned long long)arg7), [rarg8] "r" ((unsigned long long)arg8), ++ [fptr] "r" (func)); ++ return ret; ++} ++ ++unsigned long long gnuefi_call9( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5, ++ unsigned long long arg6, ++ unsigned long long arg7, ++ unsigned long long arg8, ++ unsigned long long arg9) ++{ ++ unsigned long long ret, dummy; ++ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3; ++ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4; ++ register unsigned long long r10 __asm__("r10"); ++ register unsigned long long r11 __asm__("r11"); ++ __asm__ __volatile__( ++ "movq %[rarg5], " lin2win_win_arg(5,9) "\n\t" ++ "movq %[rarg6], " lin2win_win_arg(6,9) "\n\t" ++ "movq %[rarg7], " lin2win_win_arg(7,9) "\n\t" ++ "movq %[rarg8], " lin2win_win_arg(8,9) "\n\t" ++ "movq %[rarg9], " lin2win_win_arg(9,9) "\n\t" ++ alloc_win_stack_frame(9) ++ "call *%[fptr]\n\t" ++ free_win_stack_frame(9) ++ : "=a" (ret), "=c" (dummy), "=d" (dummy), ++ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11) ++ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9), ++ [rarg5] "r" ((unsigned long long)arg5), [rarg6] "r" ((unsigned long long)arg6), ++ [rarg7] "r" ((unsigned long long)arg7), [rarg8] "r" ((unsigned long long)arg8), ++ [rarg9] "r" ((unsigned long long)arg9), [fptr] "r" (func)); ++ return ret; ++} ++ ++unsigned long long gnuefi_call10( ++ void *func, ++ unsigned long long arg1, ++ unsigned long long arg2, ++ unsigned long long arg3, ++ unsigned long long arg4, ++ unsigned long long arg5, ++ unsigned long long arg6, ++ unsigned long long arg7, ++ unsigned long long arg8, ++ unsigned long long arg9, ++ unsigned long long arg10) ++{ ++ unsigned long long ret, dummy; ++ register unsigned long long r8 __asm__("r8") = (unsigned long long)arg3; ++ register unsigned long long r9 __asm__("r9") = (unsigned long long)arg4; ++ register unsigned long long r10 __asm__("r10"); ++ register unsigned long long r11 __asm__("r11"); ++ __asm__ __volatile__( ++ "movq %[rarg5], " lin2win_win_arg(5,10) "\n\t" ++ "movq %[rarg6], " lin2win_win_arg(6,10) "\n\t" ++ "movq %[rarg7], " lin2win_win_arg(7,10) "\n\t" ++ "movq %[rarg8], " lin2win_win_arg(8,10) "\n\t" ++ "movq %[rarg9], " lin2win_win_arg(9,10) "\n\t" ++ "movq %[rarg10], " lin2win_win_arg(10,10) "\n\t" ++ alloc_win_stack_frame(10) ++ "call *%[fptr]\n\t" ++ free_win_stack_frame(10) ++ : "=a" (ret), "=c" (dummy), "=d" (dummy), ++ "=r" (r8), "=r" (r9), "=r" (r10), "=r" (r11) ++ : "c" (arg1), "d" (arg2), "r" (r8), "r" (r9), ++ [rarg5] "r" ((unsigned long long)arg5), [rarg6] "r" ((unsigned long long)arg6), ++ [rarg7] "r" ((unsigned long long)arg7), [rarg8] "r" ((unsigned long long)arg8), ++ [rarg9] "r" ((unsigned long long)arg9), [rarg10] "r" ((unsigned long long)arg10), ++ [fptr] "r" (func)); ++ return ret; ++} ++ +diff -urpN gnu-efi-3.0d/gnuefi/Makefile.callwrap gnu-efi-3.0d/gnuefi/Makefile +--- gnu-efi-3.0d/gnuefi/Makefile.callwrap 2008-04-29 15:40:07.000000000 -0400 ++++ gnu-efi-3.0d/gnuefi/Makefile 2008-04-29 15:40:07.000000000 -0400 +@@ -23,7 +23,7 @@ + + include ../Make.defaults + CDIR=$(TOPDIR)/.. +-FILES = reloc_$(ARCH) setjmp_$(ARCH) ++FILES = reloc_$(ARCH) setjmp_$(ARCH) callwrap_$(ARCH) + + OBJS = $(FILES:%=%.o) + diff --git a/gnu-efi-3.0d-relocfmt.patch b/gnu-efi-3.0d-relocfmt.patch new file mode 100644 index 0000000..aeff4e0 --- /dev/null +++ b/gnu-efi-3.0d-relocfmt.patch @@ -0,0 +1,173 @@ +diff -urpN gnu-efi-3.0d/gnuefi/reloc_ia32.c.unify gnu-efi-3.0d/gnuefi/reloc_ia32.c +--- gnu-efi-3.0d/gnuefi/reloc_ia32.c.unify 2008-04-29 13:35:17.000000000 -0400 ++++ gnu-efi-3.0d/gnuefi/reloc_ia32.c 2008-04-29 13:34:44.000000000 -0400 +@@ -45,56 +45,54 @@ + #include + #include + +-int +-_relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) ++EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) + { +- extern EFI_STATUS efi_main (EFI_HANDLE, EFI_SYSTEM_TABLE *); + long relsz = 0, relent = 0; + ElfW(Rel) *rel = 0; ++ unsigned long *addr; + int i; + + for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { + switch (dyn[i].d_tag) { +- case DT_REL: +- rel = (ElfW(Rel)*) ((long) dyn[i].d_un.d_ptr + ldbase); +- break; +- +- case DT_RELSZ: +- relsz = dyn[i].d_un.d_val; +- break; +- +- case DT_RELENT: +- relent = dyn[i].d_un.d_val; +- break; ++ case DT_REL: ++ rel = (ElfW(Rel)*) ++ ((unsigned long)dyn[i].d_un.d_ptr ++ + ldbase); ++ break; ++ ++ case DT_RELSZ: ++ relsz = dyn[i].d_un.d_val; ++ break; ++ ++ case DT_RELENT: ++ relent = dyn[i].d_un.d_val; ++ break; + +- case DT_RELA: +- break; ++ case DT_RELA: ++ break; + +- default: +- break; ++ default: ++ break; + } + } + +- while (relsz > 0) { +- if (!rel || relent == 0) +- return EFI_LOAD_ERROR; ++ if (!rel || relent == 0) ++ return EFI_LOAD_ERROR; + ++ while (relsz > 0) { + /* apply the relocs */ + switch (ELF32_R_TYPE (rel->r_info)) { +- case R_386_NONE: +- break; +- +- case R_386_RELATIVE: +- { +- long *addr; +- +- addr = (long *) (ldbase + rel->r_offset); +- *addr += ldbase; +- break; +- } ++ case R_386_NONE: ++ break; ++ ++ case R_386_RELATIVE: ++ addr = (unsigned long *) ++ (ldbase + rel->r_offset); ++ *addr += ldbase; ++ break; + +- default: +- return EFI_LOAD_ERROR; ++ default: ++ break; + } + rel = (ElfW(Rel)*) ((char *) rel + relent); + relsz -= relent; +diff -urpN gnu-efi-3.0d/gnuefi/reloc_x86_64.c.unify gnu-efi-3.0d/gnuefi/reloc_x86_64.c +--- gnu-efi-3.0d/gnuefi/reloc_x86_64.c.unify 2008-04-29 13:35:10.000000000 -0400 ++++ gnu-efi-3.0d/gnuefi/reloc_x86_64.c 2008-04-29 13:34:44.000000000 -0400 +@@ -50,7 +50,6 @@ + + EFI_STATUS _relocate (long ldbase, ElfW(Dyn) *dyn, EFI_HANDLE image, EFI_SYSTEM_TABLE *systab) + { +- //extern EFI_STATUS efi_main (EFI_HANDLE, EFI_SYSTEM_TABLE *); + long relsz = 0, relent = 0; + ElfW(Rel) *rel = 0; + unsigned long *addr; +@@ -58,43 +57,45 @@ EFI_STATUS _relocate (long ldbase, ElfW( + + for (i = 0; dyn[i].d_tag != DT_NULL; ++i) { + switch (dyn[i].d_tag) { +- case DT_RELA: +- rel = (ElfW(Rel)*) ((long) dyn[i].d_un.d_ptr + ldbase); +- break; +- +- case DT_RELASZ: +- relsz = dyn[i].d_un.d_val; +- break; +- +- case DT_RELAENT: +- relent = dyn[i].d_un.d_val; +- break; ++ case DT_RELA: ++ rel = (ElfW(Rel)*) ++ ((unsigned long)dyn[i].d_un.d_ptr ++ + ldbase); ++ break; ++ ++ case DT_RELASZ: ++ relsz = dyn[i].d_un.d_val; ++ break; ++ ++ case DT_RELAENT: ++ relent = dyn[i].d_un.d_val; ++ break; + +- default: +- break; ++ default: ++ break; + } + } + +- if (!rel || relent == 0){ ++ if (!rel || relent == 0) + return EFI_LOAD_ERROR; +- } ++ + while (relsz > 0) { + /* apply the relocs */ + switch (ELF64_R_TYPE (rel->r_info)) { +- case R_X86_64_NONE: +- break; ++ case R_X86_64_NONE: ++ break; + +- case R_X86_64_RELATIVE: +- addr = (unsigned long *) (ldbase + rel->r_offset); +- *addr += ldbase; +- break; ++ case R_X86_64_RELATIVE: ++ addr = (unsigned long *) ++ (ldbase + rel->r_offset); ++ *addr += ldbase; ++ break; + +- default: +- break; ++ default: ++ break; + } + rel = (ElfW(Rel)*) ((char *) rel + relent); + relsz -= relent; + } + return EFI_SUCCESS; + } +- diff --git a/gnu-efi-3.0d-section-attribs.patch b/gnu-efi-3.0d-section-attribs.patch new file mode 100644 index 0000000..900c693 --- /dev/null +++ b/gnu-efi-3.0d-section-attribs.patch @@ -0,0 +1,12 @@ +diff -urpN gnu-efi-3.0d/gnuefi/crt0-efi-ia32.S.attribs gnu-efi-3.0d/gnuefi/crt0-efi-ia32.S +--- gnu-efi-3.0d/gnuefi/crt0-efi-ia32.S.attribs 2008-04-29 13:56:27.000000000 -0400 ++++ gnu-efi-3.0d/gnuefi/crt0-efi-ia32.S 2008-04-29 13:56:29.000000000 -0400 +@@ -56,7 +56,7 @@ _start: + dummy: .long 0 + + #define IMAGE_REL_ABSOLUTE 0 +- .section .reloc, "a" ++ .section .reloc + .long dummy // Page RVA + .long 10 // Block Size (2*4+2) + .word (IMAGE_REL_ABSOLUTE<<12) + 0 // reloc for dummy diff --git a/gnu-efi-3.0d-setjmp.patch b/gnu-efi-3.0d-setjmp.patch new file mode 100644 index 0000000..a5cd4a6 --- /dev/null +++ b/gnu-efi-3.0d-setjmp.patch @@ -0,0 +1,170 @@ +diff -urpN gnu-efi-3.0d/gnuefi/Makefile.setjmp gnu-efi-3.0d/gnuefi/Makefile +--- gnu-efi-3.0d/gnuefi/Makefile.setjmp 2008-04-29 13:18:19.000000000 -0400 ++++ gnu-efi-3.0d/gnuefi/Makefile 2008-04-29 13:18:43.000000000 -0400 +@@ -23,7 +23,7 @@ + + include ../Make.defaults + CDIR=$(TOPDIR)/.. +-FILES = reloc_$(ARCH) ++FILES = reloc_$(ARCH) setjmp_$(ARCH) + + OBJS = $(FILES:%=%.o) + +diff -urpN gnu-efi-3.0d/gnuefi/setjmp_ia32.S.setjmp gnu-efi-3.0d/gnuefi/setjmp_ia32.S +--- gnu-efi-3.0d/gnuefi/setjmp_ia32.S.setjmp 2008-04-29 13:13:05.000000000 -0400 ++++ gnu-efi-3.0d/gnuefi/setjmp_ia32.S 2008-04-29 13:22:04.000000000 -0400 +@@ -0,0 +1,87 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2000 Free Software Foundation, Inc. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, see . ++ */ ++ ++/* This is stolen from libc/x86/setjmp.S in the OSKit */ ++/* ++ * Mach Operating System ++ * Copyright (c) 1991,1990,1989 Carnegie Mellon University ++ * All Rights Reserved. ++ * ++ * Permission to use, copy, modify and distribute this software and its ++ * documentation is hereby granted, provided that both the copyright ++ * notice and this permission notice appear in all copies of the ++ * software, derivative works or modified versions, and any portions ++ * thereof, and that both notices appear in supporting documentation. ++ * ++ * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" ++ * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ++ * ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE. ++ * ++ * Carnegie Mellon requests users of this software to return to ++ * ++ * Software Distribution Coordinator or Software.Distribution@CS.CMU.EDU ++ * School of Computer Science ++ * Carnegie Mellon University ++ * Pittsburgh PA 15213-3890 ++ * ++ * any improvements or extensions that they make and grant Carnegie Mellon ++ * the rights to redistribute these changes. ++ */ ++/* ++ * C library -- _setjmp, _longjmp ++ * ++ * _longjmp(a,v) ++ * will generate a "return(v)" from ++ * the last call to ++ * _setjmp(a) ++ * by restoring registers from the stack, ++ * The previous signal state is NOT restored. ++ * ++ */ ++ ++#define EXT_C(sym) sym ++#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x): ++ ++ .file "setjmp.S" ++ ++ .text ++ ++FUNCTION(setjmp) ++ movl 4(%esp), %ecx /* fetch buffer */ ++ movl %ebx, 0(%ecx) ++ movl %esi, 4(%ecx) ++ movl %edi, 8(%ecx) ++ movl %ebp, 12(%ecx) /* save frame pointer of caller */ ++ popl %edx ++ movl %esp, 16(%ecx) /* save stack pointer of caller */ ++ movl %edx, 20(%ecx) /* save pc of caller */ ++ xorl %eax, %eax ++ jmp *%edx ++ ++FUNCTION(longjmp) ++ movl 8(%esp), %eax /* return(v) */ ++ movl 4(%esp), %ecx /* fetch buffer */ ++ movl 0(%ecx), %ebx ++ movl 4(%ecx), %esi ++ movl 8(%ecx), %edi ++ movl 12(%ecx), %ebp ++ movl 16(%ecx), %esp ++ orl %eax, %eax ++ jnz 0f ++ incl %eax ++0: jmp *20(%ecx) /* done, return.... */ +diff -urpN gnu-efi-3.0d/gnuefi/setjmp_ia64.S.setjmp gnu-efi-3.0d/gnuefi/setjmp_ia64.S +--- gnu-efi-3.0d/gnuefi/setjmp_ia64.S.setjmp 2008-04-29 13:19:34.000000000 -0400 ++++ gnu-efi-3.0d/gnuefi/setjmp_ia64.S 2008-04-29 13:19:44.000000000 -0400 +@@ -0,0 +1,2 @@ ++ ++#warning not implemented +diff -urpN gnu-efi-3.0d/gnuefi/setjmp_x86_64.S.setjmp gnu-efi-3.0d/gnuefi/setjmp_x86_64.S +--- gnu-efi-3.0d/gnuefi/setjmp_x86_64.S.setjmp 2008-04-29 13:18:12.000000000 -0400 ++++ gnu-efi-3.0d/gnuefi/setjmp_x86_64.S 2008-04-29 13:22:04.000000000 -0400 +@@ -0,0 +1,56 @@ ++/* ++ * GRUB -- GRand Unified Bootloader ++ * Copyright (C) 2003 Free Software Foundation, Inc. ++ * ++ * This program is free software; you can redistribute it and/or modify ++ * it under the terms of the GNU General Public License as published by ++ * the Free Software Foundation; either version 2 of the License, or ++ * (at your option) any later version. ++ * ++ * This program is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public License ++ * along with this program; if not, see . ++ */ ++ ++#define EXT_C(sym) sym ++#define FUNCTION(x) .globl EXT_C(x) ; .type EXT_C(x), "function" ; EXT_C(x): ++ ++ .file "setjmp.S" ++ ++ .text ++ ++/* ++ * int setjmp (jmp_buf env) ++ */ ++FUNCTION(setjmp) ++ pop %rsi /* Return address, and adjust the stack */ ++ xor %rax, %rax ++ movq %rbx, 0(%rdi) /* RBX */ ++ movq %rsp, 8(%rdi) /* RSP */ ++ push %rsi ++ movq %rbp, 16(%rdi) /* RBP */ ++ movq %r12, 24(%rdi) /* R12 */ ++ movq %r13, 32(%rdi) /* R13 */ ++ movq %r14, 40(%rdi) /* R14 */ ++ movq %r15, 48(%rdi) /* R15 */ ++ movq %rsi, 56(%rdi) /* RSI */ ++ ret ++ ++/* ++ * int longjmp (jmp_buf env, int val) ++ */ ++FUNCTION(longjmp) ++ movl %esi, %eax ++ movq (%rdi), %rbx ++ movq 8(%rdi), %rsp ++ movq 16(%rdi), %rbp ++ movq 24(%rdi), %r12 ++ movq 32(%rdi), %r13 ++ movq 40(%rdi), %r14 ++ movq 48(%rdi), %r15 ++ jmp *56(%rdi) ++ +diff -urpN gnu-efi-3.0d/Make.rules.setjmp gnu-efi-3.0d/Make.rules diff --git a/gnu-efi-3.0e-pad-all-sections.patch b/gnu-efi-3.0e-pad-all-sections.patch new file mode 100644 index 0000000..361802a --- /dev/null +++ b/gnu-efi-3.0e-pad-all-sections.patch @@ -0,0 +1,243 @@ +diff -urpN gnu-efi-3.0e/gnuefi/elf_ia32_efi.lds.pad gnu-efi-3.0e/gnuefi/elf_ia32_efi.lds +--- gnu-efi-3.0e/gnuefi/elf_ia32_efi.lds.pad 2009-02-13 16:07:40.000000000 -0500 ++++ gnu-efi-3.0e/gnuefi/elf_ia32_efi.lds 2009-02-13 16:07:45.000000000 -0500 +@@ -5,17 +5,23 @@ SECTIONS + { + . = 0; + ImageBase = .; +- .hash : { *(.hash) } /* this MUST come first! */ ++ .hash : /* this MUST come first! */ ++ { ++ *(.hash) ++ LONG(0) ++ } + . = ALIGN(4096); + .text : + { + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) ++ LONG(0) + } + .reloc : + { + *(.reloc) ++ LONG(0) + } + . = ALIGN(4096); + .data : +@@ -34,25 +40,39 @@ SECTIONS + *(.dynbss) + *(.bss) + *(COMMON) ++ LONG(0) + } + . = ALIGN(4096); +- .dynamic : { *(.dynamic) } ++ .dynamic : ++ { ++ *(.dynamic) ++ LONG(0) ++ } + . = ALIGN(4096); + .rel : + { +- *(.rel.data) +- *(.rel.data.*) +- *(.rel.got) +- *(.rel.stab) +- *(.data.rel.ro.local) +- *(.data.rel.local) +- *(.data.rel.ro) +- *(.data.rel*) ++ *(.rel.data) ++ *(.rel.data.*) ++ *(.rel.got) ++ *(.rel.stab) ++ *(.data.rel.ro.local) ++ *(.data.rel.local) ++ *(.data.rel.ro) ++ *(.data.rel*) ++ LONG(0) + } + . = ALIGN(4096); +- .dynsym : { *(.dynsym) } ++ .dynsym : ++ { ++ *(.dynsym) ++ LONG(0) ++ } + . = ALIGN(4096); +- .dynstr : { *(.dynstr) } ++ .dynstr : ++ { ++ *(.dynstr) ++ LONG(0) ++ } + . = ALIGN(4096); + /DISCARD/ : + { +diff -urpN gnu-efi-3.0e/gnuefi/elf_ia64_efi.lds.pad gnu-efi-3.0e/gnuefi/elf_ia64_efi.lds +--- gnu-efi-3.0e/gnuefi/elf_ia64_efi.lds.pad 2009-02-13 16:07:40.000000000 -0500 ++++ gnu-efi-3.0e/gnuefi/elf_ia64_efi.lds 2009-02-13 16:07:45.000000000 -0500 +@@ -5,13 +5,18 @@ SECTIONS + { + . = 0; + ImageBase = .; +- .hash : { *(.hash) } /* this MUST come first! */ ++ .hash : /* this MUST come first! */ ++ { ++ *(.hash) ++ LONG(0) ++ } + . = ALIGN(4096); + .text : + { + *(.text) + *(.text.*) + *(.gnu.linkonce.t.*) ++ LONG(0) + } + . = ALIGN(4096); + __gp = ALIGN (8) + 0x200000; +@@ -23,6 +28,7 @@ SECTIONS + *(.sdata) + *(.sbss) + *(.scommon) ++ LONG(0) + } + . = ALIGN(4096); + .data : +@@ -37,29 +43,44 @@ SECTIONS + *(.dynbss) + *(.bss) + *(COMMON) ++ LONG(0) + } + . = ALIGN(4096); +- .dynamic : { *(.dynamic) } ++ .dynamic : ++ { ++ *(.dynamic) ++ LONG(0) ++ } + . = ALIGN(4096); + .rela : + { +- *(.rela.text) +- *(.rela.data*) +- *(.rela.sdata) +- *(.rela.got) +- *(.rela.gnu.linkonce.d*) +- *(.rela.stab) +- *(.rela.ctors) ++ *(.rela.text) ++ *(.rela.data*) ++ *(.rela.sdata) ++ *(.rela.got) ++ *(.rela.gnu.linkonce.d*) ++ *(.rela.stab) ++ *(.rela.ctors) ++ LONG(0) + } + . = ALIGN(4096); + .reloc : /* This is the PECOFF .reloc section! */ + { + *(.reloc) ++ LONG(0) + } + . = ALIGN(4096); +- .dynsym : { *(.dynsym) } ++ .dynsym : ++ { ++ *(.dynsym) ++ LONG(0) ++ } + . = ALIGN(4096); +- .dynstr : { *(.dynstr) } ++ .dynstr : ++ { ++ *(.dynstr) ++ LONG(0) ++ } + /DISCARD/ : + { + *(.rela.plabel) +diff -urpN gnu-efi-3.0e/gnuefi/elf_x86_64_efi.lds.pad gnu-efi-3.0e/gnuefi/elf_x86_64_efi.lds +--- gnu-efi-3.0e/gnuefi/elf_x86_64_efi.lds.pad 2009-02-13 16:07:40.000000000 -0500 ++++ gnu-efi-3.0e/gnuefi/elf_x86_64_efi.lds 2009-02-13 16:07:45.000000000 -0500 +@@ -5,20 +5,27 @@ SECTIONS + { + . = 0; + ImageBase = .; +- .hash : { *(.hash) } /* this MUST come first! */ ++ .hash : /* this MUST come first! */ ++ { ++ *(.hash) ++ LONG(0) ++ } + . = ALIGN(4096); + .eh_frame : + { + *(.eh_frame) ++ LONG(0) + } + . = ALIGN(4096); + .text : + { + *(.text) ++ LONG(0) + } + .reloc : + { + *(.reloc) ++ LONG(0) + } + . = ALIGN(4096); + .data : +@@ -36,23 +43,38 @@ SECTIONS + *(.bss) + *(COMMON) + *(.rel.local) ++ LONG(0) + } + . = ALIGN(4096); +- .dynamic : { *(.dynamic) } ++ .dynamic : ++ { ++ *(.dynamic) ++ LONG(0) ++ } + . = ALIGN(4096); + .rela : + { +- *(.rela.data*) +- *(.rela.got) +- *(.rela.stab) ++ *(.rela.data*) ++ *(.rela.got) ++ *(.rela.stab) ++ LONG(0) + } + . = ALIGN(4096); +- .dynsym : { *(.dynsym) } ++ .dynsym : ++ { ++ *(.dynsym) ++ LONG(0) ++ } + . = ALIGN(4096); +- .dynstr : { *(.dynstr) } ++ .dynstr : ++ { ++ *(.dynstr) ++ LONG(0) ++ } + . = ALIGN(4096); + .ignored.reloc : + { +- *(.rela.reloc) ++ *(.rela.reloc) ++ LONG(0) + } + } diff --git a/gnu-efi.spec b/gnu-efi.spec index b2f1f0c..d033706 100644 --- a/gnu-efi.spec +++ b/gnu-efi.spec @@ -1,16 +1,17 @@ Summary: Development Libraries and headers for EFI Name: gnu-efi Version: 3.0e -Release: 2%{?dist} +Release: 3%{?dist} Group: Development/System License: GPLv2+ URL: ftp://ftp.hpl.hp.com/pub/linux-ia64 Source: ftp://ftp.hpl.hp.com/pub/linux-ia64/gnu-efi-%{version}.tar.bz2 Patch0: gnu-efi-3.0e-no-relocations.patch Patch1: gnu-efi-3.0e-Fix-usage-of-INSTALLROOT-PREFIX-and-LIBDIR.patch -Patch2: gnu-efi-3.0d-unwrap.patch -Patch3: gnu-efi-3.0d-uefi_wrap.patch -Patch4: gnu-efi-3.0d-uefi_wrap_call10.patch +Patch2: gnu-efi-3.0e-pad-all-sections.patch +Patch3: gnu-efi-3.0d-unwrap.patch +Patch4: gnu-efi-3.0d-uefi_wrap.patch +Patch5: gnu-efi-3.0d-uefi_wrap_call10.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) ExclusiveArch: i386 x86_64 @@ -22,12 +23,13 @@ applications that run under EFI (Extensible Firmware Interface). %setup -q %patch0 -p1 %patch1 -p1 +%patch2 -p1 # these are currently disabled as we don't need them per se, and they # haven't gone upstream yet either. Also #2 and #3 haven't been updated # to work with gnu-efi-3.0e yet. -#%%patch2 -p1 #%%patch3 -p1 #%%patch4 -p1 +#%%patch5 -p1 %build # Package cannot build with %{?_smp_mflags}. @@ -55,6 +57,10 @@ rm -rf %{buildroot} %{_libdir}/* %changelog +* Fri Feb 13 2009 Peter Jones - 3.0e-3 +- Pad sections out in the provided linker scripts to make sure they all of + some content. + * Fri Oct 03 2008 Peter Jones - 3.0e-2 - Fix install paths on x86_64.