2009-10-10 Chris Demetriou <cgd@google.com>
* options.h (Input_file_argument::Input_file_type): New enum. (Input_file_argument::is_lib_): Replace with... (Input_file_argument::type_): New member. (Input_file_argument::Input_file_argument): Take Input_file_type 'type' rather than boolean 'is_lib' as second argument. (Input_file_argument::is_lib): Use type_. (Input_file_argument::is_searched_file): New function. (Input_file_argument::may_need_search): Handle is_searched_file. * options.cc (General_options::parse_library): Support -l:filename. (General_options::parse_just_symbols): Update for Input_file_argument changes. (Command_line::process): Likewise. * archive.cc (Archive::get_file_and_offset): Likewise. * plugin.cc (Plugin_manager::release_input_file): Likewise. * script.cc (read_script_file, script_add_file): Likewise. * fileread.cc (Input_file::Input_file): Likewise. (Input_file::will_search_for): Handle is_searched_file. (Input_file::open): Likewise. * readsyms.cc (Read_symbols::get_name): Likewise. * testsuite/Makefile.am (searched_file_test): New test. * testsuite/Makefile.in: Regenerate. * testsuite/searched_file_test.cc: New file. * testsuite/searched_file_test_lib.cc: New file.
This commit is contained in:
parent
f080369056
commit
ae3b518947
12 changed files with 237 additions and 47 deletions
|
@ -1,3 +1,29 @@
|
|||
2009-10-10 Chris Demetriou <cgd@google.com>
|
||||
|
||||
* options.h (Input_file_argument::Input_file_type): New enum.
|
||||
(Input_file_argument::is_lib_): Replace with...
|
||||
(Input_file_argument::type_): New member.
|
||||
(Input_file_argument::Input_file_argument): Take Input_file_type
|
||||
'type' rather than boolean 'is_lib' as second argument.
|
||||
(Input_file_argument::is_lib): Use type_.
|
||||
(Input_file_argument::is_searched_file): New function.
|
||||
(Input_file_argument::may_need_search): Handle is_searched_file.
|
||||
* options.cc (General_options::parse_library): Support -l:filename.
|
||||
(General_options::parse_just_symbols): Update for Input_file_argument
|
||||
changes.
|
||||
(Command_line::process): Likewise.
|
||||
* archive.cc (Archive::get_file_and_offset): Likewise.
|
||||
* plugin.cc (Plugin_manager::release_input_file): Likewise.
|
||||
* script.cc (read_script_file, script_add_file): Likewise.
|
||||
* fileread.cc (Input_file::Input_file): Likewise.
|
||||
(Input_file::will_search_for): Handle is_searched_file.
|
||||
(Input_file::open): Likewise.
|
||||
* readsyms.cc (Read_symbols::get_name): Likewise.
|
||||
* testsuite/Makefile.am (searched_file_test): New test.
|
||||
* testsuite/Makefile.in: Regenerate.
|
||||
* testsuite/searched_file_test.cc: New file.
|
||||
* testsuite/searched_file_test_lib.cc: New file.
|
||||
|
||||
2009-10-09 Andrew Pinski <andrew_pinski@playstation.sony.com>
|
||||
Ian Lance Taylor <iant@google.com>
|
||||
|
||||
|
|
|
@ -489,8 +489,9 @@ Archive::get_file_and_offset(off_t off, Input_file** input_file, off_t* memoff,
|
|||
else
|
||||
{
|
||||
Input_file_argument* input_file_arg =
|
||||
new Input_file_argument(member_name->c_str(), false, "", false,
|
||||
parameters->options());
|
||||
new Input_file_argument(member_name->c_str(),
|
||||
Input_file_argument::INPUT_FILE_TYPE_FILE,
|
||||
"", false, parameters->options());
|
||||
*input_file = new Input_file(input_file_arg);
|
||||
int dummy = 0;
|
||||
if (!(*input_file)->open(*this->dirpath_, this->task_, &dummy))
|
||||
|
@ -509,8 +510,9 @@ Archive::get_file_and_offset(off_t off, Input_file** input_file, off_t* memoff,
|
|||
// This is an external member of a thin archive. Open the
|
||||
// file as a regular relocatable object file.
|
||||
Input_file_argument* input_file_arg =
|
||||
new Input_file_argument(member_name->c_str(), false, "", false,
|
||||
this->input_file_->options());
|
||||
new Input_file_argument(member_name->c_str(),
|
||||
Input_file_argument::INPUT_FILE_TYPE_FILE,
|
||||
"", false, this->input_file_->options());
|
||||
*input_file = new Input_file(input_file_arg);
|
||||
int dummy = 0;
|
||||
if (!(*input_file)->open(*this->dirpath_, this->task_, &dummy))
|
||||
|
|
|
@ -726,8 +726,8 @@ Input_file::Input_file(const Task* task, const char* name,
|
|||
: file_()
|
||||
{
|
||||
this->input_argument_ =
|
||||
new Input_file_argument(name, false, "", false,
|
||||
Position_dependent_options());
|
||||
new Input_file_argument(name, Input_file_argument::INPUT_FILE_TYPE_FILE,
|
||||
"", false, Position_dependent_options());
|
||||
bool ok = this->file_.open(task, name, contents, size);
|
||||
gold_assert(ok);
|
||||
}
|
||||
|
@ -774,6 +774,7 @@ Input_file::will_search_for() const
|
|||
{
|
||||
return (!IS_ABSOLUTE_PATH(this->input_argument_->name())
|
||||
&& (this->input_argument_->is_lib()
|
||||
|| this->input_argument_->is_searched_file()
|
||||
|| this->input_argument_->extra_search_path() != NULL));
|
||||
}
|
||||
|
||||
|
@ -798,9 +799,10 @@ File_read::get_mtime()
|
|||
|
||||
// If the filename is not absolute, we assume it is in the current
|
||||
// directory *except* when:
|
||||
// A) input_argument_->is_lib() is true; or
|
||||
// B) input_argument_->extra_search_path() is not empty.
|
||||
// In both cases, we look in extra_search_path + library_path to find
|
||||
// A) input_argument_->is_lib() is true;
|
||||
// B) input_argument_->is_searched_file() is true; or
|
||||
// C) input_argument_->extra_search_path() is not empty.
|
||||
// In each, we look in extra_search_path + library_path to find
|
||||
// the file location, rather than the current directory.
|
||||
|
||||
bool
|
||||
|
@ -809,35 +811,43 @@ Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex)
|
|||
std::string name;
|
||||
|
||||
// Case 1: name is an absolute file, just try to open it
|
||||
// Case 2: name is relative but is_lib is false and extra_search_path
|
||||
// is empty
|
||||
// Case 2: name is relative but is_lib is false, is_searched_file is false,
|
||||
// and extra_search_path is empty
|
||||
if (IS_ABSOLUTE_PATH(this->input_argument_->name())
|
||||
|| (!this->input_argument_->is_lib()
|
||||
&& !this->input_argument_->is_searched_file()
|
||||
&& this->input_argument_->extra_search_path() == NULL))
|
||||
{
|
||||
name = this->input_argument_->name();
|
||||
this->found_name_ = name;
|
||||
}
|
||||
// Case 3: is_lib is true
|
||||
else if (this->input_argument_->is_lib())
|
||||
// Case 3: is_lib is true or is_searched_file is true
|
||||
else if (this->input_argument_->is_lib()
|
||||
|| this->input_argument_->is_searched_file())
|
||||
{
|
||||
// We don't yet support extra_search_path with -l.
|
||||
gold_assert(this->input_argument_->extra_search_path() == NULL);
|
||||
std::string n1("lib");
|
||||
n1 += this->input_argument_->name();
|
||||
std::string n2;
|
||||
if (parameters->options().is_static()
|
||||
|| !this->input_argument_->options().Bdynamic())
|
||||
n1 += ".a";
|
||||
else
|
||||
std::string n1, n2;
|
||||
if (this->input_argument_->is_lib())
|
||||
{
|
||||
n2 = n1 + ".a";
|
||||
n1 += ".so";
|
||||
n1 = "lib";
|
||||
n1 += this->input_argument_->name();
|
||||
if (parameters->options().is_static()
|
||||
|| !this->input_argument_->options().Bdynamic())
|
||||
n1 += ".a";
|
||||
else
|
||||
{
|
||||
n2 = n1 + ".a";
|
||||
n1 += ".so";
|
||||
}
|
||||
}
|
||||
else
|
||||
n1 = this->input_argument_->name();
|
||||
name = dirpath.find(n1, n2, &this->is_in_sysroot_, pindex);
|
||||
if (name.empty())
|
||||
{
|
||||
gold_error(_("cannot find -l%s"),
|
||||
gold_error(_("cannot find %s%s"),
|
||||
this->input_argument_->is_lib() ? "-l" : "",
|
||||
this->input_argument_->name());
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -341,7 +341,19 @@ void
|
|||
General_options::parse_library(const char*, const char* arg,
|
||||
Command_line* cmdline)
|
||||
{
|
||||
Input_file_argument file(arg, true, "", false, *this);
|
||||
Input_file_argument::Input_file_type type;
|
||||
const char *name;
|
||||
if (arg[0] == ':')
|
||||
{
|
||||
type = Input_file_argument::INPUT_FILE_TYPE_SEARCHED_FILE;
|
||||
name = arg + 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
type = Input_file_argument::INPUT_FILE_TYPE_LIBRARY;
|
||||
name = arg;
|
||||
}
|
||||
Input_file_argument file(name, type, "", false, *this);
|
||||
cmdline->inputs().add_file(file);
|
||||
}
|
||||
|
||||
|
@ -378,7 +390,8 @@ void
|
|||
General_options::parse_just_symbols(const char*, const char* arg,
|
||||
Command_line* cmdline)
|
||||
{
|
||||
Input_file_argument file(arg, false, "", true, *this);
|
||||
Input_file_argument file(arg, Input_file_argument::INPUT_FILE_TYPE_FILE,
|
||||
"", true, *this);
|
||||
cmdline->inputs().add_file(file);
|
||||
}
|
||||
|
||||
|
@ -1157,8 +1170,9 @@ Command_line::process(int argc, const char** argv)
|
|||
this->position_options_.copy_from_options(this->options());
|
||||
if (no_more_options || argv[i][0] != '-')
|
||||
{
|
||||
Input_file_argument file(argv[i], false, "", false,
|
||||
this->position_options_);
|
||||
Input_file_argument file(argv[i],
|
||||
Input_file_argument::INPUT_FILE_TYPE_FILE,
|
||||
"", false, this->position_options_);
|
||||
this->inputs_.add_file(file);
|
||||
++i;
|
||||
}
|
||||
|
|
|
@ -1228,9 +1228,20 @@ class Position_dependent_options
|
|||
class Input_file_argument
|
||||
{
|
||||
public:
|
||||
enum Input_file_type
|
||||
{
|
||||
// A regular file, name used as-is, not searched.
|
||||
INPUT_FILE_TYPE_FILE,
|
||||
// A library name. When used, "lib" will be prepended and ".so" or
|
||||
// ".a" appended to make a filename, and that filename will be searched
|
||||
// for using the -L paths.
|
||||
INPUT_FILE_TYPE_LIBRARY,
|
||||
// A regular file, name used as-is, but searched using the -L paths.
|
||||
INPUT_FILE_TYPE_SEARCHED_FILE
|
||||
};
|
||||
|
||||
// name: file name or library name
|
||||
// is_lib: true if name is a library name: that is, emits the leading
|
||||
// "lib" and trailing ".so"/".a" from the name
|
||||
// type: the type of this input file.
|
||||
// extra_search_path: an extra directory to look for the file, prior
|
||||
// to checking the normal library search path. If this is "",
|
||||
// then no extra directory is added.
|
||||
|
@ -1238,15 +1249,15 @@ class Input_file_argument
|
|||
// options: The position dependent options at this point in the
|
||||
// command line, such as --whole-archive.
|
||||
Input_file_argument()
|
||||
: name_(), is_lib_(false), extra_search_path_(""), just_symbols_(false),
|
||||
options_()
|
||||
: name_(), type_(INPUT_FILE_TYPE_FILE), extra_search_path_(""),
|
||||
just_symbols_(false), options_()
|
||||
{ }
|
||||
|
||||
Input_file_argument(const char* name, bool is_lib,
|
||||
Input_file_argument(const char* name, Input_file_type type,
|
||||
const char* extra_search_path,
|
||||
bool just_symbols,
|
||||
const Position_dependent_options& options)
|
||||
: name_(name), is_lib_(is_lib), extra_search_path_(extra_search_path),
|
||||
: name_(name), type_(type), extra_search_path_(extra_search_path),
|
||||
just_symbols_(just_symbols), options_(options)
|
||||
{ }
|
||||
|
||||
|
@ -1254,11 +1265,11 @@ class Input_file_argument
|
|||
// Position_dependent_options. In that case, we extract the
|
||||
// position-independent vars from the General_options and only store
|
||||
// those.
|
||||
Input_file_argument(const char* name, bool is_lib,
|
||||
Input_file_argument(const char* name, Input_file_type type,
|
||||
const char* extra_search_path,
|
||||
bool just_symbols,
|
||||
const General_options& options)
|
||||
: name_(name), is_lib_(is_lib), extra_search_path_(extra_search_path),
|
||||
: name_(name), type_(type), extra_search_path_(extra_search_path),
|
||||
just_symbols_(just_symbols), options_(options)
|
||||
{ }
|
||||
|
||||
|
@ -1272,7 +1283,11 @@ class Input_file_argument
|
|||
|
||||
bool
|
||||
is_lib() const
|
||||
{ return this->is_lib_; }
|
||||
{ return type_ == INPUT_FILE_TYPE_LIBRARY; }
|
||||
|
||||
bool
|
||||
is_searched_file() const
|
||||
{ return type_ == INPUT_FILE_TYPE_SEARCHED_FILE; }
|
||||
|
||||
const char*
|
||||
extra_search_path() const
|
||||
|
@ -1291,14 +1306,18 @@ class Input_file_argument
|
|||
// options.
|
||||
bool
|
||||
may_need_search() const
|
||||
{ return this->is_lib_ || !this->extra_search_path_.empty(); }
|
||||
{
|
||||
return (this->is_lib()
|
||||
|| this->is_searched_file()
|
||||
|| !this->extra_search_path_.empty());
|
||||
}
|
||||
|
||||
private:
|
||||
// We use std::string, not const char*, here for convenience when
|
||||
// using script files, so that we do not have to preserve the string
|
||||
// in that case.
|
||||
std::string name_;
|
||||
bool is_lib_;
|
||||
Input_file_type type_;
|
||||
std::string extra_search_path_;
|
||||
bool just_symbols_;
|
||||
Position_dependent_options options_;
|
||||
|
|
|
@ -413,7 +413,11 @@ Plugin_manager::release_input_file(unsigned int handle)
|
|||
ld_plugin_status
|
||||
Plugin_manager::add_input_file(char *pathname, bool is_lib)
|
||||
{
|
||||
Input_file_argument file(pathname, is_lib, "", false, this->options_);
|
||||
Input_file_argument file(pathname,
|
||||
(is_lib
|
||||
? Input_file_argument::INPUT_FILE_TYPE_LIBRARY
|
||||
: Input_file_argument::INPUT_FILE_TYPE_FILE),
|
||||
"", false, this->options_);
|
||||
Input_argument* input_argument = new Input_argument(file);
|
||||
Task_token* next_blocker = new Task_token(true);
|
||||
next_blocker->add_blocker();
|
||||
|
|
|
@ -398,6 +398,8 @@ Read_symbols::get_name() const
|
|||
std::string ret("Read_symbols ");
|
||||
if (this->input_argument_->file().is_lib())
|
||||
ret += "-l";
|
||||
else if (this->input_argument_->file().is_searched_file())
|
||||
ret += "-l:";
|
||||
ret += this->input_argument_->file().name();
|
||||
return ret;
|
||||
}
|
||||
|
@ -590,6 +592,8 @@ Read_script::get_name() const
|
|||
std::string ret("Read_script ");
|
||||
if (this->input_argument_->file().is_lib())
|
||||
ret += "-l";
|
||||
else if (this->input_argument_->file().is_searched_file())
|
||||
ret += "-l:";
|
||||
ret += this->input_argument_->file().name();
|
||||
return ret;
|
||||
}
|
||||
|
|
|
@ -1452,7 +1452,9 @@ read_script_file(const char* filename, Command_line* cmdline,
|
|||
Position_dependent_options posdep = cmdline->position_dependent_options();
|
||||
if (posdep.format_enum() == General_options::OBJECT_FORMAT_BINARY)
|
||||
posdep.set_format_enum(General_options::OBJECT_FORMAT_ELF);
|
||||
Input_file_argument input_argument(filename, false, "", false, posdep);
|
||||
Input_file_argument input_argument(filename,
|
||||
Input_file_argument::INPUT_FILE_TYPE_FILE,
|
||||
"", false, posdep);
|
||||
Input_file input_file(&input_argument);
|
||||
int dummy = 0;
|
||||
if (!input_file.open(dirsearch, task, &dummy))
|
||||
|
@ -2179,8 +2181,10 @@ script_add_file(void* closurev, const char* name, size_t length)
|
|||
}
|
||||
}
|
||||
|
||||
Input_file_argument file(name_string.c_str(), false, extra_search_path,
|
||||
false, closure->position_dependent_options());
|
||||
Input_file_argument file(name_string.c_str(),
|
||||
Input_file_argument::INPUT_FILE_TYPE_FILE,
|
||||
extra_search_path, false,
|
||||
closure->position_dependent_options());
|
||||
closure->inputs()->add_file(file);
|
||||
}
|
||||
|
||||
|
|
|
@ -1181,6 +1181,20 @@ permission_test: basic_test.o gcctestdir/ld
|
|||
chmod 600 $@; \
|
||||
$(CXXLINK) -Bgcctestdir/ basic_test.o
|
||||
|
||||
# Check -l:foo.a
|
||||
check_PROGRAMS += searched_file_test
|
||||
MOSTLYCLEANFILES += searched_file_test searched_file_test_lib.o \
|
||||
alt/searched_file_test_lib.a
|
||||
searched_file_test_SOURCES = searched_file_test.cc
|
||||
searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
|
||||
searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
|
||||
searched_file_test_LDADD = -l:searched_file_test_lib.a
|
||||
searched_file_test_lib.o: searched_file_test_lib.cc
|
||||
$(CXXCOMPILE) -c -o $@ $<
|
||||
alt/searched_file_test_lib.a: searched_file_test_lib.o
|
||||
test -d alt || mkdir -p alt
|
||||
$(TEST_AR) rc $@ $^
|
||||
|
||||
endif GCC
|
||||
endif NATIVE_LINKER
|
||||
|
||||
|
|
|
@ -359,7 +359,10 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
|
|||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ hidden_test hidden_test.err \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ retain_symbols_file_test \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ retain_symbols_file_test.in \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ retain_symbols_file_test.stdout
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ retain_symbols_file_test.stdout \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ searched_file_test \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ searched_file_test_lib.o \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ alt/searched_file_test_lib.a
|
||||
@GCC_TRUE@@MCMODEL_MEDIUM_TRUE@@NATIVE_LINKER_TRUE@am__append_30 = large
|
||||
@GCC_FALSE@large_DEPENDENCIES = libgoldtest.a ../libgold.a \
|
||||
@GCC_FALSE@ ../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
|
||||
|
@ -377,7 +380,12 @@ check_PROGRAMS = object_unittest$(EXEEXT) binary_unittest$(EXEEXT) \
|
|||
|
||||
# Test that if the output file already exists and is empty,
|
||||
# it will get execute permission.
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_31 = permission_test
|
||||
|
||||
# Check -l:foo.a
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__append_31 = permission_test \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ searched_file_test
|
||||
@GCC_FALSE@searched_file_test_DEPENDENCIES =
|
||||
@NATIVE_LINKER_FALSE@searched_file_test_DEPENDENCIES =
|
||||
|
||||
# These tests work with cross linkers.
|
||||
@DEFAULT_TARGET_I386_TRUE@am__append_32 = split_i386.sh
|
||||
|
@ -504,7 +512,8 @@ libgoldtest_a_OBJECTS = $(am_libgoldtest_a_OBJECTS)
|
|||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ discard_locals_test$(EXEEXT)
|
||||
@GCC_TRUE@@MCMODEL_MEDIUM_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_18 = large$(EXEEXT)
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@am__EXEEXT_19 = \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ permission_test$(EXEEXT)
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ permission_test$(EXEEXT) \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ searched_file_test$(EXEEXT)
|
||||
basic_pic_test_SOURCES = basic_pic_test.c
|
||||
basic_pic_test_OBJECTS = basic_pic_test.$(OBJEXT)
|
||||
basic_pic_test_LDADD = $(LDADD)
|
||||
|
@ -802,6 +811,12 @@ script_test_3_LDADD = $(LDADD)
|
|||
script_test_3_DEPENDENCIES = libgoldtest.a ../libgold.a \
|
||||
../../libiberty/libiberty.a $(am__DEPENDENCIES_1) \
|
||||
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
|
||||
am__searched_file_test_SOURCES_DIST = searched_file_test.cc
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@am_searched_file_test_OBJECTS = \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ searched_file_test.$(OBJEXT)
|
||||
searched_file_test_OBJECTS = $(am_searched_file_test_OBJECTS)
|
||||
searched_file_test_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
|
||||
$(searched_file_test_LDFLAGS) $(LDFLAGS) -o $@
|
||||
am__thin_archive_test_1_SOURCES_DIST = thin_archive_main.cc
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@am_thin_archive_test_1_OBJECTS = \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ thin_archive_main.$(OBJEXT)
|
||||
|
@ -1153,8 +1168,9 @@ SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
|
|||
$(protected_2_SOURCES) $(relro_script_test_SOURCES) \
|
||||
$(relro_test_SOURCES) $(script_test_1_SOURCES) \
|
||||
$(script_test_2_SOURCES) script_test_3.c \
|
||||
$(thin_archive_test_1_SOURCES) $(thin_archive_test_2_SOURCES) \
|
||||
$(tls_pic_test_SOURCES) $(tls_shared_gd_to_ie_test_SOURCES) \
|
||||
$(searched_file_test_SOURCES) $(thin_archive_test_1_SOURCES) \
|
||||
$(thin_archive_test_2_SOURCES) $(tls_pic_test_SOURCES) \
|
||||
$(tls_shared_gd_to_ie_test_SOURCES) \
|
||||
$(tls_shared_gnu2_gd_to_ie_test_SOURCES) \
|
||||
$(tls_shared_gnu2_test_SOURCES) $(tls_shared_ie_test_SOURCES) \
|
||||
$(tls_shared_nonpic_test_SOURCES) $(tls_shared_test_SOURCES) \
|
||||
|
@ -1212,6 +1228,7 @@ DIST_SOURCES = $(libgoldtest_a_SOURCES) basic_pic_test.c \
|
|||
$(am__relro_test_SOURCES_DIST) \
|
||||
$(am__script_test_1_SOURCES_DIST) \
|
||||
$(am__script_test_2_SOURCES_DIST) script_test_3.c \
|
||||
$(am__searched_file_test_SOURCES_DIST) \
|
||||
$(am__thin_archive_test_1_SOURCES_DIST) \
|
||||
$(am__thin_archive_test_2_SOURCES_DIST) \
|
||||
$(am__tls_pic_test_SOURCES_DIST) \
|
||||
|
@ -1768,6 +1785,10 @@ binary_unittest_SOURCES = binary_unittest.cc
|
|||
@GCC_TRUE@@MCMODEL_MEDIUM_TRUE@@NATIVE_LINKER_TRUE@large_CFLAGS = -mcmodel=medium
|
||||
@GCC_TRUE@@MCMODEL_MEDIUM_TRUE@@NATIVE_LINKER_TRUE@large_DEPENDENCIES = gcctestdir/ld
|
||||
@GCC_TRUE@@MCMODEL_MEDIUM_TRUE@@NATIVE_LINKER_TRUE@large_LDFLAGS = -Bgcctestdir/
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@searched_file_test_SOURCES = searched_file_test.cc
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@searched_file_test_DEPENDENCIES = alt/searched_file_test_lib.a
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@searched_file_test_LDFLAGS = -Bgcctestdir/ -Lalt
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@searched_file_test_LDADD = -l:searched_file_test_lib.a
|
||||
@DEFAULT_TARGET_I386_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
|
||||
@DEFAULT_TARGET_X86_64_TRUE@SPLIT_DEFSYMS = --defsym __morestack=0x100 --defsym __morestack_non_split=0x200
|
||||
all: $(BUILT_SOURCES)
|
||||
|
@ -2001,6 +2022,9 @@ script_test_2$(EXEEXT): $(script_test_2_OBJECTS) $(script_test_2_DEPENDENCIES)
|
|||
@NATIVE_LINKER_FALSE@script_test_3$(EXEEXT): $(script_test_3_OBJECTS) $(script_test_3_DEPENDENCIES)
|
||||
@NATIVE_LINKER_FALSE@ @rm -f script_test_3$(EXEEXT)
|
||||
@NATIVE_LINKER_FALSE@ $(LINK) $(script_test_3_OBJECTS) $(script_test_3_LDADD) $(LIBS)
|
||||
searched_file_test$(EXEEXT): $(searched_file_test_OBJECTS) $(searched_file_test_DEPENDENCIES)
|
||||
@rm -f searched_file_test$(EXEEXT)
|
||||
$(searched_file_test_LINK) $(searched_file_test_OBJECTS) $(searched_file_test_LDADD) $(LIBS)
|
||||
thin_archive_test_1$(EXEEXT): $(thin_archive_test_1_OBJECTS) $(thin_archive_test_1_DEPENDENCIES)
|
||||
@rm -f thin_archive_test_1$(EXEEXT)
|
||||
$(thin_archive_test_1_LINK) $(thin_archive_test_1_OBJECTS) $(thin_archive_test_1_LDADD) $(LIBS)
|
||||
|
@ -2182,6 +2206,7 @@ distclean-compile:
|
|||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/script_test_2a.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/script_test_2b.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/script_test_3.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/searched_file_test.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testfile.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testmain.Po@am__quote@
|
||||
|
@ -3000,6 +3025,11 @@ uninstall-am:
|
|||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ touch $@; \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ chmod 600 $@; \
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXLINK) -Bgcctestdir/ basic_test.o
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@searched_file_test_lib.o: searched_file_test_lib.cc
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(CXXCOMPILE) -c -o $@ $<
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@alt/searched_file_test_lib.a: searched_file_test_lib.o
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ test -d alt || mkdir -p alt
|
||||
@GCC_TRUE@@NATIVE_LINKER_TRUE@ $(TEST_AR) rc $@ $^
|
||||
@DEFAULT_TARGET_I386_TRUE@split_i386_1.o: split_i386_1.s
|
||||
@DEFAULT_TARGET_I386_TRUE@ $(TEST_AS) -o $@ $<
|
||||
@DEFAULT_TARGET_I386_TRUE@split_i386_2.o: split_i386_2.s
|
||||
|
|
36
gold/testsuite/searched_file_test.cc
Normal file
36
gold/testsuite/searched_file_test.cc
Normal file
|
@ -0,0 +1,36 @@
|
|||
// searched_file_test.cc -- test -l:foo.a for gold
|
||||
|
||||
// Copyright 2009 Free Software Foundation, Inc.
|
||||
// Written by Chris Demetriou <cgd@google.com>.
|
||||
|
||||
// This file is part of gold.
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 3 of the License, or
|
||||
// (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
|
||||
// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
|
||||
// The Linux kernel builds an object file using a linker script, and
|
||||
// then links against that object file using the -R option. This is a
|
||||
// test for that usage.
|
||||
|
||||
#include <cstdlib>
|
||||
|
||||
extern int zero_from_lib;
|
||||
|
||||
int
|
||||
main(int, char**)
|
||||
{
|
||||
exit(zero_from_lib);
|
||||
}
|
||||
|
27
gold/testsuite/searched_file_test_lib.cc
Normal file
27
gold/testsuite/searched_file_test_lib.cc
Normal file
|
@ -0,0 +1,27 @@
|
|||
// searched_file_test_lib.cc -- test -l:foo.a for gold
|
||||
|
||||
// Copyright 2009 Free Software Foundation, Inc.
|
||||
// Written by Chris Demetriou <cgd@google.com>.
|
||||
|
||||
// This file is part of gold.
|
||||
|
||||
// This program is free software; you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation; either version 3 of the License, or
|
||||
// (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
|
||||
// Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
|
||||
// MA 02110-1301, USA.
|
||||
|
||||
// The Linux kernel builds an object file using a linker script, and
|
||||
// then links against that object file using the -R option. This is a
|
||||
// test for that usage.
|
||||
|
||||
int zero_from_lib = 0;
|
Loading…
Add table
Reference in a new issue