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

Far-calling from NASM source to C results in "error: ELF format does not support segment base references" #60

Open
ecm-pushbx opened this issue Jul 7, 2020 · 4 comments

Comments

@ecm-pushbx
Copy link

This is a NASM feature request I submitted, to support calling C functions far with immediate calls from NASM: https://bugzilla.nasm.us/show_bug.cgi?id=3392694

@tkchia
Copy link
Owner

tkchia commented Aug 14, 2020

Hello @ecm-pushbx,

Yes, and sorry for the belated reply.

Well, there is no official support yet for IA-16 segment relocations in the ELF file format, and the actual relocation support I implemented into the gcc-ia16 toolchain is rather hacky.

A while back Mr. Anvin (nasm maintainer) actually proposed a way to represent IA-16 segment:offset addresses, which is more rigorous and flexible than the current default method. But there are a few problems:

  • it is incompatible with the current scheme (which is used by existing code, e.g. the FreeDOS kernel), and
  • Mr. Anvin has not really implemented the new method in nasm yet, as far as I know.

I wrote a brief write-up to summarize the situation.

So the situation with segment relocations in ELF object files is kind of messy, and I am not sure what the best way forward is.

Thank you!

(Edited to add: related discussion at a separate Bugzilla thread.)

@ecm-pushbx
Copy link
Author

Two of your links lead to the same document.

@tkchia
Copy link
Owner

tkchia commented Aug 14, 2020

(@ecm-pushbx : corrected; thanks!)

@roytam1
Copy link

roytam1 commented Jan 5, 2022

nasm bugzilla seems down

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants