calling assembly functions from c

后端 未结 4 2044
不思量自难忘°
不思量自难忘° 2021-02-02 09:47

I\'m trying to use a function in assembly, invoked from a C project. This function is supposed to call a libc function let\'s say printf(), but I keep getting a se

4条回答
  •  日久生厌
    2021-02-02 10:39

    Change push printtext to push $printtext.

    As it is, you're loading a value from the address printtext and pushing that, rather than pushing the address. Thus, you're passing 'test' as a 32-bit number, rather than a pointer, and printf is trying to interpret that as an address and crashing.

提交回复
热议问题