mirror of
https://github.com/rui314/mold.git
synced 2024-12-28 02:44:48 +03:00
temporary
This commit is contained in:
parent
1290b49d60
commit
1b376cbd0f
59
main.cc
59
main.cc
@ -75,12 +75,18 @@ void read_file(MemoryMappedFile *mb, bool as_needed) {
|
|||||||
|
|
||||||
switch (get_file_type(mb)) {
|
switch (get_file_type(mb)) {
|
||||||
case OBJ: {
|
case OBJ: {
|
||||||
if (preloading)
|
if (preloading) {
|
||||||
cache[get_key(mb)] = {new_object_file(mb, "")};
|
cache[get_key(mb)] = {new_object_file(mb, "")};
|
||||||
else if (std::vector<ObjectFile *> objs = lookup(mb); !objs.empty())
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (std::vector<ObjectFile *> objs = lookup(mb); !objs.empty()) {
|
||||||
out::objs.push_back(objs[0]);
|
out::objs.push_back(objs[0]);
|
||||||
else
|
return;
|
||||||
out::objs.push_back(new_object_file(mb, ""));
|
}
|
||||||
|
|
||||||
|
message("reloading " + mb->name);
|
||||||
|
out::objs.push_back(new_object_file(mb, ""));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case DSO:
|
case DSO:
|
||||||
@ -90,24 +96,32 @@ void read_file(MemoryMappedFile *mb, bool as_needed) {
|
|||||||
if (preloading) {
|
if (preloading) {
|
||||||
for (MemoryMappedFile *child : read_fat_archive_members(mb))
|
for (MemoryMappedFile *child : read_fat_archive_members(mb))
|
||||||
cache[get_key(mb)].push_back(new_object_file(child, mb->name));
|
cache[get_key(mb)].push_back(new_object_file(child, mb->name));
|
||||||
} else if (std::vector<ObjectFile *> objs = lookup(mb); !objs.empty()) {
|
return;
|
||||||
append(out::objs, objs);
|
|
||||||
} else {
|
|
||||||
for (MemoryMappedFile *child : read_archive_members(mb))
|
|
||||||
out::objs.push_back(new_object_file(child, mb->name));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (std::vector<ObjectFile *> objs = lookup(mb); !objs.empty()) {
|
||||||
|
append(out::objs, objs);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
message("reloading " + mb->name);
|
||||||
|
for (MemoryMappedFile *child : read_archive_members(mb))
|
||||||
|
out::objs.push_back(new_object_file(child, mb->name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
case THIN_AR:
|
case THIN_AR:
|
||||||
if (preloading) {
|
if (preloading) {
|
||||||
for (MemoryMappedFile *child : read_thin_archive_members(mb))
|
for (MemoryMappedFile *child : read_thin_archive_members(mb))
|
||||||
cache[get_key(child)].push_back(new_object_file(child, mb->name));
|
cache[get_key(child)].push_back(new_object_file(child, mb->name));
|
||||||
} else {
|
return;
|
||||||
for (MemoryMappedFile *child : read_thin_archive_members(mb)) {
|
}
|
||||||
if (std::vector<ObjectFile *> objs = lookup(mb); !objs.empty())
|
|
||||||
out::objs.push_back(objs[0]);
|
for (MemoryMappedFile *child : read_thin_archive_members(mb)) {
|
||||||
else
|
if (std::vector<ObjectFile *> objs = lookup(mb); !objs.empty()) {
|
||||||
out::objs.push_back(new_object_file(child, mb->name));
|
out::objs.push_back(objs[0]);
|
||||||
|
} else {
|
||||||
|
message("reloading " + child->name);
|
||||||
|
out::objs.push_back(new_object_file(child, mb->name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -1083,12 +1097,27 @@ int main(int argc, char **argv) {
|
|||||||
for (std::string_view arg : config.version_script)
|
for (std::string_view arg : config.version_script)
|
||||||
parse_version_script(std::string(arg));
|
parse_version_script(std::string(arg));
|
||||||
|
|
||||||
|
#if 0
|
||||||
// Preload input files
|
// Preload input files
|
||||||
{
|
{
|
||||||
ScopedTimer t("preload");
|
ScopedTimer t("preload");
|
||||||
preloading = true;
|
preloading = true;
|
||||||
read_input_files(file_args);
|
read_input_files(file_args);
|
||||||
|
|
||||||
|
std::cerr << "waiting...\n";
|
||||||
|
|
||||||
|
int fd = open("/tmp/mold", O_RDONLY, 0777);
|
||||||
|
if (fd < 0) {
|
||||||
|
perror("open");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
char buf[1];
|
||||||
|
read(fd, buf, 1);
|
||||||
|
|
||||||
|
std::cerr << "resuming...\n";
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Parse input files
|
// Parse input files
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user