mirror of
https://github.com/autc04/Retro68.git
synced 2025-01-13 01:30:55 +00:00
Name CODE resources, it's just cooler
This commit is contained in:
parent
68c43b7a39
commit
c757fb9520
@ -60,6 +60,8 @@ size_t mainStringTableIdx = (size_t)-1;
|
||||
class Symtab;
|
||||
class Section;
|
||||
|
||||
SegmentMap segmentMap;
|
||||
|
||||
Elf *elf;
|
||||
std::vector<int> relocs;
|
||||
unique_ptr<Symtab> symtab;
|
||||
@ -747,8 +749,12 @@ void MultiSegmentApp(string output)
|
||||
std::cout << "... empty. Skipping.\n";
|
||||
continue;
|
||||
}
|
||||
|
||||
string segmentName = segmentMap.GetSegmentName(id);
|
||||
|
||||
rsrc.addResource(Resource(ResType("CODE"), id,
|
||||
code.str()));
|
||||
code.str(),
|
||||
segmentName));
|
||||
|
||||
|
||||
rsrc.addResource(Resource(ResType("RELA"),id, sec->GetAbsRelocations(true)));
|
||||
@ -874,12 +880,11 @@ int main(int argc, char *argv[])
|
||||
ofstream out(tmpfile);
|
||||
if(segments)
|
||||
{
|
||||
SegmentMap map;
|
||||
map.CreateLdScript(out);
|
||||
map.CreateLdScript(std::cout);
|
||||
segmentMap.CreateLdScript(out);
|
||||
segmentMap.CreateLdScript(std::cout);
|
||||
|
||||
ofstream f("/tmp/foo.ld");
|
||||
map.CreateLdScript(f);
|
||||
segmentMap.CreateLdScript(f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -18,6 +18,16 @@ SegmentMap::SegmentMap()
|
||||
"*/libgcc.a:*",
|
||||
"*/libc.a:*"
|
||||
);
|
||||
segments.emplace_back(5, "libstdc++ locale",
|
||||
"*/libstdc++.a:locale.o",
|
||||
"*/libstdc++.a:locale_faces.o",
|
||||
"*/libstdc++.a:locale_init.o");
|
||||
segments.emplace_back(7, "libstdc++ locale-inst",
|
||||
"*/libstdc++.a:locale-inst.o");
|
||||
segments.emplace_back(8, "libstdc++ wlocale-inst",
|
||||
"*/libstdc++.a:wlocale-inst.o");
|
||||
segments.emplace_back(6, "libstdc++ cp-demangle",
|
||||
"*/libstdc++.a:cp-demangle.o");
|
||||
segments.emplace_back(3, "libstdc++",
|
||||
"*/libstdc++.a:*");
|
||||
segments.emplace_back(4, "RetroConsole",
|
||||
@ -26,3 +36,13 @@ SegmentMap::SegmentMap()
|
||||
segments.emplace_back(2, "Main",
|
||||
"*");
|
||||
}
|
||||
|
||||
std::string SegmentMap::GetSegmentName(int id)
|
||||
{
|
||||
for(auto& seg : segments)
|
||||
{
|
||||
if(seg.id == id)
|
||||
return seg.name;
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
@ -8,13 +8,13 @@ class SegmentInfo
|
||||
{
|
||||
public:
|
||||
int id;
|
||||
//std::string name;
|
||||
std::string name;
|
||||
std::vector<std::string> filters;
|
||||
SegmentInfo();
|
||||
|
||||
template<typename... Args>
|
||||
SegmentInfo(int id, std::string name, Args... args)
|
||||
: id(id), filters { args... }
|
||||
: id(id), name(name), filters { args... }
|
||||
{
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ public:
|
||||
SegmentMap();
|
||||
|
||||
void CreateLdScript(std::ostream& out);
|
||||
std::string GetSegmentName(int id);
|
||||
};
|
||||
|
||||
#endif // SEGMENTMAP_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user