+9640News Posted July 5, 2019 Share Posted July 5, 2019 I want to point out something that has taken me a very long time to finally identify. I had exit code that was doing a BLWP @0 on the Geneve 9640. The program has 5 different object files with numerous REF's and DEF's spread out in the files. In the first object file, I had used instructions like CLR @LABEL1 as well as MOV @LABEL1,@LABEL1. LABEL1 was REF'd in the first source file and DEF'd in a later object file. Use of the REF and DEF labels in some cases were after the use of the label and in some cases before the label. That was my mistake. I should have REF/DEF everything in the first source file of each object file. GenLINK did not resolve the location of LABEL1 in all places, so, something like CLR @LABEL1 was resolved to CLR @>0000. I had also used cases of SETO @LABEL1 as well. So, I had some cases where the correct location of LABEL1 was used, and some locations where it did not get resolved in my coding. I was going through numerous routines trying to chase down the issues when I finally tracked it down. Anyways, thought I would just point this out. Beery 3 1 Quote Link to comment Share on other sites More sharing options...
+Ksarul Posted July 5, 2019 Share Posted July 5, 2019 A most useful best practice. Many thanks, Beery. Quote Link to comment Share on other sites More sharing options...
+InsaneMultitasker Posted July 6, 2019 Share Posted July 6, 2019 Beery, could you clarify when the resolve fails? Does it only happen when the REF/DEF is after the first instance of the label? I'm a little confused as you mention source and object files almost interchangeably, though I think I know what you mean. I recall seeing some instances where MDOS source defines labels in strange places; I wonder if this is related to the problem you found or just a bad practice. Thanks for documenting this. Quote Link to comment Share on other sites More sharing options...
+9640News Posted July 6, 2019 Author Share Posted July 6, 2019 I had a number of source files to create one object file using the COPY directive. In one of the early source files, I had multiple instances of a label that was REFerenced later in the source files. One of the later object files had that label DEFined. When I went to link everything to create the program, some of those labels were not resolved, thus they used an address of >0000 instead of the real address. Now, I did not go and specifically create a short project to demonstrate that, but as soon as I moved all the requisite REF statements to the beginning of the source files, problems disappeared. It was bad practice, but something I learned the hard way. Beery 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.