This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Offloading not relocatable


On Wed, Sep 17, 2014 at 04:21:42PM +0200, Jakub Jelinek wrote:
> So, I'd say that mkoffload should be using similar stuff like the gcc.c
> driver uses to find cc1 relative to the location of the gcc binary.

E.g. strace can tell where gcc driver is looking for cc1:
mv /usr/src/gcc-git/objinst/usr/local/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/cc1{,.xx}
strace -e access,stat /usr/src/gcc-git/objinst/usr/local/bin/gcc -fopenmp -o target-1.s target-1.c -S 
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or directory)
access("/usr/src/gcc-git/objinst/usr/local/bin/", X_OK) = 0
access("/usr/src/gcc-git/objinst/usr/local/bin/", X_OK) = 0
access("target-1.c", F_OK)              = 0
access("/usr/src/gcc-git/objinst/usr/local/bin/", X_OK) = 0
access("/usr/src/gcc-git/objinst/usr/local/bin/", X_OK) = 0
access("/usr/src/gcc-git/objinst/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.0.0/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/src/gcc-git/objinst/usr/local/bin/../lib/gcc/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/src/gcc-git/objinst/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.0.0/../../../../x86_64-unknown-linux-gnu/lib/x86_64-unknown-linux-gnu/5.0.0/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/src/gcc-git/objinst/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.0.0/../../../../x86_64-unknown-linux-gnu/lib/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/local/lib/gcc/x86_64-unknown-linux-gnu/specs", R_OK) = -1 ENOENT (No such file or directory)
access("/usr/src/gcc-git/objinst/usr/local/bin/", X_OK) = 0
stat("/usr/src/gcc-git/objinst/usr/local/bin/../libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/cc1", 0x7fff73be0aa0) = -1 ENOENT (No such file or directory)
stat("/usr/src/gcc-git/objinst/usr/local/bin/../libexec/gcc/cc1", 0x7fff73be0aa0) = -1 ENOENT (No such file or directory)
stat("/usr/src/gcc-git/objinst/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.0.0/../../../../x86_64-unknown-linux-gnu/bin/x86_64-unknown-linux-gnu/5.0.0/cc1", 0x7fff73be0aa0) = -1 ENOENT (No such file or directory)
stat("/usr/src/gcc-git/objinst/usr/local/bin/../lib/gcc/x86_64-unknown-linux-gnu/5.0.0/../../../../x86_64-unknown-linux-gnu/bin/cc1", 0x7fff73be0aa0) = -1 ENOENT (No such file or directory)
gcc: error trying to exec 'cc1': execvp: No such file or directory

mkoffload should make similar attempts to find the offloading compiler
driver.  It should try (relative to mkoffload binary) probably:
../../../../../bin/x86_64-intelmic-linux-gnu-g++
(why does it try g++ and not gcc btw?), then perhaps:
./x86_64-intelmic-linux-gnu-g++
(so that one can e.g. put a symlink next to mkoffload and point it wherever needed)
and perhaps as last fallback, try to execute x86_64-intelmic-linux-gnu-g++
from PATH env var.

	Jakub


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]