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


>  > +          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)));

I guess I should also fix the check for a leading '/'. Here's what I
came up with:

      if (!IS_ABSOLUTE_PATH(n.c_str()))
        {
          const char *arch_path = this->name().c_str();
          const char *basename = lbasename(arch_path);
          if (basename > path)
            n.replace(0, 0, this->name().substr(0, basename - path));
        }

How's that look?

>  > +              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.

OK.

>  > +          // arch->input_file_->file().release();
>
>  Please delete this comment, or turn it into English.

Oops. That was left over from some experimentation.

>  >  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.

OK.

-cary


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