1999-05-03 15:29:11 +08:00
|
|
|
# Basic expect script for LD Regression Tests
|
2021-01-01 06:58:58 +08:00
|
|
|
# Copyright (C) 1993-2021 Free Software Foundation, Inc.
|
1999-05-03 15:29:11 +08:00
|
|
|
#
|
2007-07-06 22:09:45 +08:00
|
|
|
# This file is part of the GNU Binutils.
|
|
|
|
#
|
1999-05-03 15:29:11 +08:00
|
|
|
# This file is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
2007-07-06 22:09:45 +08:00
|
|
|
# the Free Software Foundation; either version 3 of the License, or
|
1999-05-03 15:29:11 +08:00
|
|
|
# (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software
|
2007-07-06 22:09:45 +08:00
|
|
|
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
|
|
|
# MA 02110-1301, USA.
|
1999-05-03 15:29:11 +08:00
|
|
|
#
|
|
|
|
# Written by Jeffrey Wheat (cassidy@cygnus.com)
|
|
|
|
#
|
|
|
|
|
|
|
|
if ![info exists ld] then {
|
|
|
|
set ld [findfile $base_dir/ld-new $base_dir/ld-new [transform ld]]
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists as] then {
|
|
|
|
set as [findfile $base_dir/../gas/as-new $base_dir/../gas/as-new [transform as]]
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists nm] then {
|
|
|
|
set nm [findfile $base_dir/../binutils/nm-new $base_dir/../binutils/nm-new [transform nm]]
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists objdump] then {
|
|
|
|
set objdump [findfile $base_dir/../binutils/objdump]
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists objcopy] then {
|
|
|
|
set objcopy [findfile $base_dir/../binutils/objcopy]
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists ar] then {
|
|
|
|
set ar [findfile $base_dir/../binutils/ar]
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists strip] then {
|
|
|
|
set strip [findfile $base_dir/../binutils/strip-new $base_dir/../binutils/strip-new [transform strip]]
|
|
|
|
}
|
|
|
|
|
2015-10-15 19:04:39 +08:00
|
|
|
if ![info exists size] then {
|
|
|
|
set size [findfile $base_dir/../binutils/size]
|
|
|
|
}
|
|
|
|
|
2007-08-28 21:21:58 +08:00
|
|
|
remote_exec host "mkdir -p tmpdir"
|
1999-05-03 15:29:11 +08:00
|
|
|
|
2014-07-07 12:07:16 +08:00
|
|
|
# Make symlinks from tmpdir/ld to the linker and assembler in the
|
|
|
|
# build tree, so that we can use a -B option to gcc to force it to use
|
|
|
|
# the newly built linker and assembler.
|
2003-05-16 13:04:34 +08:00
|
|
|
if {![file isdirectory tmpdir/ld]} then {
|
|
|
|
catch "exec mkdir tmpdir/ld" status
|
|
|
|
catch "exec ln -s ../../ld-new tmpdir/ld/ld" status
|
2012-01-17 08:16:54 +08:00
|
|
|
catch "exec ln -s ld tmpdir/ld/collect-ld" status
|
2014-07-07 12:07:16 +08:00
|
|
|
catch "exec ln -s ../../../gas/as-new tmpdir/ld/as" status
|
2003-05-16 13:04:34 +08:00
|
|
|
}
|
2014-07-07 12:07:16 +08:00
|
|
|
set gcc_B_opt "-B[pwd]/tmpdir/ld/"
|
2003-05-16 13:04:34 +08:00
|
|
|
|
2003-05-30 21:23:25 +08:00
|
|
|
# load the linker path
|
2014-07-07 12:07:16 +08:00
|
|
|
set ld_L_opt ""
|
2005-03-25 07:36:03 +08:00
|
|
|
if {[file exists tmpdir/libpath.exp]} {
|
|
|
|
load_lib tmpdir/libpath.exp
|
2003-05-30 21:23:25 +08:00
|
|
|
|
2005-03-25 07:36:03 +08:00
|
|
|
foreach dir $libpath {
|
2014-07-07 12:07:16 +08:00
|
|
|
append ld_L_opt " -L$dir"
|
2005-03-25 07:36:03 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# The "make check" target in the Makefile passes in
|
|
|
|
# "CC=$(CC_FOR_TARGET)". But, if the user invokes runtest directly
|
2005-05-28 01:27:03 +08:00
|
|
|
# (as when testing an installed linker), these flags may not be set.
|
2005-03-25 07:36:03 +08:00
|
|
|
if {![info exists CC]} {
|
2005-05-28 01:27:03 +08:00
|
|
|
set CC [find_gcc]
|
|
|
|
}
|
|
|
|
if {![info exists CFLAGS]} {
|
|
|
|
set CFLAGS "-g -O2"
|
|
|
|
}
|
|
|
|
if {![info exists CXX]} {
|
|
|
|
set CXX [find_g++]
|
|
|
|
}
|
|
|
|
if {![info exists CXXFLAGS]} {
|
|
|
|
set CXXFLAGS ""
|
2003-05-30 21:23:25 +08:00
|
|
|
}
|
|
|
|
|
2020-04-17 20:03:53 +08:00
|
|
|
# This allows us to run the linker testsuite with clang as the compilation
|
|
|
|
# driver instead of gcc. The syntax of the overrides are as follows, one
|
|
|
|
# per line:
|
|
|
|
#
|
|
|
|
# '#': Silence information about the changes to the command line arguments.
|
|
|
|
#
|
|
|
|
# '^': Add FOO as a new argument at the beginning of the command line.
|
|
|
|
#
|
|
|
|
# '+': Add FOO as a new argument at the end of the command line.
|
|
|
|
#
|
|
|
|
# 's/XXX/YYY/': Substitute the regular expression XXX with YYY in the command
|
|
|
|
# line.
|
|
|
|
#
|
|
|
|
# 'xOPTION': Removes all instances of the literal argument OPTION.
|
|
|
|
#
|
|
|
|
# 'XOPTION': Removes all instances of the literal argument OPTION,
|
|
|
|
# and the following argument.
|
|
|
|
#
|
|
|
|
# 'Ox': Removes all flags matching 'O' or 'O[sz0-9]' and adds 'Ox'
|
|
|
|
# at the end of the command line.
|
|
|
|
#
|
|
|
|
# \param OS - The stream to write edit information to.
|
|
|
|
# \param Args - The vector of command line arguments.
|
|
|
|
# \param Edit - The override command to perform.
|
|
|
|
# \param SavedStrings - Set to use for storing string representations.
|
|
|
|
|
|
|
|
# Only set up the environment variable if the user has not already provided one.
|
|
|
|
if {! [info exists env(CCC_OVERRIDE_OPTIONS)]} {
|
|
|
|
set env(CCC_OVERRIDE_OPTIONS) "#\
|
|
|
|
+-Wno-unused-command-line-argument \
|
|
|
|
+-Wno-unknown-attributes \
|
|
|
|
+-Wno-tautological-compare \
|
|
|
|
+-Wno-ignored-optimization-argument \
|
|
|
|
+-Wno-deprecated \
|
|
|
|
+-fuse-ld=$ld \
|
|
|
|
x-Wa,--elf-stt-common=yes \
|
|
|
|
x-Wa,-mx86-used-note=no \
|
|
|
|
x-Wa,-mx86-used-note=yes \
|
|
|
|
x-Wa,-madd-bnd-prefix \
|
|
|
|
x-fno-early-inlining \
|
|
|
|
x-fno-toplevel-reorder \
|
|
|
|
x-flto-partition=none \
|
|
|
|
x-feliminate-dwarf2-dups \
|
|
|
|
s/-Wa,-mrelax-relocations=yes,-mx86-used-note=yes/-Wa,-mrelax-relocations=yes/ \
|
|
|
|
s/-Wa,--compress-debug-sections=zlib/-Wa,-compress-debug-sections=zlib/ \
|
|
|
|
s/-Wa,--compress-debug-sections=zlib-gabi/-Wa,-compress-debug-sections=zlib-gabi/ \
|
|
|
|
"
|
|
|
|
}
|
|
|
|
|
2003-05-07 13:08:02 +08:00
|
|
|
# The mips64-*-linux-gnu compiler defaults to the N32 ABI after
|
|
|
|
# installed, but to the O32 ABI in the build tree, because of some
|
|
|
|
# specs-file hacks. Make sure we use an ABI that is compatible with
|
|
|
|
# the one we expect.
|
|
|
|
if {[istarget mips64*-*-linux*] &&
|
|
|
|
(![board_info [target_info name] exists multilib_flags] ||
|
|
|
|
![string match "*-mabi" [board_info [target_info name] multilib_flags]])
|
|
|
|
} {
|
2014-07-07 12:07:16 +08:00
|
|
|
append gcc_B_opt " -mabi=n32"
|
2003-05-07 13:08:02 +08:00
|
|
|
}
|
|
|
|
|
2014-03-19 20:21:39 +08:00
|
|
|
if { [istarget rx-*-*] } {
|
|
|
|
global ASFLAGS
|
|
|
|
set ASFLAGS "-muse-conventional-section-names"
|
|
|
|
}
|
|
|
|
|
2010-12-10 01:06:34 +08:00
|
|
|
# Blackfin ELF targets require selection of an explicit CPU. Use the sim.
|
|
|
|
if {[istarget bfin*-elf*]} {
|
|
|
|
append gcc_B_opt " -msim"
|
|
|
|
}
|
|
|
|
|
1999-05-03 15:29:11 +08:00
|
|
|
# load the utility procedures
|
|
|
|
load_lib ld-lib.exp
|
|
|
|
|
|
|
|
proc get_target_emul {} {
|
|
|
|
global target_triplet
|
|
|
|
global srcdir
|
|
|
|
set status [catch "exec sh -c \"targ='$target_triplet' && . $srcdir/../configure.tgt && echo \\\$targ_emul\"" result]
|
|
|
|
if $status { error "Error getting emulation name: $result" }
|
|
|
|
return $result
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists HOSTING_EMU] { set HOSTING_EMU "-m [get_target_emul]" }
|
|
|
|
|
|
|
|
#
|
|
|
|
# ld_version -- extract and print the version number of ld compiler (GCC)
|
|
|
|
#
|
|
|
|
proc ld_version {} {
|
|
|
|
global ld
|
|
|
|
default_ld_version $ld
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# ld_exit -- just a stub for ld
|
|
|
|
#
|
|
|
|
proc ld_exit {} {
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# ld_start
|
|
|
|
# relink the linker
|
|
|
|
#
|
|
|
|
proc ld_start { ld target } {
|
|
|
|
#
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# ld_relocate
|
|
|
|
# link an object using relocation
|
|
|
|
#
|
|
|
|
proc ld_relocate { ld target objects } {
|
|
|
|
default_ld_relocate $ld $target $objects
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# ld_link
|
|
|
|
# link a program using ld
|
|
|
|
#
|
|
|
|
proc ld_link { ld target objects } {
|
|
|
|
default_ld_link $ld $target $objects
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# ld_compile
|
|
|
|
# compile an object using $cc
|
|
|
|
#
|
|
|
|
proc ld_compile { cc source object } {
|
|
|
|
default_ld_compile $cc $source $object
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# ld_assemble
|
|
|
|
# assemble a file
|
|
|
|
#
|
|
|
|
proc ld_assemble { as source object } {
|
2011-05-12 18:00:06 +08:00
|
|
|
default_ld_assemble $as "" $source $object
|
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# ld_assemble_flags
|
|
|
|
# assemble a file with extra flags
|
|
|
|
#
|
|
|
|
proc ld_assemble_flags { as flags source object } {
|
|
|
|
default_ld_assemble $as $flags $source $object
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# ld_nm
|
|
|
|
# run nm on a file
|
|
|
|
#
|
2001-07-24 19:07:16 +08:00
|
|
|
proc ld_nm { nm nmflags object } {
|
|
|
|
default_ld_nm $nm $nmflags $object
|
1999-05-03 15:29:11 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#
|
|
|
|
# ld_exec
|
|
|
|
# execute ithe target
|
|
|
|
#
|
|
|
|
proc ld_exec { target output } {
|
|
|
|
default_ld_exec $target $output
|
|
|
|
}
|
|
|
|
|
* config/default.exp (AS, GASP, OBJDUMP, NM, NMFLAGS, OBJCOPY,
OBJCOPYFLAGS, READELF, READELFFLAGS, LD, LDFLAGS): Provide
default.
* lib/ld-lib.exp (run_dump_test): Import from gas testsuite. Add
new options "ld", "source", "xfail", "target", "notarget" and
"error". Support the runtest_file_p "*.exp=testname" feature.
(slurp_options, regexp_diff, file_contents, verbose_eval): Import
from gas testsuite.
2001-06-13 11:08:21 +08:00
|
|
|
# From gas-defs.exp, to support run_dump_test.
|
|
|
|
if ![info exists AS] then {
|
|
|
|
set AS $as
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists ASFLAGS] then {
|
|
|
|
set ASFLAGS ""
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists OBJDUMP] then {
|
|
|
|
set OBJDUMP $objdump
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists OBJDUMPFLAGS] then {
|
|
|
|
set OBJDUMPFLAGS {}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists NM] then {
|
|
|
|
set NM $nm
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists NMFLAGS] then {
|
|
|
|
set NMFLAGS {}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists OBJCOPY] then {
|
|
|
|
set OBJCOPY $objcopy
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists OBJCOPYFLAGS] then {
|
|
|
|
set OBJCOPYFLAGS {}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists READELF] then {
|
|
|
|
set READELF [findfile $base_dir/../binutils/readelf]
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists READELFFLAGS] then {
|
|
|
|
set READELFFLAGS {}
|
|
|
|
}
|
|
|
|
|
2018-11-07 01:38:33 +08:00
|
|
|
if ![info exists ELFEDIT] then {
|
|
|
|
set ELFEDIT [findfile $base_dir/../binutils/elfedit]
|
|
|
|
}
|
|
|
|
|
* config/default.exp (AS, GASP, OBJDUMP, NM, NMFLAGS, OBJCOPY,
OBJCOPYFLAGS, READELF, READELFFLAGS, LD, LDFLAGS): Provide
default.
* lib/ld-lib.exp (run_dump_test): Import from gas testsuite. Add
new options "ld", "source", "xfail", "target", "notarget" and
"error". Support the runtest_file_p "*.exp=testname" feature.
(slurp_options, regexp_diff, file_contents, verbose_eval): Import
from gas testsuite.
2001-06-13 11:08:21 +08:00
|
|
|
if ![info exists LD] then {
|
|
|
|
set LD [findfile $base_dir/ld-new ./ld-new [transform ld]]
|
|
|
|
}
|
|
|
|
|
|
|
|
if ![info exists LDFLAGS] then {
|
|
|
|
set LDFLAGS {}
|
|
|
|
}
|
2015-07-27 18:42:39 +08:00
|
|
|
|
2017-11-20 23:32:55 +08:00
|
|
|
# Set LD_CLASS to "64bit" for a 64-bit *host* linker.
|
2017-08-10 06:04:05 +08:00
|
|
|
if { ![info exists LD_CLASS] } then {
|
2017-08-10 07:32:30 +08:00
|
|
|
set REAL_LD [findfile $base_dir/.libs/ld-new .libs/ld-new $LD [transform ld]]
|
|
|
|
set readelf_output [run_host_cmd "$READELF" "-h $REAL_LD"]
|
2017-08-10 06:04:05 +08:00
|
|
|
if { [regexp {[ \t]+Class:[ \t]+ELF64} $readelf_output] } then {
|
|
|
|
set LD_CLASS "64bit"
|
|
|
|
} else {
|
|
|
|
set LD_CLASS "32bit"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-19 06:19:32 +08:00
|
|
|
# Compiler tests
|
|
|
|
proc compiler_supports { flag args } {
|
2019-04-25 03:14:56 +08:00
|
|
|
if { [check_compiler_available] } {
|
2020-10-19 06:19:32 +08:00
|
|
|
global CC
|
2015-07-27 18:42:39 +08:00
|
|
|
set flags ""
|
|
|
|
if [board_info [target_info name] exists cflags] {
|
|
|
|
append flags " [board_info [target_info name] cflags]"
|
|
|
|
}
|
|
|
|
if [board_info [target_info name] exists ldflags] {
|
|
|
|
append flags " [board_info [target_info name] ldflags]"
|
|
|
|
}
|
2020-10-19 06:19:32 +08:00
|
|
|
set fn "cs[pid].c"
|
|
|
|
set f [open $fn "w"]
|
|
|
|
if { [llength $args] > 0 } {
|
|
|
|
puts $f [lindex $args 0]
|
2015-07-27 18:42:39 +08:00
|
|
|
} else {
|
2020-10-19 06:19:32 +08:00
|
|
|
puts $f "int main (void) { return 0; }"
|
2015-07-27 18:42:39 +08:00
|
|
|
}
|
2020-10-19 06:19:32 +08:00
|
|
|
close $f
|
|
|
|
set rfn [remote_download host $fn]
|
|
|
|
set avail [run_host_cmd_yesno "$CC" "$flags $flag $rfn -o /dev/null"]
|
|
|
|
remote_file host delete $rfn
|
|
|
|
file delete $fn
|
|
|
|
return $avail
|
2015-07-27 18:42:39 +08:00
|
|
|
}
|
2020-10-19 06:19:32 +08:00
|
|
|
return 0
|
2015-07-27 18:42:39 +08:00
|
|
|
}
|
2015-07-28 07:16:17 +08:00
|
|
|
|
2020-10-19 06:19:32 +08:00
|
|
|
if { ![info exists PLT_CFLAGS] } then {
|
|
|
|
set PLT_CFLAGS ""
|
|
|
|
if [compiler_supports "-c -fplt"] {
|
|
|
|
set PLT_CFLAGS "-fplt"
|
|
|
|
}
|
|
|
|
}
|
2015-07-28 07:16:17 +08:00
|
|
|
|
|
|
|
if { ![info exists NOPIE_CFLAGS] || ![info exists NOPIE_LDFLAGS] } then {
|
2020-10-19 06:19:32 +08:00
|
|
|
set NOPIE_CFLAGS ""
|
|
|
|
set NOPIE_LDFLAGS ""
|
|
|
|
if [compiler_supports "-fno-PIE -no-pie"] {
|
|
|
|
set NOPIE_CFLAGS "-fno-PIE"
|
|
|
|
set NOPIE_LDFLAGS "-no-pie"
|
2015-07-28 07:16:17 +08:00
|
|
|
}
|
|
|
|
}
|
2017-04-29 03:42:05 +08:00
|
|
|
|
2020-04-02 22:03:08 +08:00
|
|
|
if { ![info exists NOCF_PROTECTION_CFLAGS] } then {
|
2020-10-19 06:19:32 +08:00
|
|
|
set NOCF_PROTECTION_CFLAGS ""
|
|
|
|
if [compiler_supports "-fcf-protection=none"] {
|
|
|
|
set NOCF_PROTECTION_CFLAGS "-fcf-protection=none"
|
2020-04-02 22:03:08 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-04-29 03:42:05 +08:00
|
|
|
if { ![info exists GNU2_CFLAGS] } then {
|
2020-10-19 06:19:32 +08:00
|
|
|
set GNU2_CFLAGS ""
|
|
|
|
if [compiler_supports "-c -mtls-dialect=gnu2" "__thread int y = 1;"] {
|
|
|
|
set GNU2_CFLAGS "-mtls-dialect=gnu2"
|
2017-04-29 03:42:05 +08:00
|
|
|
}
|
|
|
|
}
|
2018-01-28 08:04:34 +08:00
|
|
|
|
|
|
|
if { ![info exists INT128_CFLAGS] } then {
|
2020-10-19 06:19:32 +08:00
|
|
|
set INT128_CFLAGS ""
|
|
|
|
if [compiler_supports "-c" "__int128 a = 42;"] {
|
|
|
|
set INT128_CFLAGS "-DHAS_INT128"
|
2018-01-28 08:04:34 +08:00
|
|
|
}
|
|
|
|
}
|
2018-01-29 20:54:57 +08:00
|
|
|
|
|
|
|
if { ![info exists STATIC_LDFLAGS] } then {
|
2020-10-19 06:19:32 +08:00
|
|
|
set STATIC_LDFLAGS ""
|
|
|
|
if [compiler_supports "-static"] {
|
|
|
|
set STATIC_LDFLAGS "-static"
|
2018-01-29 20:54:57 +08:00
|
|
|
}
|
|
|
|
}
|
2019-04-11 21:52:03 +08:00
|
|
|
|
|
|
|
if { ![info exists STATIC_PIE_LDFLAGS] } then {
|
2020-10-19 06:19:32 +08:00
|
|
|
set STATIC_PIE_LDFLAGS ""
|
|
|
|
if [compiler_supports "-static-pie"] {
|
|
|
|
set STATIC_PIE_LDFLAGS "-static-pie"
|
2019-04-11 21:52:03 +08:00
|
|
|
}
|
|
|
|
}
|
2020-06-03 21:47:38 +08:00
|
|
|
|
2020-09-04 08:17:19 +08:00
|
|
|
if { ![info exists NOSANITIZE_CFLAGS] } then {
|
2020-10-19 06:19:32 +08:00
|
|
|
set NOSANITIZE_CFLAGS ""
|
|
|
|
if [compiler_supports "-fno-sanitize=all"] {
|
|
|
|
set NOSANITIZE_CFLAGS "-fno-sanitize=all"
|
|
|
|
}
|
|
|
|
}
|
2020-06-03 21:47:38 +08:00
|
|
|
|
2020-10-22 21:04:21 +08:00
|
|
|
if { ![info exists NOLTO_CFLAGS] } then {
|
|
|
|
set NOLTO_CFLAGS ""
|
|
|
|
if [compiler_supports "-fno-lto"] {
|
|
|
|
set NOLTO_CFLAGS "-fno-lto"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-10-19 06:19:32 +08:00
|
|
|
# Provide dummy libraries that alpha-vms-ld always loads
|
|
|
|
if { [istarget alpha*-*-*vms*] } {
|
|
|
|
set src tmpdir/empty.s
|
|
|
|
set f [open $src "w"]
|
|
|
|
close $f
|
|
|
|
if { [ld_assemble $as $src tmpdir/empty.o]
|
|
|
|
&& ![ld_link $LD tmpdir/empty tmpdir/empty.o]
|
|
|
|
&& [regsub -all {[^\n]*: cannot find -l([^\n]*)} $exec_output {tmpdir/lib\1.a } missing_libs] } {
|
|
|
|
regsub -all {\$} $missing_libs {\\\$} missing_libs
|
|
|
|
for { set i 0 } { $i < [llength $missing_libs] } { incr i } {
|
|
|
|
set f [lindex $missing_libs $i]
|
|
|
|
verbose -log "creating dummy $f"
|
|
|
|
ar_simple_create $ar {} $f tmpdir/empty.o
|
|
|
|
}
|
|
|
|
append LDFLAGS " -Ltmpdir"
|
|
|
|
unset i missing_libs
|
2020-06-03 21:47:38 +08:00
|
|
|
}
|
2020-10-19 06:19:32 +08:00
|
|
|
unset f src
|
2020-06-03 21:47:38 +08:00
|
|
|
}
|
2020-10-22 21:10:08 +08:00
|
|
|
|
|
|
|
set plug_opt ""
|
2020-10-24 02:24:58 +08:00
|
|
|
if { [check_compiler_available] } {
|
|
|
|
set plugin_names {
|
|
|
|
liblto_plugin.so
|
|
|
|
liblto_plugin-0.dll
|
|
|
|
cyglto_plugin-0.dll
|
2020-10-22 21:10:08 +08:00
|
|
|
}
|
2020-10-24 02:24:58 +08:00
|
|
|
foreach plug $plugin_names {
|
|
|
|
set plug_so [run_host_cmd $CC "--print-prog-name $plug"]
|
|
|
|
if { $plug_so eq $plug } then {
|
|
|
|
set plug_so [run_host_cmd $CC "--print-file-name $plug"]
|
|
|
|
}
|
|
|
|
if { $plug_so ne $plug } then {
|
|
|
|
set plug_opt "--plugin $plug_so"
|
|
|
|
break
|
|
|
|
}
|
2020-10-22 21:10:08 +08:00
|
|
|
}
|
|
|
|
}
|
2020-12-17 05:40:42 +08:00
|
|
|
|
|
|
|
if {[file exists .libs/libdep.so]} {
|
|
|
|
set dep_plug_opt "--plugin .libs/libdep.so"
|
|
|
|
} elseif {[file exists .libs/libdep.dll]} {
|
|
|
|
set dep_plug_opt "--plugin .libs/libdep.dll"
|
|
|
|
} else {
|
|
|
|
set dep_plug_opt ""
|
|
|
|
}
|