comparison lld/ELF/SyntheticSections.h @ 173:0572611fdcc8 llvm10 llvm12

reorgnization done
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Mon, 25 May 2020 11:55:54 +0900
parents 1d019706d866
children 2e18cbf3894f
comparison
equal deleted inserted replaced
172:9fbae9c8bf63 173:0572611fdcc8
362 // Return (and create if necessary) `FileGot`. 362 // Return (and create if necessary) `FileGot`.
363 FileGot &getGot(InputFile &f); 363 FileGot &getGot(InputFile &f);
364 364
365 // Try to merge two GOTs. In case of success the `Dst` contains 365 // Try to merge two GOTs. In case of success the `Dst` contains
366 // result of merging and the function returns true. In case of 366 // result of merging and the function returns true. In case of
367 // ovwerflow the `Dst` is unchanged and the function returns false. 367 // overflow the `Dst` is unchanged and the function returns false.
368 bool tryMergeGots(FileGot & dst, FileGot & src, bool isPrimary); 368 bool tryMergeGots(FileGot & dst, FileGot & src, bool isPrimary);
369 }; 369 };
370 370
371 class GotPltSection final : public SyntheticSection { 371 class GotPltSection final : public SyntheticSection {
372 public: 372 public:
682 void addSymbols(); 682 void addSymbols();
683 void addEntry(Symbol &sym); 683 void addEntry(Symbol &sym);
684 size_t getNumEntries() const { return entries.size(); } 684 size_t getNumEntries() const { return entries.size(); }
685 685
686 size_t headerSize; 686 size_t headerSize;
687 size_t footerSize = 0;
688 687
689 std::vector<const Symbol *> entries; 688 std::vector<const Symbol *> entries;
690 }; 689 };
691 690
692 // Used for non-preemptible ifuncs. It does not have a header. Each entry is 691 // Used for non-preemptible ifuncs. It does not have a header. Each entry is
701 void writeTo(uint8_t *buf) override; 700 void writeTo(uint8_t *buf) override;
702 size_t getSize() const override; 701 size_t getSize() const override;
703 bool isNeeded() const override { return !entries.empty(); } 702 bool isNeeded() const override { return !entries.empty(); }
704 void addSymbols(); 703 void addSymbols();
705 void addEntry(Symbol &sym); 704 void addEntry(Symbol &sym);
705 };
706
707 class PPC32GlinkSection : public PltSection {
708 public:
709 PPC32GlinkSection();
710 void writeTo(uint8_t *buf) override;
711 size_t getSize() const override;
712
713 std::vector<const Symbol *> canonical_plts;
714 static constexpr size_t footerSize = 64;
706 }; 715 };
707 716
708 // This is x86-only. 717 // This is x86-only.
709 class IBTPltSection : public SyntheticSection { 718 class IBTPltSection : public SyntheticSection {
710 public: 719 public:
1035 // Links to the ARMExidxSections so we can transfer the relocations once the 1044 // Links to the ARMExidxSections so we can transfer the relocations once the
1036 // layout is known. 1045 // layout is known.
1037 std::vector<InputSection *> exidxSections; 1046 std::vector<InputSection *> exidxSections;
1038 1047
1039 private: 1048 private:
1040 size_t size; 1049 size_t size = 0;
1041 1050
1042 // Instead of storing pointers to the .ARM.exidx InputSections from 1051 // Instead of storing pointers to the .ARM.exidx InputSections from
1043 // InputObjects, we store pointers to the executable sections that need 1052 // InputObjects, we store pointers to the executable sections that need
1044 // .ARM.exidx sections. We can then use the dependentSections of these to 1053 // .ARM.exidx sections. We can then use the dependentSections of these to
1045 // either find the .ARM.exidx section or know that we need to generate one. 1054 // either find the .ARM.exidx section or know that we need to generate one.