harvard-acc / gem5-aladdin

End-to-end SoC simulation: integrating the gem5 system simulator with the Aladdin accelerator simulator.
BSD 3-Clause "New" or "Revised" License
210 stars 59 forks source link

/usr/bin/ld: /tmp/ccP7FT6j.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIC #30

Closed better1017 closed 3 years ago

better1017 commented 3 years ago

root@3f112d8239ca:/workspace/gem5-aladdin/src/aladdin/SHOC/triad# ls Makefile example triad.c triad.h root@3f112d8239ca:/workspace/gem5-aladdin/src/aladdin/SHOC/triad# make run-trace /workspace/LLVM-Tracer/bin/get-labeled-stmts triad.c -- -I/usr/local/lib/clang/6.0.0/include -I/workspace/gem5-aladdin/src/aladdin -I/workspace/gem5-aladdin/src/aladdin/SHOC/common/ -DLLVM_TRACE "/usr/local/bin/clang-6.0" "-cc1" "-triple" "x86_64-unknown-linux-gnu" "-emit-llvm" "-disable-free" "-disable-llvm-verifier" "-main-file-name" "triad.c" "-static-define" "-mrelocation-model" "static" "-mthread-model" "posix" "-fmath-errno" "-masm-verbose" "-mconstructor-aliases" "-munwind-tables" "-fuse-init-array" "-target-cpu" "x86-64" "-dwarf-column-info" "-debug-info-kind=limited" "-dwarf-version=4" "-debugger-tuning=gdb" "-momit-leaf-frame-pointer" "-coverage-notes-file" "/workspace/gem5-aladdin/src/aladdin/SHOC/triad/triad.gcno" "-resource-dir" "/usr/local/lib/clang/6.0.0" "-I" "/workspace/gem5-aladdin/src/aladdin" "-I" "/workspace/gem5-aladdin/src/aladdin/SHOC/common/" "-D" "LLVM_TRACE" "-I" "/workspace/gem5-aladdin/src/aladdin/gem5" "-D" "LLVM_TRACE" "-internal-isystem" "/usr/local/include" "-internal-isystem" "/usr/local/lib/clang/6.0.0/include" "-internal-externc-isystem" "/usr/include/x86_64-linux-gnu" "-internal-externc-isystem" "/include" "-internal-externc-isystem" "/usr/include" "-O1" "-fdebug-compilation-dir" "/workspace/gem5-aladdin/src/aladdin/SHOC/triad" "-ferror-limit" "19" "-fmessage-length" "0" "-fno-unroll-loops" "-fno-builtin" "-fno-inline" "-fobjc-runtime=gcc" "-fdiagnostics-show-option" "-o" "triad.llvm" "-x" "c" "triad.c" opt -S -load=/workspace/LLVM-Tracer/lib/full_trace.so -fulltrace -labelmapwriter triad.llvm -o triad-opt.llvm llvm-link -o full.llvm triad-opt.llvm /workspace/LLVM-Tracer/lib/trace_logger.llvm llc -O0 -disable-fp-elim -filetype=asm -o full.s full.llvm g++ -O0 -fno-inline -o triad-instrumented full.s -lm -lz -lpthread /usr/bin/ld: /tmp/ccP7FT6j.o: relocation R_X86_64_32 against `.rodata.str1.1' 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 ../common/Makefile.tracer:64: recipe for target 'triad-instrumented' failed make: *** [triad-instrumented] Error 1 root@3f112d8239ca:/workspace/gem5-aladdin/src/aladdin/SHOC/triad#

xyzsam commented 3 years ago

Sorry for the slow response. You just need to add -no-pie to the final g++ command. We updated our Docker image to use 18.04 as the base image, and in that image, gcc builds PIE binaries by default, which will fail if the object files are not PIE.

I will send a patch to fix this.

xyzsam commented 3 years ago

https://github.com/harvard-acc/ALADDIN/issues/35