From 5f58683412af0e6a6d95b88c68192cf2634f9a40 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Thu, 29 Oct 2020 17:54:21 +0900 Subject: [PATCH] temporary --- main.cc | 4 +--- mold.h | 15 +++++++++++++++ output_chunks.cc | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/main.cc b/main.cc index c79eedbe..5ffc0f72 100644 --- a/main.cc +++ b/main.cc @@ -487,9 +487,6 @@ int main(int argc, char **argv) { num_got += got; num_plt += plt; }); - - llvm::outs() << "num_got=" << num_got << "\n" - << "num_plt=" << num_plt << "\n"; } // Create linker-synthesized sections. @@ -497,6 +494,7 @@ int main(int argc, char **argv) { out::phdr = new OutputPhdr; out::shdr = new OutputShdr; // out::interp = new InterpSection; + out::got = new GotSection; out::shstrtab = new ShstrtabSection; out::symtab = new SymtabSection; out::strtab = new StrtabSection; diff --git a/mold.h b/mold.h index 68751221..801bebce 100644 --- a/mold.h +++ b/mold.h @@ -346,6 +346,20 @@ private: }; +class GotSection : public OutputChunk { +public: + GotSection() { + shdr.sh_flags = llvm::ELF::SHF_ALLOC; + shdr.sh_type = llvm::ELF::SHT_PROGBITS; + } + + void copy_to(uint8_t *buf) override {} + u64 get_size() const override { return size; } + + u64 size = 0; + std::vector symbols; +}; + class ShstrtabSection : public OutputChunk { public: ShstrtabSection() { @@ -410,6 +424,7 @@ extern OutputEhdr *ehdr; extern OutputShdr *shdr; extern OutputPhdr *phdr; extern InterpSection *interp; +extern GotSection *got; extern ShstrtabSection *shstrtab; extern SymtabSection *symtab; extern StrtabSection *strtab; diff --git a/output_chunks.cc b/output_chunks.cc index 696cdcdf..5542da22 100644 --- a/output_chunks.cc +++ b/output_chunks.cc @@ -6,6 +6,7 @@ OutputEhdr *out::ehdr; OutputShdr *out::shdr; OutputPhdr *out::phdr; InterpSection *out::interp; +GotSection *out::got; ShstrtabSection *out::shstrtab; SymtabSection *out::symtab; StrtabSection *out::strtab;