Fixed a bug in libtool_wrapper_for_cuda.tcl to handle correct compilation of -fPIC objects
This commit is contained in:
parent
4e6bd40f19
commit
2e1384c763
|
|
@ -1,7 +1,7 @@
|
||||||
#!/usr/bin/tclsh
|
#!/usr/bin/tclsh
|
||||||
|
|
||||||
if {$argc == 0} {
|
if {$argc == 0} {
|
||||||
puts "Usage: 'libtool_wrapper_for_cuda.tcl' 'filename' 'compilation line'"
|
puts "Usage: 'libtool_wrapper_for_cuda.tcl' 'filename' '-static | -shared' 'compilation line'"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -15,14 +15,15 @@ if {[lindex $argv 1] == "-static"} {
|
||||||
set command [lrange $argv 2 end]
|
set command [lrange $argv 2 end]
|
||||||
append command " -o $filename"
|
append command " -o $filename"
|
||||||
} else {
|
} else {
|
||||||
file mkdir .libs
|
file mkdir [file dirname $filename_o]/.libs
|
||||||
set filename ".libs/${filename_o}"
|
set filename "[file dirname $filename_o]/.libs/[file tail $filename_o]"
|
||||||
set command [lrange $argv 2 end]
|
set command [lrange $argv 2 end]
|
||||||
append command " -Xcompiler -fPIC"
|
append command " -Xcompiler -fPIC"
|
||||||
append command " -o $filename"
|
append command " -o $filename"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Compile
|
# Compile
|
||||||
|
#puts "Executing: $command"
|
||||||
exec /bin/sh -c $command
|
exec /bin/sh -c $command
|
||||||
|
|
||||||
# Determine the libtool version (including compiler version)
|
# Determine the libtool version (including compiler version)
|
||||||
|
|
@ -36,7 +37,7 @@ foreach elem $output {
|
||||||
|
|
||||||
# Generate the .lo libtool object file
|
# Generate the .lo libtool object file
|
||||||
set fid [open $filename_lo w]
|
set fid [open $filename_lo w]
|
||||||
puts $fid "# $filename_lo - a libtool object file"
|
puts $fid "# [file tail $filename_lo] - a libtool object file"
|
||||||
puts $fid "# Generated by libtool $version"
|
puts $fid "# Generated by libtool $version"
|
||||||
puts $fid "#"
|
puts $fid "#"
|
||||||
puts $fid "# Please DO NOT delete this file!"
|
puts $fid "# Please DO NOT delete this file!"
|
||||||
|
|
@ -50,7 +51,7 @@ if {[lindex $argv 1] == "-static"} {
|
||||||
puts $fid "non_pic_object='[file tail $filename]'"
|
puts $fid "non_pic_object='[file tail $filename]'"
|
||||||
} else {
|
} else {
|
||||||
puts $fid "# Name of the PIC object."
|
puts $fid "# Name of the PIC object."
|
||||||
puts $fid "pic_object='[file tail $filename]'"
|
puts $fid "pic_object='.libs/[file tail $filename]'"
|
||||||
puts $fid ""
|
puts $fid ""
|
||||||
puts $fid "# Name of the non-PIC object"
|
puts $fid "# Name of the non-PIC object"
|
||||||
puts $fid "non_pic_object=none"
|
puts $fid "non_pic_object=none"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue