Link stage fail if using Response file
shimmerhuangAMD opened this issue · 1 comments
Description
HCC would create a temp Response File under /tmp/response-xxx.txt to take the whole command line if the length of the command line does not fit in system limit. Then the clamp-link would expand the Response File and pass each command to host linker. However, linker would report a bunch of error:
ld: cannot find "-L/opt/rocm/hcc/bin/../lib": No such file or directory
ld: cannot find "--rpath=/opt/rocm/hcc/bin/../lib": No such file or directory
ld: cannot find "-ldl": No such file or directory
ld: cannot find "-lm": No such file or directory
ld: cannot find "-lpthread": No such file or directory
ld: cannot find "-lhc_am": No such file or directory
ld: cannot find "-lmcwamp": No such file or directory
ld: cannot find "--amdgpu-target=gfx900": No such file or directory
...
How to reproduce
-
Compile the sample code HelloWorld.cpp to generate helloworld.o HelloWorld.cpp.txt
hipcc -o helloworld.o -c HelloWorld.cpp
-
As response file is used to hold comand line > system limit(>60000), i force hcc to generate a response file when compile this sample code by slight changing the source code, I have the response file generated attached response-helloworld.txt, so this step could be skipped
-
Use clamp-link and Prebuilt Response File response-helloworld.txt
/opt/rocm/hcc/bin/clamp-link \@response-helloworld.txt
-
Output , full log is error.log
ld: cannot find "-L/opt/rocm/hcc/bin/../lib": No such file or directory
ld: cannot find "--rpath=/opt/rocm/hcc/bin/../lib": No such file or directory
ld: cannot find "-ldl": No such file or directory
ld: cannot find "-lm": No such file or directory
...
I'll provide a fix for review soon