diff options
author | chatham <chatham@sourceware.org> | 2007-08-21 21:29:12 +0000 |
---|---|---|
committer | chatham <chatham@sourceware.org> | 2007-08-21 21:29:12 +0000 |
commit | 72a2eed757d46b207f6e127dcc7c5acf848f5872 (patch) | |
tree | 79481a04429c771b3b2e2ad1ee54630ee7ecd3dc | |
parent | 0496d5e5b46976aa1cdbe55c6e833a6e7a04961d (diff) | |
download | gdb-72a2eed757d46b207f6e127dcc7c5acf848f5872.zip gdb-72a2eed757d46b207f6e127dcc7c5acf848f5872.tar.gz gdb-72a2eed757d46b207f6e127dcc7c5acf848f5872.tar.bz2 |
Make relative references in linker scripts absolute and update a
comment about relocate() being called.
-rw-r--r-- | gold/script.cc | 15 | ||||
-rw-r--r-- | gold/target-reloc.h | 2 |
2 files changed, 15 insertions, 2 deletions
diff --git a/gold/script.cc b/gold/script.cc index f5584d9..44de551 100644 --- a/gold/script.cc +++ b/gold/script.cc @@ -1141,7 +1141,20 @@ extern "C" void script_add_file(void* closurev, const char* name) { Parser_closure* closure = static_cast<Parser_closure*>(closurev); - Input_file_argument file(name, false, closure->position_dependent_options()); + std::string absname; + if (name[0] == '/') + { + absname = name; + } + else + { + // Prepend `dirname closure->filename()` to make the path absolute. + char *slash = strrchr(closure->filename(), '/'); + absname.assign(closure->filename(), + slash ? slash - closure->filename() + 1 : 0); + absname += name; + } + Input_file_argument file(absname.c_str(), false, closure->position_dependent_options()); closure->inputs()->add_file(file); } diff --git a/gold/target-reloc.h b/gold/target-reloc.h index d282805..1e9ecd0 100644 --- a/gold/target-reloc.h +++ b/gold/target-reloc.h @@ -91,7 +91,7 @@ scan_relocs( } // This function implements the generic part of relocation processing. -// This is an inline function which take a class whose operator() +// This is an inline function which take a class whose relocate() // implements the machine specific part of relocation. We do it this // way to avoid making a function call for each relocation, and to // avoid repeating the generic relocation handling code for each |