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;