From cfb3416e6896d564640f85108be30b504facbadf Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Wed, 13 Jan 2021 21:57:12 +0900 Subject: [PATCH] temporary --- input_sections.cc | 25 ++++++++++++++----------- mold.h | 1 + 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/input_sections.cc b/input_sections.cc index 75d403a8..7ba6849e 100644 --- a/input_sections.cc +++ b/input_sections.cc @@ -178,16 +178,18 @@ void InputSection::copy_buf() { break; case R_ABS: write(S + A); + break; + case R_ABS_DYN: + if (is_readonly) + recompile_error(); - if (config.pie && sym.is_relative()) { - if (is_readonly) - recompile_error(); - memset(dynrel, 0, sizeof(*dynrel)); - dynrel->r_offset = P; - dynrel->r_type = R_X86_64_RELATIVE; - dynrel->r_addend = S + A; - dynrel++; - } + write(S + A); + + memset(dynrel, 0, sizeof(*dynrel)); + dynrel->r_offset = P; + dynrel->r_type = R_X86_64_RELATIVE; + dynrel->r_addend = S + A; + dynrel++; break; case R_DYN: if (is_readonly) @@ -298,10 +300,11 @@ void InputSection::scan_relocations() { rel_types[i] = R_DYN; sym.flags |= NEEDS_DYNSYM; file->num_dynrel++; + } else if (sym.is_relative()) { + rel_types[i] = R_ABS_DYN; + file->num_dynrel++; } else { rel_types[i] = R_ABS; - if (sym.is_relative()) - file->num_dynrel++; } } else { rel_types[i] = R_ABS; diff --git a/mold.h b/mold.h index 09a3213d..9a85c98d 100644 --- a/mold.h +++ b/mold.h @@ -280,6 +280,7 @@ protected: enum RelType : u8 { R_NONE, R_ABS, + R_ABS_DYN, R_DYN, R_PC, R_GOT,