Skip to content

Commit 09d4b4d

Browse files
committed
corrected ARM program entry point arithmetic
there was an assumption that the entry point would be in .text rather than using the section information in the symbol
1 parent 91de179 commit 09d4b4d

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

hardware/memory/cartridge/elf/memory.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -694,15 +694,7 @@ func (mem *elfMemory) runInitialisation(arm *arm.ARM) error {
694694
// the elf.File structure is no good for our purposes
695695
for _, s := range mem.symbols {
696696
if s.Name == "main" || s.Name == "elf_main" {
697-
// ".text.main" is emitted by the rust compiler, while ".text" is emitted by GCC
698-
// there must be a more robust way of finding the principal section
699-
sec, ok := mem.sectionsByName[".text.main"]
700-
if !ok {
701-
sec, ok = mem.sectionsByName[".text"]
702-
if !ok {
703-
return fmt.Errorf("ELF: could not find .text section")
704-
}
705-
}
697+
sec := mem.sections[s.Section]
706698
mem.resetPC = sec.origin + uint32(s.Value)
707699
mem.resetPC &= 0xfffffffe
708700
break // for loop

0 commit comments

Comments
 (0)