ggnkua / brownout-git

A humble .elf to ST .prg binary converter
8 stars 1 forks source link

Assert during processing #2

Open n0kturnal opened 1 year ago

n0kturnal commented 1 year ago

Hi, I'm currently using laatest brownout and I've got following output, assert:

note: reloc [toslink] refers to non-existent elf section
R_68K_PC32: eVA:$001b7a eSec[.text] eSecVA:$000000 (tVA:$001b82 tSecVA:$000024) -> r_sym[_amCustomPrintf] r_eVA:$00354a r_eSec[.text] r_eSecVA:$000000 r_eSecVAE:$0061de (r_tVA:$003552 r_tSecVA:$000008)
R_68K_PC32: eVA:$001bd8 eSec[.text] eSecVA:$000000 (tVA:$001be0 tSecVA:$000024) -> r_sym[_amCustomPrintf] r_eVA:$00354a r_eSec[.text] r_eSecVA:$000000 r_eSecVAE:$0061de (r_tVA:$003552 r_tSecVA:$000008)
R_68K_PC32: eVA:$001c38 eSec[.text] eSecVA:$000000 (tVA:$001c40 tSecVA:$000024) -> r_sym[_amCustomPrintf] r_eVA:$00354a r_eSec[.text] r_eSecVA:$000000 r_eSecVAE:$0061de (r_tVA:$003552 r_tSecVA:$000008)
R_68K_PC32: eVA:$001f8c eSec[.text] eSecVA:$000000 (tVA:$001f94 tSecVA:$000024) -> r_sym[_amFilesystemDeinit] r_eVA:$003f06 r_eSec[.text] r_eSecVA:$000000 r_eSecVAE:$0061de (r_tVA:$003f0e r_tSecVA:$000008)
R_68K_PC32: eVA:$00458c eSec[.text] eSecVA:$000000 (tVA:$004594 tSecVA:$000024) -> r_sym[_memset] r_eVA:$006c6c r_eSec[CODE] r_eSecVA:$0061de r_eSecVAE:$007054 (r_tVA:$006c74 r_tSecVA:$0061e6)
R_68K_PC32: eVA:$0045f2 eSec[.text] eSecVA:$000000 (tVA:$0045fa tSecVA:$000024) -> r_sym[_memcpy] r_eVA:$006c20 r_eSec[CODE] r_eSecVA:$0061de r_eSecVAE:$007054 (r_tVA:$006c28 r_tSecVA:$0061e6)
R_68K_PC32: eVA:$00468a eSec[.text] eSecVA:$000000 (tVA:$004692 tSecVA:$000024) -> r_sym[_getCM32LRhythmName] r_eVA:$0061b6 r_eSec[.text] r_eSecVA:$000000 r_eSecVAE:$0061de (r_tVA:$0061be r_tSecVA:$000008)
assertion "_va >= reference_bound->second.first" failed: file "brownout.cpp", line 402, function: std::map<unsigned int, std::pair<unsigned int, int> >::iterator get_section_for_va(elfsectionboundsmap_t&, uint32_t)
                                                     entrypoint located at eVA:$00197e (tVA:$001986)
note: reloc [toslink] refers to non-existent elf section

Application compiles just fine with aout and brownelf compilers (gcc 12.2.0), maybe it's an issue with application itself, can't tell anything from this assert output. I'm using brownout version "ecru" under Cygwin/x64.

ggnkua commented 1 year ago

Oops, I didn't get a notification for this.

I have experienced some issues lately as well, as gcc for some reason adds an .info section that contains the compiler version as plain text, which isn't stripped, so brownout gets confused. I will dig up a fix I did for this locally later and will get back to you.

n0kturnal commented 1 year ago

No problem, thanks for reply. If it's known problem then it's ok :).

ggnkua commented 1 year ago

Right, again, sorry for the delay.

What I did to solve the problem I was having is the following:

m68k-atarimegabrowner-elf-objcopy.exe --remove-section .init input.elf output.elf

And then I fed output.elf to brownout. So if you could try this and tell me that it works for you, I'll have a go at making brownout handle this section automatically (because I haven't yet found a way to suppress this section)

n0kturnal commented 1 year ago

Sorry for late reply. I've checked this remove section trick, but it didn't work for me (it looks that presence of .init isn't the case here). It would be great if some kind of error was displayed if unsupported section has been found (name at least). It looks like this crash occurs in my release builds, not debug.

ggnkua commented 1 year ago

I'm sorry this didn't fix your problem. I guess I could create a new build that adds more meaningful errors so we can track down the issue. I'll try to do this tomorrow/

n0kturnal commented 1 year ago

No worries, I test on two compiler versions (brownelf and traditional aout), so it's not a blocker for me. Thanks for toolchain! :)

ggnkua commented 1 year ago

I just pushed a commit that at least tries to identify the problematic section for you, and filters out .init sections by default.

n0kturnal commented 1 year ago

I've retried with fawn version, here is output log (it's release, nolibc configuration): /opt/m68k-ataritos/brownelf/bin/brownout -i build/brownelf/release/ymout.elf -o /cygdrive/k/Repos/atari/amidilib/build/brownelf/release/ymout.tos entrypoint located at eVA:$006ef8 (tVA:$006f00) note: reloc [toslink] refers to non-existent elf section R_68K_PC32: eVA:$001b3a eSec[.text] eSecVA:$000000 (tVA:$001b42 tSecVA:$000024) -> r_sym[_amCustomPrintf] r_eVA:$00356e r_eSec[.text] r_eSecVA:$000000 r_eSecVAE:$006200 (r_tVA:$003576 r_tSecVA:$000008) R_68K_PC32: eVA:$001b98 eSec[.text] eSecVA:$000000 (tVA:$001ba0 tSecVA:$000024) -> r_sym[_amCustomPrintf] r_eVA:$00356e r_eSec[.text] r_eSecVA:$000000 r_eSecVAE:$006200 (r_tVA:$003576 r_tSecVA:$000008) R_68K_PC32: eVA:$001bf8 eSec[.text] eSecVA:$000000 (tVA:$001c00 tSecVA:$000024) -> r_sym[_amCustomPrintf] r_eVA:$00356e r_eSec[.text] r_eSecVA:$000000 r_eSecVAE:$006200 (r_tVA:$003576 r_tSecVA:$000008) R_68K_PC32: eVA:$001f4c eSec[.text] eSecVA:$000000 (tVA:$001f54 tSecVA:$000024) -> r_sym[_amFilesystemDeinit] r_eVA:$003f2a r_eSec[.text] r_eSecVA:$000000 r_eSecVAE:$006200 (r_tVA:$003f32 r_tSecVA:$000008) R_68K_PC32: eVA:$0045ae eSec[.text] eSecVA:$000000 (tVA:$0045b6 tSecVA:$000024) -> r_sym[_memset] r_eVA:$006c8e r_eSec[CODE] r_eSecVA:$006200 r_eSecVAE:$007076 (r_tVA:$006c96 r_tSecVA:$006208) R_68K_PC32: eVA:$004614 eSec[.text] eSecVA:$000000 (tVA:$00461c tSecVA:$000024) -> r_sym[_memcpy] r_eVA:$006c42 r_eSec[CODE] r_eSecVA:$006200 r_eSecVAE:$007076 (r_tVA:$006c4a r_tSecVA:$006208) R_68K_PC32: eVA:$0046ac eSec[.text] eSecVA:$000000 (tVA:$0046b4 tSecVA:$000024) -> r_sym[_getCM32LRhythmName] r_eVA:$0061d8 r_eSec[.text] r_eSecVA:$000000 r_eSecVAE:$006200 (r_tVA:$0061e0 r_tSecVA:$000008) assertion "_va >= reference_bound->second.first" failed: file "brownout.cpp", line 418, function: std::map<unsigned int, std::pair<unsigned int, int> >::iterator get_section_for_va(elfsectionboundsmap_t&, uint32_t) entrypoint located at eVA:$00197e (tVA:$001986) note: reloc [toslink] refers to non-existent elf section

Other build configurationa didn't crash and outputted some extra errors, so it's little better..