Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

long label names bug #12

Open
dvanhorn opened this issue Jul 6, 2023 · 0 comments
Open

long label names bug #12

dvanhorn opened this issue Jul 6, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@dvanhorn
Copy link
Member

dvanhorn commented Jul 6, 2023

According to the NASM docs: Maximum length of an identifier is 4095 characters.

What they mean is "only the first 4095 characters are used in an identifier," so you don't get an assembly-time error if you have a label name that exceeds this bound, it just truncates the label to the first 4095 characters.

This is problematic for our compiler starting with Iniquity since labels are derived from user-provided function names. If you define two very long function names that are only distinguished from each other after the character limit, then you'll get a "inconsistently redefined" error from NASM.

This may seem unlikely for function names and could potentially be considered a static error or something, but it's more problematic for string literals, which also derive label names.

The solution seems to be to change symbol->label and symbol->data-label to truncate the string before appending the unique eq hash code on the end.

@dvanhorn dvanhorn added the bug Something isn't working label Jul 6, 2023
@dvanhorn dvanhorn transferred this issue from cmsc430/cmsc430.github.io Oct 29, 2024
@dvanhorn dvanhorn transferred this issue from cmsc430/a86 Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant