[U-Boot] [PATCH v3 3/6] arm: provide a PCS-compliant setjmp implementation
Alexander Graf
agraf at suse.de
Sat Sep 23 00:48:52 UTC 2017
On 21.09.17 10:19, Philipp Tomsich wrote:
> The previous setjmp-implementation (as a static inline function that
> contained an 'asm volatile' sequence) was extremely fragile: (some
> versions of) GCC optimised the set of registers. One critical example
> was the removal of 'r9' from the clobber list, if -ffixed-reg9 was
> supplied.
I wouldn't call that fragile, but "works as intended". Gcc only saves
the registers it really needs to save - and if r9 is fixed it can safely
assume that between setjmp/longjmp it did not change.
Did you encounter other cases where it did something wrong?
> To increase robustness and ensure PCS-compliant behaviour, the setjmp
> and longjmp implementation are now in assembly and closely match what
> one would expect to find in a libc implementation.
I'm personally quite indifferent on which version we take, but I
personally found the inline asm version more readable. At least it was
half-way self-documenting and struct offset independent ;).
But again, I really don't have strong feelings. I only wrote the inline
asm version because we didn't have any implementation at all. If you opt
to maintain yours, be my guest :).
Alex
More information about the U-Boot
mailing list