Operating System - HP-UX
1753599 Members
6256 Online
108796 Solutions
New Discussion

Determining Subspace for Symbols

 
Bill Rayl
New Member

Determining Subspace for Symbols

Hopefully, someone can clear this one up for me...it's driving me nuts! And hopefully, this post won't be too rambling, but it covers a lot of ground rather quickly without filling in all the territory.

I've read fairly thoroughly The 32-bit PA-RISC Run-time Architecture Document for both HP-UX 10.20 and 11.00, as well as the man entry for a.out and one thing still seems unclear to me.

According to the documentation for Symbol tables, if you have a Symbol where the symbol_type is ENTRY or CODE and the symbol_scope is UNIVERSAL, then the following should be true:

1. symbol_info should contain an index of the subspace that contains this Symbol

2. symbol_value is a byte offset within a space to an entry point (in other words, to the first executable instruction).

I have two examples below of the symbol_dictionary_record for the "main" Symbol from two separate programs. The first (type: CODE, scope: UNIVERSAL) seems to match with the docs just fine. The second (type: ENTRY, scope: UNIVERSAL), however, does not.

Example 1 (hex values):
Symbol Info = 000002
Symbol Value= 00002793

Example 2 (hex values):
Symbol Info = 00F224
Symbol Value= 0000F203

For example #1, I can verify that the Symbol belongs to Subspace #2 ($CODE$ in this case, which is in the $TEXT$ space) and its offset in the file is 2790 (the low-order 2 bits of Symbol Value get masked and hence the difference) bytes from the start of the $TEXT$ space.

For example #2, though, there aren't F224 Subspaces in the file. There are 24 spaces, but the appropriate Subspace ($CODE) is again at Subspace #2. The value F224 is, however, exactly the correct offset value to the first executable line of main from the start of the $TEXT$ space.

Looking at the Symbol Table output from nm, that util seems to understand that in example #1, the symbol_value/code offset is 2790 while for example #2 it's F224.

Here's the complete Symbol Table dictionary entry for example #2 (in hex):

06 30 0D 41 00 00 00 10 00 00 00 00 40 00 F2 24 00 00 F2 03

To save you some time, here are the binary breakouts for the first and 4th words above, with spaces appropriate to the symbol_dictionary_record structure (again, for HP-UX 11.0):

06300D41 =
0 0 000110 0011 000 0 0 0 0 0 11 0101000001

4000F224 =
0 1 0 00000 000000001111001000100100

What am I missing? Or, to put it another way, given the above Symbol Table info for example #2, how does one figure out to what Subspace that Symbol belongs and why is the symbol_value not a correct offset?

Here are additional details of the system I'm on:

PA-RISC Version : 2.0
System name : HP-UX
Version : A
Release : B.11.00
Machine : 9000/785

Thanks!

Bill Rayl
Source Retrieval
1 REPLY 1
Bill Rayl
New Member

Re: Determining Subspace for Symbols

Wouldn't you know it...an extra day of pouring over the executables and Symbol Tables and I figured out what my problem is.

It seems there are TWO entries in the Symbol Table dictionary for certain items, including "main". One is of type Entry (which can't be traced back to a Subspace) and the other is type Code...and that's the one I need to be looking at.

Thanks!

Bill Rayl
Source Retrieval