[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference noted::hackers_v1

Title:-={ H A C K E R S }=-
Notice:Write locked - see NOTED::HACKERS
Moderator:DIEHRD::MORRIS
Created:Thu Feb 20 1986
Last Modified:Mon Aug 03 1992
Last Successful Update:Fri Jun 06 1997
Number of topics:680
Total number of notes:5456

592.0. "Linker option problem" by EAGLE1::DANTOWITZ (David - BXB1-1/E11 DTN: 293-5356) Wed Oct 28 1987 13:25

I've received no response in the VMSNOTES library, perhaps someone here
can help out.  

[The data must be at the fixed locations so that the program can also run
without VMS and without VAX memory management.]

Thanks,
	David
 
	   
           <<< VAXWRK::NOTES$DEVICE:[NOTES$LIBRARY]VMSNOTES.NOTE;1 >>>
================================================================================
Note 1676.0                    LINK option problem                     2 replies
EAGLE1::DANTOWITZ "David - BXB1-1/E11 DTN: 293-5356" 89 lines  22-OCT-1987 10:43
--------------------------------------------------------------------------------


   I have an image that requires several arrays to be at fixed locations
   in the virtual address space.  I presently use one of two methods to
   accomplish this: 

   1)  Declare the data structures in specific PSECT's and tell the
       linker where to base each PSECT.  (option file 1)

   2)  Base the entire image after the addresses reserved for the
       data structures and then use CRETVA to map the virtual address
       space.  (option file 2)


   Both of these methods work fine for the fixed location arrays.  The
   problem I have comes about with some user system services that
   are also linked in.  

   Using option file 2 the system services are linked properly.  Using
   option file 1 the system services are NOT linked properly.  In fact
   what appears to happen with option file 1 is that the calls to the
   system services are missing one level of indirection.

   After the two option files I've included the information from the
   two link maps.

   I'm lost.  Hope someone can help out.

David

File 1                                         File 2

CLUSTER = T_cl,%X19000                  BASE = %X96000
COLLECT = T_cl,T_psect                  CLUSTER=USS,,,USS$DIR:Uss/SHARE
CLUSTER = P_cl,%X7C800
COLLECT = P_cl,P_psect
CLUSTER = M_cl,%X80C00
COLLECT = M_cl,M_psect
CLUSTER = J_cl, %X81000
COLLECT = J_cl,Junk_psect
CLUSTER=USS,,,USS$DIR:Uss/SHARE

MAP information using option file 1

                                             +------------------------+
                                             ! Image Section Synopsis !
                                             +------------------------+

   Cluster      Type Pages   Base Addr  Disk VBN PFC Protection and Paging      Global Sec. Name   Match     Majorid   Minorid
   -------      ---- -----   ---------  -------- --- ---------------------      ----------------   -----     -------   -------

USS                4     1  P-00000000-R        0   0 READ ONLY                  USS_001          LESS/EQUAL        1         1
                   4     1  P-00000200-R        0   0 READ ONLY                  USS_002          LESS/EQUAL        1         1


                                             +------------------------+
                                             ! Symbol Cross Reference !
                                             +------------------------+

Symbol                          Value           Defined By                 Referenced By ...
------                          -----           ----------                 -----------------
USS$A                           00000248-RX      USS                         ABC   
USS$B                           0000024C-RX      USS                         UTIL       
USS$C                           00000250-RX      USS                         ABC



MAP information using option file 2

                                             +------------------------+
                                             ! Image Section Synopsis !
                                             +------------------------+

   Cluster      Type Pages   Base Addr  Disk VBN PFC Protection and Paging      Global Sec. Name   Match     Majorid   Minorid
   -------      ---- -----   ---------  -------- --- ---------------------      ----------------   -----     -------   -------

USS                4     1  P-0015A600          0   0 READ ONLY                  USS_001          LESS/EQUAL        1         1
                   4     1  P-0015A800          0   0 READ ONLY                  USS_002          LESS/EQUAL        1         1



                                             +------------------------+
                                             ! Symbol Cross Reference !
                                             +------------------------+

Symbol                          Value           Defined By                 Referenced By ...
------                          -----           ----------                 -----------------
USS$A                           0015A610         USS                         ABC
USS$B                           0015A600         USS                         UTIL                  
USS$C                           0015A608         USS                         ABC                   

T.RTitleUserPersonal
Name
DateLines
592.1Make the code position-independant!JON::MORONEYQuestion Authority (and Authority will question you)Thu Oct 29 1987 12:0512
re .0:

I don't know how to use the linker in such a way, but you may want to look into
using the position-independant features of the VAX instruction set. Code
produced in this way will run anywhere in memory.  This way you won't care if
VMS is running, memory mapping is on, etc.

For example, to reference something that looks like  FOO:  .BLKW 100, use
MOVAW FOO,R5 instead of MOVL #FOO,R5 since the first instruction only depends
on the offset of FOO from the instruction and not the absolute position of FOO.

-Mike
592.2F(A)=G(A), but F<>GEAGLE1::DANTOWITZDavid - BXB1-1/E11 DTN: 293-5356Thu Oct 29 1987 12:4711
Thanks for the suggestion.  Unfortunately it's not possible. 

The code itself is not position dependent.  The opcodes and operand
specifiers are explicit, not their function.  The program is a type of
diagnostic/exerciser and the instructions and addresses are all checked
for consistency.  MOVAW FOO,R5 is not equivalent to MOVL #F00,R5 because
it is a different instruction. 

I'm still looking for a LINKER guru.

David