Hi all, I'm trying to use the address version of m5ops with x86, to use it with X86KvmCPU. I compiled the x86 libm5.a following the docs: https://www.gem5.org/documentation/general_docs/m5ops/. I'm using the m5_exit_addr.c from gem5-resources (https://gem5.googlesource.com/public/gem5-resources/+/refs/tags/v20.1.0.5/src/simple/m5_exit_addr.c) as a test example.
When trying to compile the example I get: $ gcc -c m5_exit_addr.c -o m5_exit_addr.o -I/home/pedro/gem5/include -I/home/pedro/gem5/util/m5/src -DM5OP_ADDR=0xFFFF0000 $ gcc m5_exit_addr.o -o m5_exit_addr -L/home/pedro/gem5/util/m5/build/x86/out -lm5 /usr/bin/ld: /home/pedro/gem5/util/m5/build/x86/out/libm5.a(m5op_addr.o): relocation R_X86_64_32S against symbol `m5_mem' can not be used when making a PIE object; recompile with -fPIE collect2: error: ld returned 1 exit status make: *** [Makefile:6: m5_exit_addr] Error 1 The same compilation steps work for aarch64, so I guess it's an x86 ABI-dependent problem (?). Also, recompiling the application with -fPIE, as suggested, does not solve it. Perhaps because the lib is compiled with the -no-pie flag (util/m5/src/SConscript). Adding the -static flag to the link step solves the problem. But my real target application (not the m5_exit_addr.c which I'm using just to test) links against many dynamic libraries, and I cannot force the use of the -static flag. Also, trying to statically link libm5.a only (by indicating the complete/path/to/libm5.a or with -Wl,-Bstatic -lm5) results in the same error. A previous gem5 discussion suggested using an up-to-date version of gem5/m5 (https://www.mail-archive.com/gem5-users@gem5.org/msg18730.html), which I think it's not my case since I get errors with both version 20.1.0.5 (stable branch, same as the m5_exit_addr.c resource) and version 21.0.0.0 (develop branch). That said... Am I missing something to use the libm5 correctly? Is there any known workaround to use the m5ops_addr when we also need to dynamically link other libraries to our application in x86_64? Thank you in advance for any suggestions! Best, Pedro. _______________________________________________ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s