Hi all,

I'm trying to model the SPEC HPC benchmark suite in gem5 with an x86 ISA
using KVM. As a result, I am trying to link the "_addr" version of the
m5ops against the binaries in order to model the region of interest.
Unfortunately, I get the following error when trying to build the sample
hello world example:

File contents (test.c): ```
#include <gem5/m5ops.h>
#include <m5_mmap.h>

int main(void) {
m5op_addr = 0xffff0000;
map_m5_mem();
m5_exit_addr(0);
return 0;
}
```

Error output: ```
$ gcc -o test test.c -I/gem5-include/ -I/m5-include/ -L/m5-out -lm5

/usr/bin/ld: /m5-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
-fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
```

The included headers from $(GEM5_DIR)/include are in the /gem5-include
directory, the m5 utility headers (required to include <m5_mmap.h>) are in
/m5-include, and the libraries and binaries are in /m5-out.

I added -fPIC to the CCFLAGS and CXXFLAGS of the SConscript in util/m5, but
this didn't change the error post compilation. I also tried adding -fno-pie
and get the error on compilation of the m5 binary instead:

```
LINK build/x86/test/bin/call_type/addr
/usr/bin/ld: build/x86/call_type/addr.test.to: relocation R_X86_64_32
against symbol `interceptEnv' can not be used when making a PIE object;
recompile with -fPIE
/usr/bin/ld: failed to set dynamic section sizes: bad value
collect2: error: ld returned 1 exit status
scons: *** [build/x86/test/bin/call_type/addr] Error 1'')
```

The error happens if I try to build natively on my Ubuntu 20.04 host
pointing to the files where they naturally are built in the base gem5
directory.

Any advice would be appreciated for where I may be going wrong on this!
Thank you in advance for your help!

Best,
Sam
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org

Reply via email to