mirror of
https://github.com/rui314/mold.git
synced 2024-12-28 19:04:27 +03:00
temporary
This commit is contained in:
parent
03db6156a6
commit
8589737248
@ -270,6 +270,15 @@ void InputSection::scan_relocations() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto recompile_error = [&]() {
|
||||||
|
file->err_out << *this << ": " << rel_to_string(rel.r_type)
|
||||||
|
<< " relocation against symbol `" << sym.name
|
||||||
|
<< "' can not be used; recompile with -fPIE\n";
|
||||||
|
};
|
||||||
|
|
||||||
|
bool is_readonly = !(shdr.sh_flags & SHF_WRITE);
|
||||||
|
bool is_code = !(sym.st_type == STT_OBJECT);
|
||||||
|
|
||||||
switch (rel.r_type) {
|
switch (rel.r_type) {
|
||||||
case R_X86_64_NONE:
|
case R_X86_64_NONE:
|
||||||
rel_types[i] = R_NONE;
|
rel_types[i] = R_NONE;
|
||||||
@ -279,10 +288,7 @@ void InputSection::scan_relocations() {
|
|||||||
case R_X86_64_32:
|
case R_X86_64_32:
|
||||||
case R_X86_64_32S:
|
case R_X86_64_32S:
|
||||||
if (config.pie || sym.is_imported)
|
if (config.pie || sym.is_imported)
|
||||||
file->err_out << *this << ": " << rel_to_string(rel.r_type)
|
recompile_error();
|
||||||
<< " relocation against symbol `" << sym.name
|
|
||||||
<< "' can not be used; recompile with -fPIE\n";
|
|
||||||
|
|
||||||
rel_types[i] = R_ABS;
|
rel_types[i] = R_ABS;
|
||||||
break;
|
break;
|
||||||
case R_X86_64_64:
|
case R_X86_64_64:
|
||||||
@ -303,12 +309,8 @@ void InputSection::scan_relocations() {
|
|||||||
case R_X86_64_PC32:
|
case R_X86_64_PC32:
|
||||||
case R_X86_64_PC64:
|
case R_X86_64_PC64:
|
||||||
rel_types[i] = R_PC;
|
rel_types[i] = R_PC;
|
||||||
if (sym.is_imported) {
|
if (sym.is_imported)
|
||||||
if (sym.st_type == STT_OBJECT)
|
sym.flags |= is_code ? NEEDS_PLT : NEEDS_COPYREL;
|
||||||
sym.flags |= NEEDS_COPYREL;
|
|
||||||
else
|
|
||||||
sym.flags |= NEEDS_PLT;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case R_X86_64_GOT32:
|
case R_X86_64_GOT32:
|
||||||
rel_types[i] = R_GOT;
|
rel_types[i] = R_GOT;
|
||||||
|
Loading…
Reference in New Issue
Block a user