This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: Add gold support for "thin" archives


"Cary Coutant" <ccoutant@google.com> writes:

> +          size_t archive_dir_len = this->name().find_last_of('/');

Here we are looking at a file name, not a name in an archive.  In
order to work properly on Windows file systems, I think this should
be something along the lines of:

  const char* basename = lbasename(this->name().c_str());
  if (basename != this->name().c_str())
    n.replace(0, 0,
              this->name().substr(0, this->name().length() - strlen(basename)));



> +              if (!input_file->open(this->options_, *this->dirpath_,
> +                                    this->task_))
> +                return;

Although Input_file::open already gave an error message, I think it
might be a good idea to issue another error message here to say why we
were trying to open that file.


> +          // arch->input_file_->file().release();

Please delete this comment, or turn it into English.


>  class Archive
>  {
>   public:
> -  Archive(const std::string& name, Input_file* input_file)
> +  Archive(const std::string& name, Input_file* input_file,
> +          bool is_thin_archive, const General_options& options,
> +          Dirsearch* dirpath, Task* task)
>      : name_(name), input_file_(input_file), armap_(), armap_names_(),
> -      extended_names_(), armap_checked_(), seen_offsets_()
> +      extended_names_(), armap_checked_(), seen_offsets_(),
> +      is_thin_archive_(is_thin_archive), options_(options),
> +      dirpath_(dirpath), task_(task)
>    { }

Let's not pass around General_options, as we can now get it from 
parameters->options().  It's OK to keep passing it to
Input_file::open, but no need to store it in Archive.


Ideally this should have some test cases, but they'll need a configure
check for a version of ar which supports thin archives.  It's OK to
add them later.


OK with those changes.

Thanks.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]