[PATCH] D45849: [ELF] --warn-backrefs: use the same GroupId for object files in the same --{start, end}-lib

Fangrui Song via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 19 17:12:31 PDT 2018


MaskRay added a comment.

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;
  }


Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D45849





More information about the llvm-commits mailing list