Details
Diff Detail
- Repository
- rLLD LLVM Linker
Event Timeline
t3.o .globl bar; bar:
t4.o .globl foo; foo: call bar
t.o .global _start; _start: call bar
ld.gold t.o --start-lib t3.o t4.o --end-lib # successfully
Without this revision, ld.lld --warn-backrefs t.o --start-lib t3.o t4.o --end-lib warns that t4.o has a reference on t3.o.
If that's the case, --start-lib implies --start-group. To handle it, I'd set InputFile::IsInGroup to true for --start-lib just like we are doing for --start-group, so that --start-lib is handled as if --start-group everywhere.
Updated.
gold disallows --start-group --start-lib nested in any order so we can simplify the handling.
// gold/options.cc void Input_arguments::start_group() { if (this->in_group_) gold_fatal(_("May not nest groups")); if (this->in_lib_) gold_fatal(_("may not nest groups in libraries")); Input_file_group* group = new Input_file_group(); this->input_argument_list_.push_back(Input_argument(group)); this->in_group_ = true; } // Start a lib. void Input_arguments::start_lib(const Position_dependent_options& options) { if (this->in_lib_) gold_fatal(_("may not nest libraries")); if (this->in_group_) gold_fatal(_("may not nest libraries in groups")); Input_file_lib* lib = new Input_file_lib(options); this->input_argument_list_.push_back(Input_argument(lib)); this->in_lib_ = true; }
ELF/Driver.cpp | ||
---|---|---|
987 | Do you need this? I think you now always set IsInGroup if you are InLib, so this new condition doesn't seem necessary. |
Not exactly. --start-lib/--end-lib means that those files are treated like a single .a. The tradition ELF handling of a .a file will loop over the members until no new member is fetched.
This revision breaks build systems where the current directory isn't writable, because the test warn-backrefs.s just writes to a.out.
I have committed R330464 to add an output argument, which fixes the test.
Do you need this? I think you now always set IsInGroup if you are InLib, so this new condition doesn't seem necessary.