diff mbox series

[committed] amdgcn: Fix early-debug relocations

Message ID afd33f83-91e4-b1df-624e-097154cb1970@codesourcery.com
State New
Headers show
Series [committed] amdgcn: Fix early-debug relocations | expand

Commit Message

Andrew Stubbs Nov. 26, 2020, 2:41 p.m. UTC
This patch fixes an error in GCN mkoffload that corrupted relocations in 
the early-debug info.

The code now updates the relocation code without zeroing the symbol index.

Andrew

Comments

Andrew Stubbs March 6, 2021, 4:02 p.m. UTC | #1
This patch is now backported to devel/omp/gcc-10.

Andrew

On 26/11/2020 14:41, Andrew Stubbs wrote:
> This patch fixes an error in GCN mkoffload that corrupted relocations in 
> the early-debug info.
> 
> The code now updates the relocation code without zeroing the symbol index.
> 
> Andrew
diff mbox series

Patch

Fix early-debug relocations

The relocation symbols were inadvertantly wiped when the type was set in
mkoffload.

gcc/ChangeLog

	* config/gcn/mkoffload.c (copy_early_debug_info): Don't wipe
	relocation symbols.

diff --git a/gcc/config/gcn/mkoffload.c b/gcc/config/gcn/mkoffload.c
index f7589a5a78c..fad0fb346ec 100644
--- a/gcc/config/gcn/mkoffload.c
+++ b/gcc/config/gcn/mkoffload.c
@@ -336,19 +336,24 @@  copy_early_debug_info (const char *infile, const char *outfile)
 	    {
 	    case R_X86_64_32:
 	    case R_X86_64_32S:
-	      reloc->r_info = R_AMDGPU_ABS32;
+	      reloc->r_info = ELF32_R_INFO(ELF32_R_SYM(reloc->r_info),
+					   R_AMDGPU_ABS32);
 	      break;
 	    case R_X86_64_PC32:
-	      reloc->r_info = R_AMDGPU_REL32;
+	      reloc->r_info = ELF32_R_INFO(ELF32_R_SYM(reloc->r_info),
+					   R_AMDGPU_REL32);
 	      break;
 	    case R_X86_64_PC64:
-	      reloc->r_info = R_AMDGPU_REL64;
+	      reloc->r_info = ELF32_R_INFO(ELF32_R_SYM(reloc->r_info),
+					   R_AMDGPU_REL64);
 	      break;
 	    case R_X86_64_64:
-	      reloc->r_info = R_AMDGPU_ABS64;
+	      reloc->r_info = ELF32_R_INFO(ELF32_R_SYM(reloc->r_info),
+					   R_AMDGPU_ABS64);
 	      break;
 	    case R_X86_64_RELATIVE:
-	      reloc->r_info = R_AMDGPU_RELATIVE64;
+	      reloc->r_info = ELF32_R_INFO(ELF32_R_SYM(reloc->r_info),
+					   R_AMDGPU_RELATIVE64);
 	      break;
 	    default:
 	      gcc_unreachable ();