Remix.run Logo
Joker_vD 3 days ago

> You're always going to pay the same price. An indirection.

There is a difference between indirecting through a register, or through a memory (which in the end also requires a register, in addition to a memory load). On the other hand, I$ is more precious, and the most popular parts of GOT are likely to be in the voluminous D$ anyhow, so it's hard to tell which is more efficient.

> Or statically define all those addresses within your binary. That seems more "elegant" to you?

Of course not. I personally think a directly specifiable 64-bit offset from the base register that holds the start of the data section is more elegant. But dynamic libraries don't mesh too well with this approach although IIRC it has been tried.

> you'll have none of the features the loader can provide for you. At that point just statically link all your dependencies and call it an early day.

This works surprisingly well in practice, actually. Data relocations are still an issue though.