mirror of
https://github.com/rui314/mold.git
synced 2024-11-13 09:39:13 +03:00
temporary
This commit is contained in:
parent
d6d6225046
commit
57fa2e0e61
13
main.cc
13
main.cc
@ -765,6 +765,19 @@ int main(int argc, char **argv) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// __start_ and __stop_ symbols
|
||||
for (OutputChunk *chunk : output_chunks) {
|
||||
if (!is_c_identifier(chunk->name))
|
||||
continue;
|
||||
|
||||
Symbol *start = Symbol::intern(("__start_" + chunk->name).str());
|
||||
start->input_section = chunk->sections[0];
|
||||
|
||||
Symbol *stop = Symbol::intern(("__stop_" + chunk->name).str());
|
||||
stop->input_section = chunk->sections[0];
|
||||
stop->addr = chunk->shdr.sh_size;
|
||||
}
|
||||
}
|
||||
|
||||
// Fix regular symbol addresses.
|
||||
|
2
mold.h
2
mold.h
@ -427,6 +427,8 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
bool is_c_identifier(StringRef name);
|
||||
|
||||
namespace out {
|
||||
extern OutputEhdr *ehdr;
|
||||
extern OutputShdr *shdr;
|
||||
|
@ -419,7 +419,7 @@ bool ObjectFile::is_in_archive() {
|
||||
return !archive_name.empty();
|
||||
}
|
||||
|
||||
static bool is_c_identifier(StringRef name) {
|
||||
bool is_c_identifier(StringRef name) {
|
||||
if (name == "")
|
||||
return false;
|
||||
if (!isalpha(name[0]) && name[0] != '_')
|
||||
@ -470,12 +470,13 @@ ObjectFile *ObjectFile::create_internal_file(ArrayRef<OutputChunk *> output_chun
|
||||
out::__preinit_array_end = add("__preinit_array_end", STB_LOCAL);
|
||||
|
||||
for (OutputChunk *chunk : output_chunks) {
|
||||
if (is_c_identifier(chunk->name)) {
|
||||
auto *start = new std::string(("__start_" + chunk->name).str());
|
||||
auto *stop = new std::string(("__stop_" + chunk->name).str());
|
||||
add(*start, STB_GLOBAL);
|
||||
add(*stop, STB_GLOBAL);
|
||||
}
|
||||
if (!is_c_identifier(chunk->name))
|
||||
continue;
|
||||
|
||||
auto *start = new std::string(("__start_" + chunk->name).str());
|
||||
auto *stop = new std::string(("__stop_" + chunk->name).str());
|
||||
add(*start, STB_GLOBAL);
|
||||
add(*stop, STB_GLOBAL);
|
||||
}
|
||||
|
||||
obj->elf_syms = *elf_syms;
|
||||
|
Loading…
Reference in New Issue
Block a user