| Home | Forums | What's new | Resources | |
| converting SGL from COFF to ELF |
| RockinB - May 9, 2005 |
| RockinB | May 10, 2005 | ||
| I got the linking done with ELF. The MAP file got a new section called .rodata. Anyone knows what this is? It's only 8 Bytes long and starts at 0x54. That's why my sl.bin is about 100 MB when I use objcopy. I removed that section, but the binary didn't work in Satourne. So I gues I need to edit the link script to move the section elsewhere.... | |||
| RockinB | May 10, 2005 | ||
| The elf binary produces an error when running in Saturnin and Satourne emulators. I have no clue yet why the elf binary doesn't work, but the coff binary does. Here is a file with binary, map and disassembly of the elf and coff version of SGL's DEMO_A: [attachmentid=1259] If anyone can give me a hint. I don't know much about the differences in a elf and coff toolchain. | |||
| RockinB | May 11, 2005 | ||
| I guess it's the ELF version of SGL which makes the DEMO_A binary crash. But I won't verify that by compiling a SBL example now. (vbt, did you use SGL startup code in your SBL apps?) Aother conversion option: Anyone thought of re-assembling the SGL? If as can optimize, we could possibly speed it up. Problem is just to generate asm from object files with objdump, which would need some AWK preprocessing... (well, I've tried that on a simple file by hand) Anyways, I'll focus on COFF for now. Now I'm looking for some good tutorials. Any suggestions? Question: How to do DOS commands like copy, move in a makefile (unix mode)? | |||
| vbt | May 12, 2005 | |||
Not at all, I rebuilt and corrected everything needed to boot a SBL sample. I thought you had already manage to do this task. I found that not so easy, I could give you the objects needed to start a SBL app (strt_g.o or something like that) | ||||
| antime | May 12, 2005 | ||
| I don't know offhand what the problem is, but converting unlinked objects is even less guaranteed to work than fully linked ones. I wouldn't worry about the different flags, AFAIK the HAS_LOCALS flag is COFF-specific. There is no problem with the files being marked as "sh4", . The main use is to differentiate the files from the 64-bit sh5. The ".rodata" section is defined in the ELF specification, and is intended for read-only data. As you noticed, sections not assigned a location in your link script will be placed starting at location zero. What script did you use? Copying files etc. in your makefiles is done just like compiling. Make doesn't care about what commands it's generating. | |||
| RockinB | May 12, 2005 | |||
It's the first time I really tried to deal with SBL. Do you know the difference between: strt1_g.src, strt1_h.src strt2_g.c strt2_h.c <!--QuoteBegin-a ntime@Thu, 2005-05-12 @ 09:30 PM I don't know offhand what the problem is, but converting unlinked objects is even less guaranteed to work than fully linked ones. I wouldn't worry about the different flags, AFAIK the HAS_LOCALS flag is COFF-specific. There is no problem with the files being marked as "sh4", . The main use is to differentiate the files from the 64-bit sh5. The ".rodata" section is defined in the ELF specification, and is intended for read-only data. As you noticed, sections not assigned a location in your link script will be placed starting at location zero. What script did you use? Copying files etc. in your makefiles is done just like compiling. Make doesn't care about what commands it's generating. [post=133956]Quoted post[/post] [/quote] Ah, thanks. I've just added the .rodata section to the linkscript between SLSTART and .text. What's exactly meant by unlinked objects? Well, I've included both ELF and COFF versions above. I can't find what's causing the crash in Saturnin by myself. This will take some time to figure out, maybe I will try a simple SBL example first. Make just complains: make.exe: copy:Command not found I guess make runs in sh.exe. Couldn't find a copy command in sh.exe --help Doesn't work. Maybe I try putting a batch file into the binary folder. edit: I could workaround that problem but strange: if using unix mode, it doesn't find DOS commands, but mkisofs, if using win32 mode, it does find DOS commands, but not mkisofs | ||||
| vbt | May 13, 2005 | |||
I know I use only strt1_g.o and strt2_g.o . On a previous topic (not sure), il was supposed that H meant Hitachi and G for GCC. .src were renamed .s and assembled with GASM even if I still have a ASMSH.EXE in my folder. | ||||
| vbt | May 7, 2019 | ||
| bump this old topic, is there a working elf sgl lib somewhere ? slinitsystem fails at start addr there is also a small difference : | |||
| vbt | May 8, 2019 | |||
| it seems it looses PC address, any idea ? if i compare elf VS coff it gives only one difference : The working code is on the right. Code:
| ||||
| vbt | May 11, 2019 | ||
| it's not perfect but the issue happens on slInitSystem first action is it restores r8 to r14 using the stack i did a manual step by step | |||
| vbt | May 12, 2019 | ||
| issue fixed, the problem is the the converted objects but the linker and ld parameters. | |||
| cafe-alpha | May 15, 2019 | ||
| Good job !! And the title at the bottom on the screen (@XL2... walking on the same steps as @RockinB..., or even ahead ?) looks promising | |||
| vbt | May 15, 2019 | ||
| here are the little secrets : remove "-Xlinker --format=coff-sh" from the makefile (ld flags) add in the header of the linker script : OUTPUT_FORMAT(coff- sh) use only libs converted to elf | |||
| kronikoverkill | Apr 30, 2023 | ||
| Wow, I'm deeply thankful for this thread. Was banging my head against the wall on this. I also had isolated the issue to slinitsystem() but couldn't figure out what the issue was. Randomly, some demos would compile fine and work prior to the linker script change noted above, specifically if the debug library was included in code. So bizarre. Thanks for this!!! | |||
| vbt | May 1, 2023 | |||
some relocations are bad and slinitsystem loops, there is a way to fix the lib but it's not easy | ||||
| kronikoverkill | May 1, 2023 | |||
What are your initial thoughts on that? I'd love to understand any theories behind this. I tried multiple GNU SH compilers too just to ensure it wasn't a compiler issue. | ||||
| vbt | May 2, 2023 | ||
| you have to add 0x40 to all function address, something like that | |||