Author Topic: identifier, label length  (Read 16206 times)

nobody

  • Guest
identifier, label length
« on: April 11, 2007, 07:16:30 PM »
I don't find in the manual anything which says what the length limit is on a Label.  I'd like to know if a label is significant to some number of characters, or if a long label is hashed in some fashion, say first 10 characters plus last 10 characters, or what?  I couldn't find anything related on a site search either.

for -f bin, if that matters.

TIA.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: identifier, label length
« Reply #1 on: April 11, 2007, 09:47:52 PM »
4095 - and AFAIK, the whole thing is hashed.

I vaguely recall adding this to the documentation... yep! It'll be in the next release. "When will that be?", you might ask. I dunno... if you care (enough), grab the latest from the CVS repository - or from Apple...

Best,
Frank

nobody

  • Guest
Re: identifier, label length
« Reply #2 on: April 27, 2007, 01:21:15 AM »
Thanks Frank,

Yes, I find it in the: nasm_man.chm, a nice addition BTW.  But it isn't really clear that all 4095 chrs are significant.  Some packages allow long identifiers but may internalize it as the first M chars plus the last N characters so that it is still possible to create non unique identifiers, and this too is a type of hashing.  It's not a very strong algorithm obviously.  I'd rather not dig down thru the source to find the algorithm, and was hoping someone knew offhand.

Best Regards,
Steve

nobody

  • Guest
Re: identifier, label length
« Reply #3 on: April 28, 2007, 06:45:54 AM »
The hash algorithm can be found in labels.c, in find_label().

In essence it sums all of a label's characters into an int, an
then uses % LABEL_HASHES (which expands to 37).

Which sucks big time.

See SF RFE #900810 for what I ended up implementing in NASM64.