MCPcopy Create free account
hub / github.com/N64Recomp/N64Recomp / add_reference_symbol

Method add_reference_symbol

include/recompiler/context.h:428–455  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

426 }
427
428 bool add_reference_symbol(const std::string& symbol_name, uint16_t section_index, uint32_t vram, bool is_function) {
429 uint32_t section_vram;
430
431 if (section_index == SectionAbsolute) {
432 section_vram = 0;
433 }
434 else if (section_index < reference_sections.size()) {
435 section_vram = reference_sections[section_index].ram_addr;
436 }
437 // Invalid section index.
438 else {
439 return false;
440 }
441
442 // TODO Check if reference_symbols_by_name already contains the name and show a conflict error if so.
443 reference_symbols_by_name.emplace(symbol_name, N64Recomp::SymbolReference{
444 .section_index = section_index,
445 .symbol_index = reference_symbols.size()
446 });
447
448 reference_symbols.emplace_back(N64Recomp::ReferenceSymbol{
449 .name = symbol_name,
450 .section_index = section_index,
451 .section_offset = vram - section_vram,
452 .is_function = is_function
453 });
454 return true;
455 }
456
457 void add_import_symbol(const std::string& symbol_name, size_t dependency_index) {
458 // TODO Check if dependency_imports_by_name[dependency_index] already contains the name and show a conflict error if so.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected