Only dump metadata for used targets
This commit is contained in:
parent
bef55c1266
commit
c57b3f03a3
@ -44,3 +44,6 @@ Plugin is per compilation unit
|
|||||||
-> structs with same name can habe different definitions in different CUs (disallow this for now)
|
-> structs with same name can habe different definitions in different CUs (disallow this for now)
|
||||||
-> anonymous structs can not really be matched between CUs without type hash (disallow this for now)
|
-> anonymous structs can not really be matched between CUs without type hash (disallow this for now)
|
||||||
-> later, use hash(type) to match structs between CUs to randomize as one
|
-> later, use hash(type) to match structs between CUs to randomize as one
|
||||||
|
|
||||||
|
Symbols must be object symbols because untyped/function symbols cause objtool issues in kernel build
|
||||||
|
-> can not find starting instruction of function
|
||||||
|
|||||||
@ -5,6 +5,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
#include <unordered_set>
|
||||||
|
|
||||||
#include <safe-input.h>
|
#include <safe-input.h>
|
||||||
#include <safe-output.h>
|
#include <safe-output.h>
|
||||||
@ -153,9 +154,24 @@ void on_finish_unit(void* plugin_data, void* user_data) {
|
|||||||
|
|
||||||
out << "SPSLR " << get_src_file() << " " << cu_uid << std::endl;
|
out << "SPSLR " << get_src_file() << " " << cu_uid << std::endl;
|
||||||
|
|
||||||
// Dump all target structs
|
// Construct set of all targets that are used by at least 1 ipin or dpin
|
||||||
|
|
||||||
|
std::unordered_set<UID> used_targets;
|
||||||
|
|
||||||
|
for (const DataPin& dpin : DataPin::all()) {
|
||||||
|
for (const DataPin::Component& c : dpin.components)
|
||||||
|
used_targets.insert(c.target);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto& [uid, ipin] : s2_pins())
|
||||||
|
used_targets.insert(ipin.target);
|
||||||
|
|
||||||
|
// Dump all USED target structs
|
||||||
|
|
||||||
for (const auto& [uid, target] : TargetType::all()) {
|
for (const auto& [uid, target] : TargetType::all()) {
|
||||||
|
if (used_targets.find(uid) == used_targets.end())
|
||||||
|
continue;
|
||||||
|
|
||||||
// target <name> <local uid> <size> <field count>
|
// target <name> <local uid> <size> <field count>
|
||||||
out << "target " << target.name() << " " << uid << " " << target.size()
|
out << "target " << target.name() << " " << uid << " " << target.size()
|
||||||
<< " " << target.fields().size() << std::endl;
|
<< " " << target.fields().size() << std::endl;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user