Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Hi I would like to tell gcc how to call functions, for example:

    __mycall void my_function(arg1) {
        do_something(arg1)
    }
    __mycall:
        move $a0, (the first argument)
        jalr (the function we should call)
        nop

I would like the generated assembly code of:


    my_function(1);

To be


    move $a0, 1
    jalr my_function
    nop

I obviously don't want to implement stdcall or fastcall or something like that, i just explained by an example.

I don't think it should be hard to do that but I don't find any example on how to do that I can write inline assembly and call my function with inline assembly but it is ugly, I will appreciate help (:

question from:https://stackoverflow.com/questions/65645610/how-to-make-change-gcc-calling-convention

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
257 views
Welcome To Ask or Share your Answers For Others

1 Answer

Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...