+cubanismo Posted July 29, 2020 Share Posted July 29, 2020 git clone http://shamusworld.gotdns.org/git/rln Quote Link to comment Share on other sites More sharing options...
ggn Posted July 29, 2020 Share Posted July 29, 2020 (edited) 1 hour ago, dilinger said: Hi, I think I've found an issue with RLN V1.6.1. If the options related to symbols are not used, the PSymbolTable and NumberOfSymbols fields in the coff will still be set. It will create a problem if the fields are used by a tool or a debugger, because no symbols will be found in the file. Could it be possible to fix this problem? If the source code is available on Git, please let me know, I will try to have a look at the issue. http://rmac.is-slick.com/ is actually the home page for both rmac and rln. If you want to take a look at the issue yourself, you'we more than welcome! You can also open a bug report at the rln bug tracker, if you have a repro case we could also have a look at it too. Edited July 29, 2020 by ggn Quote Link to comment Share on other sites More sharing options...
dilinger Posted July 29, 2020 Share Posted July 29, 2020 Thank you for the information. I have open a bug about it with repro steps. Please let me know if you need more information. Using the RLN -s option will add the symbols in the file but the offsets / values seem to not make sense. I will try to dig up before to open a different bug report. Quote Link to comment Share on other sites More sharing options...
swapd0 Posted August 3, 2020 Share Posted August 3, 2020 After some days off (maybe two weeks?), I've updated rmac to 2.0.12 and now I get an error when I try to compile my projects, I've this definition in the makefile: RMAC = rmac -fe -i/opt/local/bin/gcc68k/include;/Users/Shared/apps/Jaguar/projects/lib When I call make I get rmac -fe -i/opt/local/bin/gcc68k/include;/Users/Shared/apps/Jaguar/projects/lib -o obj/gpu.o gpu.s /bin/sh: /Users/Shared/apps/Jaguar/projects/lib: is a directory make: *** [obj/gpu.o] Error 126 Of course that it's a directory... Quote Link to comment Share on other sites More sharing options...
42bs Posted August 3, 2020 Share Posted August 3, 2020 (edited) 6 minutes ago, swapd0 said: After some days off (maybe two weeks?), I've updated rmac to 2.0.12 and now I get an error when I try to compile my projects, I've this definition in the makefile: RMAC = rmac -fe -i/opt/local/bin/gcc68k/include;/Users/Shared/apps/Jaguar/projects/lib When I call make I get rmac -fe -i/opt/local/bin/gcc68k/include;/Users/Shared/apps/Jaguar/projects/lib -o obj/gpu.o gpu.s /bin/sh: /Users/Shared/apps/Jaguar/projects/lib: is a directory make: *** [obj/gpu.o] Error 126 Of course that it's a directory... ";" is a command separator in *nix like OSes. You might either repeat "-i" or use ":" (guess) Or use " around your path. Edited August 3, 2020 by 42bs Quote Link to comment Share on other sites More sharing options...
LinkoVitch Posted August 3, 2020 Share Posted August 3, 2020 Is the ; semicolon in there as part of the path, as a separator or is it supposed to be to comment out the 2nd path? Quote Link to comment Share on other sites More sharing options...
swapd0 Posted August 3, 2020 Share Posted August 3, 2020 6 minutes ago, 42bs said: You might either repeat "-i" or use ":" (guess) Nope, I'm looking at rmac code and you can use -I option only one time, I've also tried with ':' but the code looks for a ";" 6 minutes ago, 42bs said: Or use " around your path. Ok, but now I've "invalid include path" error, and I've tested that both path exists... weird, I'll run rmac with the debugger. Quote Link to comment Share on other sites More sharing options...
42bs Posted August 3, 2020 Share Posted August 3, 2020 5 minutes ago, swapd0 said: Nope, I'm looking at rmac code and you can use -I option only one time, I've also tried with ':' but the code looks for a ";" Ok, but now I've "invalid include path" error, and I've tested that both path exists... weird, I'll run rmac with the debugger. Use the source, Luke: rmac supports only _one_ include path. 411 case 'I': 412 { 413 searchpath = argv[argno] + 2; 414 415 // Check to see if include paths actually exist 416 if (strlen(searchpath) > 0) 417 { 418 DIR * test = opendir(searchpath); 419 420 if (test == NULL) 421 { 422 printf("Invalid include path: %s\n", searchpath); 423 errcnt++; 424 return errcnt; 425 } 426 427 closedir(test); 428 } 429 430 break; 431 } Quote Link to comment Share on other sites More sharing options...
swapd0 Posted August 3, 2020 Share Posted August 3, 2020 21 minutes ago, 42bs said: Use the source, Luke: rmac supports only _one_ include path. 411 case 'I': 412 { 413 searchpath = argv[argno] + 2; 414 415 // Check to see if include paths actually exist 416 if (strlen(searchpath) > 0) 417 { 418 DIR * test = opendir(searchpath); 419 420 if (test == NULL) 421 { 422 printf("Invalid include path: %s\n", searchpath); 423 errcnt++; 424 return errcnt; 425 } 426 427 closedir(test); 428 } 429 430 break; 431 } Yes, I've just seen it... f*ck because they have changed the way it works, but there's a function called nthpath that looks for ';' to get multiple paths from a single argument. Quote Link to comment Share on other sites More sharing options...
42bs Posted August 3, 2020 Share Posted August 3, 2020 You might want to use rmac as back-end only and use "gcc -E" to pre-process the sources. The you can use all the nice stuff with #if and #define and #include. Quote Link to comment Share on other sites More sharing options...
swapd0 Posted August 3, 2020 Share Posted August 3, 2020 It looks that there are more changes, for example I've in a source file a label defined with two colons at the end, so it's supposed that the label it's global, this label it's referenced from a second file and I've an .extern directive at the beginning but I get a linker error of an undefined reference even if I put a .globl label in the first file. Quote Link to comment Share on other sites More sharing options...
ggn Posted August 3, 2020 Share Posted August 3, 2020 (edited) 46 minutes ago, swapd0 said: Yes, I've just seen it... f*ck because they have changed the way it works, but there's a function called nthpath that looks for ';' to get multiple paths from a single argument. Nope, no we haven't changed the way it works. We just added code that validates the paths entered. But sadly there were issues in the routine that validates the paths. A patch has been submitted, but not yet applied to main. If you like you can apply it and recompile. Also, I do appreciate the obscene language, makes it feel worth the trouble (Seriously, we try to never change functionality because it might break stuff for people. We're really concerned about this every time we extend the assembler to support more things) 26 minutes ago, swapd0 said: It looks that there are more changes, for example I've in a source file a label defined with two colons at the end, so it's supposed that the label it's global, this label it's referenced from a second file and I've an .extern directive at the beginning but I get a linker error of an undefined reference even if I put a .globl label in the first file. Repro case please, and we'll look into it. What is the problematic symbol's name? (asking because there is a known issue of symbols clashing with register names, especially now since we added DSP56001 mode. It's something that I hope will be resolved soon) Edited August 3, 2020 by ggn Quote Link to comment Share on other sites More sharing options...
swapd0 Posted August 3, 2020 Share Posted August 3, 2020 24 minutes ago, ggn said: Also, I do appreciate the obscene language, makes it feel worth the trouble Sorry 24 minutes ago, ggn said: Repro case please, and we'll look into it. What is the problematic symbol's name? The symbol name are _gpu_events_list, _GPU_SPRITE_OFFSET_X, _GPU_SPRITE_OFFSET_Y, and a few more, by the way the symbols are defined into a GPU chunk but referenced from 68000 code. I've also seen that I can't create a label name like "x" or "y" (it was a register equate), anyway I've changed them to cx or cy. No problem. Quote Link to comment Share on other sites More sharing options...
ggn Posted August 3, 2020 Share Posted August 3, 2020 6 minutes ago, swapd0 said: The symbol name are _gpu_events_list, _GPU_SPRITE_OFFSET_X, _GPU_SPRITE_OFFSET_Y, and a few more, by the way the symbols are defined into a GPU chunk but referenced from 68000 code. So, a small test case which we could try without doing (perhaps wrong) stuff at random and declaring it works is....? Quote Link to comment Share on other sites More sharing options...
swapd0 Posted August 3, 2020 Share Posted August 3, 2020 (edited) 27 minutes ago, ggn said: So, a small test case which we could try without doing (perhaps wrong) stuff at random and declaring it works is....? working on it. edited: by the way I'm using gcc linker, not rln but it worked with the older version of rmac. Edited August 3, 2020 by swapd0 Quote Link to comment Share on other sites More sharing options...
+cubanismo Posted August 3, 2020 Share Posted August 3, 2020 1 hour ago, 42bs said: ";" is a command separator in *nix like OSes. Any interest in a small patch to accept ":" as a command separator in addition to ";"? I've run into this as well. I also wish I could specify paths using the env variable and the command line and have rmac use the union of the two, kind of like you can do with spec files and "-I" in gcc. Any opposition to that? I could work up a patch. Quote Link to comment Share on other sites More sharing options...
Shamus Posted August 3, 2020 Share Posted August 3, 2020 (edited) If it's useful to your workflow, we wouldn't object. It will have to pass review though. EDIT: I believe this is addressed in bug#167. If it isn't, feel free to submit a patch. RMAC is now up to version 2.0.20. Edited August 3, 2020 by Shamus Should have checked the bug tracker first :-P Quote Link to comment Share on other sites More sharing options...
swapd0 Posted August 3, 2020 Share Posted August 3, 2020 (edited) It's not easy to write a small example, here it's what I have. - C/Asm library where I got some references to a GPU symbols that it's not compiled with the library, all GPU code files are copied into the include directory. - The game includes the library code - I have a gpu.s file like this: .include "jaguar/jaguar.inc" _gpu_code_start:: .gpu .org G_RAM movei #G_ENDRAM,r31 moveta r31,r31 .include "katu/gpu_event.s" .include "katu/gpu_sprite.s" This way I can include more files with gpu code specific to that game. These two files must be included, and gpu_event.s must be first. The game complies with no problem but I have linker errors for all symbols defined in gpu_event.s and gpu_sprite.s that are referenced from the library. edit: I've tried with .globl directive or with -u option but it have the same error, undefined reference. Edited August 3, 2020 by swapd0 Quote Link to comment Share on other sites More sharing options...
swapd0 Posted August 3, 2020 Share Posted August 3, 2020 I've compiled the just game (not the library) with the old version of rmac, and this is the output of nm with the gpu.o: swapd0$ nm obj/gpu.o 00f02200 a A1_BASE 00f02208 a A1_CLIP 00f02220 a A1_FINC ... 00f00000 a _BASE 00f0323c A _GPU_MAX_VIDEO_X 00f03240 A _GPU_MAX_VIDEO_Y 00f03234 a _GPU_SPRITE_OFFSETS 00f03234 A _GPU_SPRITE_OFFSET_X 00f03238 A _GPU_SPRITE_OFFSET_Y 00f03048 A _gpu_build_sprite_list 00000000 T _gpu_code_start 00f03008 A _gpu_events 00f03044 A _gpu_events_list 00f0322c A _gpu_sprite_dst 00f03096 a align_last_sprite 00f030bc a build_sprite 00f030ee a continue_build_sprite 00000011 A event_fn 00000012 A events 00000013 A list_ptr 00000010 A return The same thing with the new version of rmac, there are some labels without an address. swapd0$ nm obj/gpu.o 00f02200 a A1_BASE 00f02208 a A1_CLIP 00f02220 a A1_FINC 00f02204 a A1_FLAGS ... 00f00000 a _BASE U _GPU_MAX_VIDEO_X U _GPU_MAX_VIDEO_Y 00f03234 a _GPU_SPRITE_OFFSETS U _GPU_SPRITE_OFFSET_X U _GPU_SPRITE_OFFSET_Y U _gpu_build_sprite_list 00000000 T _gpu_code_start U _gpu_events U _gpu_events_list U _gpu_sprite_dst 00f03096 a align_last_sprite 00f030bc a build_sprite 00f030ee a continue_build_sprite U event_fn U events U list_ptr U return swapd0$ Quote Link to comment Share on other sites More sharing options...
ggn Posted August 4, 2020 Share Posted August 4, 2020 Right, after getting a good night's sleep the letters typed above start making sense :). We're still lacking more info about the symbols themselves. Can you give an example of how they're defined? The last thing we fixed in symbol exporting had to do with symbols that were EQUd and GLOBALd at the same time. Seems like here we've stepped into a edge case we haven't considered. Quote Link to comment Share on other sites More sharing options...
swapd0 Posted August 4, 2020 Share Posted August 4, 2020 (edited) I think that it mess around with .globl or :: directives to define a global symbol into GPU sections. .68000 nop lea m68k_foo,a0 nop .long m68k_foo: dc.l 0 m68k_bar: dc.l 0 .GPU .org $f03000 nop movei #gpu_foo,r0 nop .long gpu_foo: dc.l 0 Output: swapd0$ rmac -fe test.s -o out.elf swapd0$ nm out.elf 00f0300c a gpu_foo 00000010 t m68k_bar 0000000c t m68k_foo Now m68k_foo and gpu_foo are defined as global(: .68000 nop lea m68k_foo,a0 nop .long m68k_foo:: dc.l 0 m68k_bar: dc.l 0 .GPU .org $f03000 nop movei #gpu_foo,r0 nop .long gpu_foo:: dc.l 0 Output swapd0$ rmac -fe test.s -o out.elf swapd0$ nm out.elf U gpu_foo 00000010 t m68k_bar 0000000c T m68k_foo swapd0$ Last code using old version of rmac: swapd0$ rmac-old -fe test.s -o out.elf swapd0$ nm out.elf 00f0300c A gpu_foo 00000010 t m68k_bar 0000000c T m68k_foo Edited August 4, 2020 by swapd0 Quote Link to comment Share on other sites More sharing options...
ggn Posted August 4, 2020 Share Posted August 4, 2020 Okay, interesting. I'll definitely take a look at it soon (perhaps tomorrow). 1 Quote Link to comment Share on other sites More sharing options...
ggn Posted August 5, 2020 Share Posted August 5, 2020 Right, I might have fixed it. If you can compile your own rmac (I assume you can judging from the fact that you have patched it in the past), open object.c and go to lines 243 and 244 and comment them out. To be 100% clear, these should read: else if (globflag) st_shndx = 0; // Global, not absolute Then recompile and test. I checked and this code hasn't been touched since it was initially committed so when we added a fix for another issue (see above), the rmac listing reported your global/absolute symbol as: gpu_foo 0000000000F0300C ag (a=absolute, g=global) However the exported symbol needed the magic value fff1 (at least according to https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-94076.html#chapter6-tbl-16). Anyway, do try this out and tell us if it works so we can apply it to the main tree :). Quote Link to comment Share on other sites More sharing options...
ggn Posted August 5, 2020 Share Posted August 5, 2020 Also while I was at it, I submitted a patch for one of @dilinger's bug reports in post #75 Quote Link to comment Share on other sites More sharing options...
swapd0 Posted August 5, 2020 Share Posted August 5, 2020 (edited) 3 hours ago, ggn said: Right, I might have fixed it. If you can compile your own rmac (I assume you can judging from the fact that you have patched it in the past), open object.c and go to lines 243 and 244 and comment them out. To be 100% clear, these should read: else if (globflag) st_shndx = 0; // Global, not absolute Then recompile and test. I checked and this code hasn't been touched since it was initially committed so when we added a fix for another issue (see above), the rmac listing reported your global/absolute symbol as: gpu_foo 0000000000F0300C ag (a=absolute, g=global) However the exported symbol needed the magic value fff1 (at least according to https://docs.oracle.com/cd/E23824_01/html/819-0690/chapter6-94076.html#chapter6-tbl-16). Anyway, do try this out and tell us if it works so we can apply it to the main tree :). Done and it compiles the game, but I haven't tested it. Edited August 5, 2020 by swapd0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.