I have g++ code calling assembly code. This compiles in Centos 7 and works in Centos 7 & Rocky 9. However if I compile in Rocky 9 or Centos Stream 9 it fails and segmentation fault on first line of assembly line "mov r8, rdi". See below
Compile command
g++ -c -Wall -g -D_DEBUG -Dx86_64 -pthread -o cpuinfo.o cpuinfo.cppnasm -felf64 -o test1.o test1.asmg++ -L../../lib -ltsx64 -pthread -lefence -o cpuinfo cpuinfo.o test1.o
g++ code
extern "C" void get_cpuid_info(unsigned long *, const unsigned long func, const unsigned long subfunc);
get_cpuid_info(CPUIDreg.reg, 0, 0);
NASM code*******
Global get_cpuid_info
get_cpuid_info:
mov r8, rdi ;# array addr
mov r9, rsi ;# leaf
mov r10, rdx ;# subleaf
push rax
push rbx
push rcx
push rdx
mov rax, r9
mov rcx, r10
cpuid
mov dword [r8], eax
mov dword [r8+8], ebx
mov dword [r8+16], ecx
mov dword [r8+24], edx
pop rdx
pop rcx
pop rbx
pop rax
ret
It compiled successfully in Centos 7 with g++(v4.8.5-44) and NASM(v2.10.07). However when I compiled in a Centos stream 9 or Rocky 9 Linux it throws segmentation fault at the first assembly mov instructions
****get_cpuid_info:
mov r8, rdi ** **