Hello,
I found this interesting issue in binutils v2.38.
The following code works perfectly fine in ubuntu 20.04 (binutils v2.34)
content of asm_program.asm:
.global main
.text
main:
mov $message, %rdi
call c_function
ret
.data
#where the message is stored
message: .ascii "Hello World\n\0"
content of c_function.c:
#include <stdio.h>
void c_function(const char* message)
{
puts(message);
return;
}
compilation code:
$ as asm_program.asm -o asm_program.o
$ gcc -c c_function.c -o c_function.o
$gcc -no-pie asm_program.o c_function.o -o myprogram
Currently, this code is giving me a segmentation fault error in ubuntu 22.04 but works perfectly fine in ubuntu 20.04.
Regards,
Arpan