Function calls: PLT vs GOTPCREL

I noticed, while looking at some generated code on godbolt, that something changed in function calls between stable (1.30) and beta (1.31), and I was wondering if that was a deliberate change and if yes, where I could read about it.

The difference is that with stable, function calls look like:

call example::foo@PLT

while in beta, they look like:

call qword ptr [rip + example::foo@GOTPCREL]

A notable difference between the two is that in the former case, the symbol resolution will happen at first-call time (except when linked with bindnow), while in the second, it will happen at startup.

Interestingly, while this changed on x86-64, this didn’t change on x86.

3 Likes

I don't know why x86 would be missing though.

FWIW, bindnow is also on by default for most targets.

2 Likes

x86 (32-bit) doesn’t have PC-relative addressing

2 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.