summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPikalaxALT <pikalaxalt@gmail.com>2021-12-17 20:45:17 -0500
committerPikalaxALT <pikalaxalt@gmail.com>2021-12-17 20:45:17 -0500
commit44cd7753b5dde323d1e8274b2dc8a5599729e83f (patch)
treeb9f90f7b047b3dc5a411dbf65117bf07b237a37d
parent3fd325f0aa9d7ad402c77c596ef7d0b38d50803f (diff)
Fix calcrom
-rw-r--r--.github/calcrom/BuildAnalyzer.cpp35
-rw-r--r--arm9/Makefile3
2 files changed, 22 insertions, 16 deletions
diff --git a/.github/calcrom/BuildAnalyzer.cpp b/.github/calcrom/BuildAnalyzer.cpp
index ef2b5089..4fc36d81 100644
--- a/.github/calcrom/BuildAnalyzer.cpp
+++ b/.github/calcrom/BuildAnalyzer.cpp
@@ -8,6 +8,9 @@
string default_version("");
void BuildAnalyzer::AnalyzeObject(path fname_s) {
+#ifndef NDEBUG
+ cerr << fname_s << endl;
+#endif //NDEBUG
string ext = fname_s.extension();
SourceType sourceType = ext == ".s" ? SOURCE_ASM : SOURCE_C;
fname_s = builddir / relative(fname_s, srcbase);
@@ -25,9 +28,9 @@ void BuildAnalyzer::AnalyzeObject(path fname_s) {
if (sectionType != SECTION_OTHER) {
sizes[sectionType][sourceType] += (hdr.sh_size + 3) & ~3;
auto data = elf.ReadSectionData<unsigned>(hdr);
-#ifndef NDEBUG
- unordered_set<unsigned> unique_addrs;
-#endif
+//#ifndef NDEBUG
+// unordered_set<unsigned> unique_addrs;
+//#endif
for (const auto & word : data) {
if (word == 0) {
continue; // might be a relocation
@@ -35,19 +38,19 @@ void BuildAnalyzer::AnalyzeObject(path fname_s) {
if (find_if(program.GetProgramHeaders().cbegin(), program.GetProgramHeaders().cend(), [&word](const auto & phdr) {
return phdr.p_vaddr <= word && word < phdr.p_vaddr + phdr.p_memsz;
}) != program.GetProgramHeaders().cend()) {
-#ifndef NDEBUG
- unique_addrs.insert(word);
-#endif
+//#ifndef NDEBUG
+// unique_addrs.insert(word);
+//#endif
n_hardcoded++;
}
}
-#ifndef NDEBUG
- if (!version.empty()) {
- for (const auto & word : unique_addrs) {
- cerr << "hardcoded " << version << " pointer to " << hex << word << endl;
- }
- }
-#endif
+//#ifndef NDEBUG
+// if (!version.empty()) {
+// for (const auto & word : unique_addrs) {
+// cerr << "hardcoded " << version << " pointer to " << hex << word << endl;
+// }
+// }
+//#endif
} else if (hdr.sh_type == SHT_RELA) {
n_relocations += elf.GetSectionElementCount<Elf32_Rela>(hdr);
}
@@ -87,9 +90,11 @@ BuildAnalyzer &BuildAnalyzer::operator()() {
if (analyzed) {
reset();
}
- string pattern = srcbase.string() + "/{src,asm,lib/{src,asm},lib/{!syscall}/{src,asm}}/*.{c,s,cpp}";
+ string pattern = srcbase.string() + "/{src,asm,lib/{src,asm},lib/*/{src,asm},modules/*/{asm,src}}/*.{c,s,cpp}";
for (char const * & fname : Glob(pattern, GLOB_TILDE | GLOB_BRACE | GLOB_NOSORT)) {
- AnalyzeObject(fname);
+ if (string(fname).find("lib/syscall/") == string::npos) {
+ AnalyzeObject(fname);
+ }
}
analyzed = true;
return *this;
diff --git a/arm9/Makefile b/arm9/Makefile
index ce3a85e0..58f1c35c 100644
--- a/arm9/Makefile
+++ b/arm9/Makefile
@@ -229,8 +229,9 @@ $(CXX_OBJS): $(BUILD_DIR)/%.o: %.cpp $$(dep)
$(S_OBJS) $(LIBS_OBJS): $(BUILD_DIR)/%.o: %.s $$(dep)
$(AS) $(MWASFLAGS) -o $@ $<
+# Bugfix note: zsh doesn't like escapes
$(BUILD_DIR)/$(LD_TEMPLATE): $(BUILD_DIR)/%: %
- (echo "KEEP_SECTION\n{\n\t.exceptix\n}\n"; cat $<) > $@
+ (printf "KEEP_SECTION\n{\n\t.exceptix\n}\n"; cat $<) > $@
$(BUILD_DIR)/$(LD_SCRIPT): $(LD_SPEC) $(BUILD_DIR)/$(LD_TEMPLATE)
$(MAKELCF) $(MAKELCF_FLAGS) $^ $@