There is a mistake in sign in the patch I posted

=====
diff --git a/BaseTools/Source/C/GenFw/Elf64Convert.c 
b/BaseTools/Source/C/GenFw/Elf64Convert.c
--- a/BaseTools/Source/C/GenFw/Elf64Convert.c
+++ b/BaseTools/Source/C/GenFw/Elf64Convert.c
@@ -962,7 +962,7 @@ WriteSections64 (
             VerboseMsg ("Offset: 0x%08X, Addend: 0x%08X",
               (UINT32)(SecOffset + (Rel->r_offset - SecShdr->sh_addr)),
               *(UINT32 *)Targ);
-            GOTEntryRva = Rel->r_offset - Rel->r_addend + *(UINT32 *)Targ;
+            GOTEntryRva = Rel->r_offset - Rel->r_addend + *(INT32 *)Targ;
             FindElfGOTSectionFromGOTEntryElfRva(GOTEntryRva);
             *(UINT32 *)Targ = (UINT32) (*(UINT32 *)Targ
               + (mCoffSectionsOffset[mGOTShindex] - mGOTShdr->sh_addr)
=====

(Displacement should be sign-extended to 64 bit for this calc.)

It did not surface because in single-text section ELF file, displacement from 
instructions to GOT entries are always positive.

I will repost the whole patch with this change.

--------------------------------------------
On Thu, 6/7/18, Gao, Liming <liming....@intel.com> wrote:

 Subject: RE: [PATCH] BaseTools/GenFw: Add X64 GOTPCREL Support to GenFw
 To: "Zenith432" <zenith...@users.sourceforge.net>, "edk2-devel@lists.01.org" 
<edk2-devel@lists.01.org>
 Cc: "Shi, Steven" <steven....@intel.com>, "Zhu, Yonghong" 
<yonghong....@intel.com>
 Date: Thursday, June 7, 2018, 4:32 AM
 
 What's purpose to support GOTPCREL in GenFw?
 Could you introduce your usage model?
 
 
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to