Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Restrictions on (object file/shareable image) symbol name

Derek Garson
Frequent Advisor

Restrictions on (object file/shareable image) symbol name

Can anyone tell me where the restrictions on a symbol name in an object file and shareable image are documented? If not, can anyone tell me what the restrictions are?

Broadly speaking, I am hoping that the information would cover

* maximum length

* character set

* permitted subset of character set

The answer is specifically sought for the Itanium platform. (However I wouldn't be averse to someone also pointing me at / giving me the answer for Alpha or VAX.)

I believe, but could be mistaken, that the format on the Itanium platform would be "ELF" but so far I have come up blank in finding out the answers for ELF.

Possibly ELF supplies no information on character set and imposes no restriction on permitted subset i.e. possibly the symbol name is an opaque octet string, but that is purely speculation on my part.
11 REPLIES
Robert Gezelter
Honored Contributor

Re: Restrictions on (object file/shareable image) symbol name

Derek,

Would I be too facetious if I suggested that the first place to look would be the LINKER manual on the OpenVMS www site?

- Bob Gezelter, http://www.rlgsc.com
Derek Garson
Frequent Advisor

Re: Restrictions on (object file/shareable image) symbol name

I looked in the HP OpenVMS Linker Utility
Manual. I didn't find the information. Section number?
John Gillings
Honored Contributor

Re: Restrictions on (object file/shareable image) symbol name

Derek,

This is one of those "it depends" questions. There are numerous entities which may be involved, including, but not necessarily constrained to, compiler, librarian and linker.

I believe the lowest common denominator across all platforms and languages is:

* maximum length = 31

* permitted subset of character set

A-Z 0-9 $ _

for some lanugage processors, symbols are case sensitive, but for others they're not.

I think your speculation about ELF, in general, is correct.

Not sure where (if at all) this would be documented. Maybe an email to John R?
A crucible of informative mistakes
Derek Garson
Frequent Advisor

Re: Restrictions on (object file/shareable image) symbol name

As far as "it depends" goes, I was specifically asking what the documentation says rather than what works (or does not work) in any particular component.

I dare say that you are correct about the lowest common denominator but a limit of 31 is not enough for languages that support overloading and use name mangling, unless those languages contain special hacks to account for the low limit, and I suspect strongly that the limit is higher on Itanium.

Not contradicting what you wrote but I am reasonably sure that some languages (e.g. Pascal) can generate symbols containing a dot character.

I have emailed John R.
H.Becker
Honored Contributor

Re: Restrictions on (object file/shareable image) symbol name

Right, ELF does not impose any restriction on the symbol name except there shouldn't be any C-style string terminator in the name. The VMS linker restricts the length to 1024 bytes. This limit is imposed by the implementation of librarian (as said in another thread in this forum). This limit is not doumented in the Linker manual, as far as I remember. But there is a strong hint in http://h71000.www7.hp.com/doc/84final/6677/6677pro_prog2.html.

Yes, these HTMLs are still available on the net. Although there seems to be no way to find them or to be pointed to them from the HP web site, Google can find them. Google IS your friend!

The length limit on Alpha is 64 bytes (again, this was mentioned in another thread). I don't know what's the limit on VAX, it is either 31 or 64. (Let me know where I can connect to a system and I'll find it out for you.) I don't know where these limits are documented.

The linker doesn't care what's in the name. When resolving symbols, the linker just looks for matches.

Whether any compiler supports the maximum length is a different question. I don't think that any VMS compiler on Itanium goes to the limit of 1024. But there are other compilers and the Intel assembler.

What's the underlying problem ?
Derek Garson
Frequent Advisor

Re: Restrictions on (object file/shareable image) symbol name

Yes, I found out that you need an old version (V7.3) of the Linker manual if you want the object file format specification for VAX and Alpha.

Spec says:

VAX - max length 31, charset ASCII

Alpha - max length 64, charset ASCII

This information appears to have been removed but never replaced by the current information (ELF).
Derek Garson
Frequent Advisor

Re: Restrictions on (object file/shareable image) symbol name

Unfortunately that URL leads to the underlying problem:

Permanent Restriction

"""The name of the symbol ... in a shareable image that you want to declare universal, using the SYMBOL_VECTOR linker option, must consist of ... the following characters:
uppercase and lowercase A through Z, the dollar sign ($), the underscore (_), and the DEC multinational characters with code greater than 192."""

Blerrch. That means that the LINKER will permanently be unable to process correctly valid ELF object files (as created by a third party compiler).

How hard would it be to accept a quoted string as an alternative to an identifier (as for example the IDENTIFICATION linker option does)?
Derek Garson
Frequent Advisor

Re: Restrictions on (object file/shareable image) symbol name

PS Word on the street is that this is not a new restriction and that it has been causing grief for some years. (Possibly ever since the inception of Alpha.)
H.Becker
Honored Contributor

Re: Restrictions on (object file/shareable image) symbol name

So I interpret that the problem is to export symbols which contain characters, other than "uppercase and lowercase A through Z, the dollar sign ($), the underscore (_), and the DEC multinational characters with code greater than 192".

As far as I remember, the linker uses tparse and tpa$_symbol for processing the symbol_vector= option. I don't know whether someone wants to change this.

If you want to hack the shareable image you can export place holders and PATCH/ABS your names. Without access to the linker sources, that's what I would try. But I don't know, whether that is worth the effort in your case.

Just out of curiosity, what's the non-VMS compiler and does the linker accept objects from it? The linker usually does not accept objects without the VMS ELF extensions.
WW304289
Frequent Advisor

Re: Restrictions on (object file/shareable image) symbol name

"
I dare say that you are correct about the lowest common denominator but a limit of 31 is not enough for languages that support overloading and use name mangling, unless those languages contain special hacks to account for the low limit, and I suspect strongly that the limit is higher on Itanium.
"

For C and C++, the limit is 31. Name mangling algorithm takes it into account, see below.

-Boris

$ cxx x.cxx
$ typ [.cxx_repository]cxx$demangler_db.
CX3$Z32A0123456780123456003J6HFvoid a0123456780123456789012345678901()
CX3$Z32A012345678012345626J35UQvoid a0123456780123456789012345678901(int)
$

x.cxx
-----
void a0123456780123456789012345678901() {}
void a0123456780123456789012345678901(int) {}

$ say f$length("a0123456780123456789012345678901")
32
$ say f$length("CX3$Z32A0123456780123456003J6HF")
31
$
Derek Garson
Frequent Advisor

Re: Restrictions on (object file/shareable image) symbol name

Closing - "permanent restriction"