1
1
mirror of https://github.com/rui314/mold.git synced 2024-09-22 10:27:48 +03:00

temporary

This commit is contained in:
Rui Ueyama 2020-12-17 21:19:29 +09:00
parent 4f4d903b41
commit 10d23f945e
4 changed files with 8 additions and 8 deletions

View File

@ -3,7 +3,7 @@
InputChunk::InputChunk(ObjectFile *file, const ElfShdr &shdr, InputChunk::InputChunk(ObjectFile *file, const ElfShdr &shdr,
std::string_view name) std::string_view name)
: file(file), shdr(shdr), name(name), : file(file), shdr(shdr), name(name),
output_section(OutputSection::get_instance(name, shdr.sh_flags, shdr.sh_type)) {} output_section(OutputSection::get_instance(name, shdr.sh_type, shdr.sh_flags)) {}
static int get_rel_size(u32 r_type) { static int get_rel_size(u32 r_type) {
switch (r_type) { switch (r_type) {
@ -308,8 +308,8 @@ void InputSection::report_undefined_symbols() {
MergeableSection::MergeableSection(InputSection *isec, std::string_view data) MergeableSection::MergeableSection(InputSection *isec, std::string_view data)
: InputChunk(isec->file, isec->shdr, isec->name), : InputChunk(isec->file, isec->shdr, isec->name),
parent(*MergedSection::get_instance(isec->name, isec->shdr.sh_flags, parent(*MergedSection::get_instance(isec->name, isec->shdr.sh_type,
isec->shdr.sh_type)) { isec->shdr.sh_flags)) {
u32 offset = 0; u32 offset = 0;
while (!data.empty()) { while (!data.empty()) {

4
mold.h
View File

@ -347,7 +347,7 @@ public:
// Sections // Sections
class OutputSection : public OutputChunk { class OutputSection : public OutputChunk {
public: public:
static OutputSection *get_instance(std::string_view name, u64 flags, u32 type); static OutputSection *get_instance(std::string_view name, u32 type, u64 flags);
OutputSection(std::string_view name, u32 type, u64 flags) OutputSection(std::string_view name, u32 type, u64 flags)
: OutputChunk(REGULAR) { : OutputChunk(REGULAR) {
@ -553,7 +553,7 @@ private:
class MergedSection : public OutputChunk { class MergedSection : public OutputChunk {
public: public:
static MergedSection *get_instance(std::string_view name, u64 flags, u32 type); static MergedSection *get_instance(std::string_view name, u32 type, u64 flags);
static inline std::vector<MergedSection *> instances; static inline std::vector<MergedSection *> instances;
ConcurrentMap<StringPiece> map; ConcurrentMap<StringPiece> map;

View File

@ -502,7 +502,7 @@ void ObjectFile::convert_common_symbols() {
return; return;
static OutputSection *bss = static OutputSection *bss =
OutputSection::get_instance(".bss", SHF_WRITE | SHF_ALLOC, SHT_NOBITS); OutputSection::get_instance(".bss", SHT_NOBITS, SHF_WRITE | SHF_ALLOC);
for (int i = first_global; i < elf_syms.size(); i++) { for (int i = first_global; i < elf_syms.size(); i++) {
if (!elf_syms[i].is_common()) if (!elf_syms[i].is_common())

View File

@ -367,7 +367,7 @@ static std::string_view get_output_name(std::string_view name) {
} }
OutputSection * OutputSection *
OutputSection::get_instance(std::string_view name, u64 flags, u32 type) { OutputSection::get_instance(std::string_view name, u32 type, u64 flags) {
name = get_output_name(name); name = get_output_name(name);
flags = flags & ~(u64)SHF_GROUP; flags = flags & ~(u64)SHF_GROUP;
@ -614,7 +614,7 @@ void HashSection::copy_buf() {
} }
MergedSection * MergedSection *
MergedSection::get_instance(std::string_view name, u64 flags, u32 type) { MergedSection::get_instance(std::string_view name, u32 type, u64 flags) {
name = get_output_name(name); name = get_output_name(name);
flags = flags & ~(u64)SHF_MERGE & ~(u64)SHF_STRINGS; flags = flags & ~(u64)SHF_MERGE & ~(u64)SHF_STRINGS;