Fix early-debug relocations
authorAndrew Stubbs <ams@codesourcery.com>
Thu, 22 Oct 2020 12:27:47 +0000 (13:27 +0100)
committerAndrew Stubbs <ams@codesourcery.com>
Thu, 26 Nov 2020 14:28:44 +0000 (14:28 +0000)
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.

gcc/config/gcn/mkoffload.c

index f7589a5a78c70bef4f72271be06c8383624a1e58..fad0fb346ec3273512d647417c90c6869e8280cb 100644 (file)
@@ -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 ();