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

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



Hi Manuel (and Stefan),

first Thank you very much for digging into this!

On 20.10.2018 20:36, Manuel A. Fernandez Montecelo wrote:
> [...]
> and with this command: gcc -c -O2 -ffreestanding -S test.c
> 
> We get to this:
> ===========================================
> ==> test.s <==
> [...]>         tail    sigsetjmp_placeholder@plt
> ===========================================
> 
> ...and changing the name of the funtion in the assembly to
> __sigsetjmp@plt and the name of the file to zsvjmp-riscv64.s (*):
> 
> ===========================================
> .../zsvjmp $ make test
> as   -o zsvjmp-riscv64.o zsvjmp-riscv64.s
> ar cr libzsvjmp.a zdojmp.o zsvjmp-riscv64.o
> gfortran -o jmptest jmptest.o -L. -lzsvjmp
> gcc -g -g -o zzdebug zzdebug.o -L. -lzsvjmp
> ./zzdebug
> Status = 0, step = 0
> Calling zdojmp
> Status = 1, step = 1
> All OK
> ./jmptest
>  Status =                     0 step =                     0
>  Calling zdojmp
>  Status =                     1 step =                     1
>  All OK
> STOP 0
> ===========================================
> 
> (*) 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?

>> However, I have no idea how to write the same for the 64-bit platform
>> riscv64. Maybe someone could help me here? Preferably under the IRAF
>> license [3], so that it can be included upstream later.
> 
> It's output from the compiler for code that you posted, so I'd say
> "sure" without even looking to the text of the license...

At least, a trivial change is needed; so better assign a license :-)
Just FYI, it is a MIT style license.

Best regards

Ole


Reply to: