diff mbox

x86/efi: Do not write relocations in efi_arch_relocate_image() first pass

Message ID 1501689378.4771.427.camel@infradead.org (mailing list archive)
State New, archived
Headers show

Commit Message

David Woodhouse Aug. 2, 2017, 3:56 p.m. UTC
On Wed, 2017-08-02 at 09:16 -0600, Jan Beulich wrote:
> 
> Well, I've seen breakage in all sorts of places I wouldn't have expected
> anyone to fine a need to fiddle with.

This is the nature of 'value subtract', I suppose. 

How about something like this? Somewhat complicated by the fact that
COFF section names get truncated, so maybe there's a nicer place to put
it (or maybe we explicitly include .init.da into the .init.data output
section, in the efi.lds linker script, or something?)....
diff mbox

Patch

--- a/xen/arch/x86/efi/mkreloc.c
+++ b/xen/arch/x86/efi/mkreloc.c
@@ -346,6 +346,15 @@  int main(int argc, char *argv[])
              memcmp(sec1[i].name, ".lockpro", sizeof(sec1[i].name)) == 0 )
             continue;
 
+       /* For sections with relocations, force them to be writeable */
+       if (memcmp(sec1[i].name, ".init.da", sizeof(sec1[i].name)) == 0)
+               printf(".pushsection .init.data, \"awx\"\n");
+       else if (memcmp(sec1[i].name, ".init.te", sizeof(sec1[i].name) ) == 0)
+               printf(".pushsection .init.text, \"awx\"\n");
+       else
+               printf(".pushsection %.*s, \"awx\"\n", (int)sizeof(sec1[i].name), sec1[i].name);
+       printf(".popsection\n");
+
         if ( !sec1[i].rva )
         {
             fprintf(stderr, "Can't handle section %u with zero RVA\n", i);