Page MenuHomeFreeBSD

Do not use b.cs instruction to jump to cerror
ClosedPublic

Authored by kan on Apr 7 2017, 3:28 PM.

Details

Summary

The conditional jump can only be performed tp targets up to 1MB in
either direction and does not work too well when linker places cerror
further that that from the caller. In that case linker will complain
about relocation overflows.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

kan created this revision.Apr 7 2017, 3:28 PM
andrew edited edge metadata.Apr 7 2017, 3:32 PM

Can you add a comment to point out why we use the b.cs ; ret ; b sequence.

imp added inline comments.Apr 7 2017, 3:34 PM
lib/libc/aarch64/SYS.h
54 ↗(On Diff #27179)

why not use b cerror directly?

andrew added inline comments.Apr 7 2017, 3:38 PM
lib/libc/aarch64/SYS.h
54 ↗(On Diff #27179)

How? We still need to check the process state as that's how syscalls signal failure.

emaste accepted this revision as: emaste.Apr 7 2017, 3:54 PM

This LGTM with @andrew's note addressed, probably just make a comment out of a short version of the explanation that's in the Phabricator summary?

Also, with luck a future version of the linker will insert a thunk by itself when necessary, and we could then revert this.

This revision is now accepted and ready to land.Apr 7 2017, 3:54 PM
This revision was automatically updated to reflect the committed changes.