[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Help needed for small assembler script for the iraf package



On 20.10.2018 22:21, James Clarke wrote:
> On 20 Oct 2018, at 20:05, Ole Streicher <olebole@debian.org> wrote:
>>> (*) Literally:
>>>  $ sed 's/sigsetjmp_placeholder@plt/__sigsetjmp@plt/g' test.s >
>>> zsvjmp-riscv64.s
>>
>> I am a bit surprised, since for the correct function, one must replace
>> the "call subroutine" (or whatever it is called on risc64) instruction
>> by a "jump to address" instruction, otherwise it won't work. That change
>> is the main reason why assembler is needed (otherwise, one could just
>> use the C function).
>>
>> Did you change this, or is there some hidden magic?
> 
> With a sufficient optimisation level, any decent compiler will be able to
> optimise this to a tail call, as was done here (the "tail" pseudo-instruction;
> a normal call would use "call" followed by a return instruction), but it's not
> something that can be relied upon, hence the need for assembly.

Ahh, now I understand. Thanks for the explanation! This is probably also
the reason why Manuel did not use sigsetjmp in the C call but a
placeholder (the compiler may know that sigsetjmp calls must nor be
optimized).

Thanks again to Manuel and Stefan for this! I'll try to upload a new
release ASAP (with tests, so we know whether it works correctly).

Cheers

Ole



Reply to: