1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 02:20:51 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-12-17 21:36:38 +09:00
parent a1e39bfe5c
commit 6a643bdaaa
3 changed files with 6 additions and 15 deletions

11
main.cc
View File

@ -797,7 +797,8 @@ int main(int argc, char **argv) {
parse_version_script(std::string(arg));
} else if (read_flag(args, "pie")) {
config.pie = true;
config.image_base = 0;
} else if (read_flag(args, "no-pie")) {
config.pie = false;
} else if (read_flag(args, "perf")) {
config.perf = true;
} else if (read_arg(args, arg, "l")) {
@ -822,6 +823,9 @@ int main(int argc, char **argv) {
if (config.output == "")
error("-o option is missing");
if (config.pie)
config.image_base = 0;
tbb::global_control tbb_cont(tbb::global_control::max_allowed_parallelism,
config.thread_count);
@ -1058,11 +1062,6 @@ int main(int argc, char **argv) {
});
}
#if 0
if (out::reldyn)
out::reldyn->sort();
#endif
// Zero-clear paddings between sections
clear_padding(filesize);

1
mold.h
View File

@ -442,7 +442,6 @@ public:
void update_shdr() override;
void copy_buf() override;
void sort();
};
class StrtabSection : public OutputChunk {

View File

@ -175,6 +175,7 @@ void RelDynSection::copy_buf() {
if (sym->is_imported) {
write(sym, R_X86_64_GLOB_DAT, sym->get_got_addr());
} else if (sym->needs_relative_rel()) {
memset(rel, 0, sizeof(ElfRela));
rel->r_type = R_X86_64_RELATIVE;
rel->r_offset = sym->get_got_addr();
rel->r_addend = sym->get_addr();
@ -198,14 +199,6 @@ void RelDynSection::copy_buf() {
write(sym, R_X86_64_COPY, sym->get_addr());
}
void RelDynSection::sort() {
ElfRela *begin = (ElfRela *)(out::buf + shdr.sh_offset);
ElfRela *end = begin + shdr.sh_size / sizeof(ElfRela);
std::stable_sort(begin, end, [](const ElfRela &a, const ElfRela &b) {
return a.r_type == R_X86_64_RELATIVE && b.r_type != R_X86_64_RELATIVE;
});
}
void StrtabSection::update_shdr() {
shdr.sh_size = 1;
for (ObjectFile *file : out::objs) {