Open yxy-whu opened 1 year ago
Hi. We need more information to help. When you create a bug report on https://github.com/DynamoRIO/dynamorio/issues/new/choose, it presents a template with questions about the DR version, build environment. Please provide that information:
- What version of DynamoRIO are you using?
- Does the latest build from https://github.com/DynamoRIO/dynamorio/releases solve the problem?
- What operating system version are you running on? ("Windows 10" is *not* sufficient: give the release number.)
- Is your application 32-bit or 64-bit?
Please also share the compiler version and it'd help if you could share the complete output from cmake in a https://gist.github.com link.
One thing you can try is to create the build
dir outside the dynamorio
source dir. So the second step onwards would look like:
mkdir build && cd build
cmake ../dynamorio
make
The Github Actions CI is Ubuntu 20.04 and cc 9.4.0 (https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2004-Readme.md) -- how is your setup different? Different CMake version?
Which target hits the error?
This relocation error is typically from asm code: I would suggest zeroing in on the precise sequence of assembly code that triggers it (binary search by modifying the target is a brute force method) and maybe it can be fixed with an asm-level PIC usage change. It may not be likely anyone else can reproduce this since it doesn't reproduce on the GA CI which is the same setup it seems.
The DynamoRIO i compiled is the latest version (9.91.19432) My operating system is ubuntu20.04 x86_64
Thanks for you help, but this problem still happens. And the details are as follows:
Scanning dependencies of target opcode_mix_launcher
[ 52%] Building CXX object clients/drcachesim/CMakeFiles/opcode_mix_launcher.dir/tools/opcode_mix_launcher.cpp.o
[ 52%] Linking CXX executable ../bin64/opcode_mix_launcher
/usr/bin/ld: ../../lib64/libdrfrontendlib.a(dr_frontend_common.c.o): relocation R_X86_64_32 against '.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
/usr/bin/ld: ../../lib64/libdrfrontendlib.a(dr_frontend_unix.c.o): relocation R_X86_64_32 against '.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
collect2: error: ld returned 1 exit status
make[2]: *** [clients/drcachesim/CMakeFiles/opcode_mix_launcher.dir/build.make:103: clients/bin64/opcode_mix_launcher] Error 1
make[1]: *** [CMakeFiles/Makefile2:1375: clients/drcachesim/CMakeFiles/opcode_mix_launcher.dir/all] Error 2 make: *** [Makefile:152: all] Error 2
The opcode_mix_launcher hits the error.
Given that this does not reproduce on other Ubuntu 20.04 x86_64 machines (like our GA CI regression test machines):
A) There is something different about your toolchain: you may want to compare to the GA CI (see the link I provided above) to figure out what
B) We can't reproduce this so you would have to figure this out yourself: one brute-force method is to binary search through dr_frontend_unix.c by removing pieces of it or moving them to another file or something to find the precise piecesof code causing this. I don't think there's any assembly in that file which makes this surprising.
I compiled it as follows: 1) git clone --recursive https://github.com/DynamoRIO/dynamorio.git 2)cd dynamorio && mkdir build && cd build 3)cmake .. 4) make but i get a error about: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
And then i try to add "-no-pie" and "fPIE" in "BASE_CXXONLY_FLAGS" of CMakeLists.txt, but it can't help