bfd/
[binutils.git] / gold / fileread.cc
blobbb10aa9cc447e24faab86dd6055bb29184857607
1 // fileread.cc -- read files for gold
3 // Copyright 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
4 // Written by Ian Lance Taylor <iant@google.com>.
6 // This file is part of gold.
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 // MA 02110-1301, USA.
23 #include "gold.h"
25 #include <cstring>
26 #include <cerrno>
27 #include <fcntl.h>
28 #include <unistd.h>
29 #include <sys/mman.h>
30 #include <sys/uio.h>
31 #include <sys/stat.h>
32 #include "filenames.h"
34 #include "debug.h"
35 #include "parameters.h"
36 #include "options.h"
37 #include "dirsearch.h"
38 #include "target.h"
39 #include "binary.h"
40 #include "descriptors.h"
41 #include "fileread.h"
43 namespace gold
46 // Class File_read::View.
48 File_read::View::~View()
50 gold_assert(!this->is_locked());
51 if (!this->mapped_)
52 delete[] this->data_;
53 else
55 if (::munmap(const_cast<unsigned char*>(this->data_), this->size_) != 0)
56 gold_warning(_("munmap failed: %s"), strerror(errno));
58 File_read::current_mapped_bytes -= this->size_;
62 void
63 File_read::View::lock()
65 ++this->lock_count_;
68 void
69 File_read::View::unlock()
71 gold_assert(this->lock_count_ > 0);
72 --this->lock_count_;
75 bool
76 File_read::View::is_locked()
78 return this->lock_count_ > 0;
81 // Class File_read.
83 // The File_read static variables.
84 unsigned long long File_read::total_mapped_bytes;
85 unsigned long long File_read::current_mapped_bytes;
86 unsigned long long File_read::maximum_mapped_bytes;
88 File_read::~File_read()
90 gold_assert(this->token_.is_writable());
91 if (this->is_descriptor_opened_)
93 release_descriptor(this->descriptor_, true);
94 this->descriptor_ = -1;
95 this->is_descriptor_opened_ = false;
97 this->name_.clear();
98 this->clear_views(true);
101 // Open the file.
103 bool
104 File_read::open(const Task* task, const std::string& name)
106 gold_assert(this->token_.is_writable()
107 && this->descriptor_ < 0
108 && !this->is_descriptor_opened_
109 && this->name_.empty());
110 this->name_ = name;
112 this->descriptor_ = open_descriptor(-1, this->name_.c_str(),
113 O_RDONLY);
115 if (this->descriptor_ >= 0)
117 this->is_descriptor_opened_ = true;
118 struct stat s;
119 if (::fstat(this->descriptor_, &s) < 0)
120 gold_error(_("%s: fstat failed: %s"),
121 this->name_.c_str(), strerror(errno));
122 this->size_ = s.st_size;
123 gold_debug(DEBUG_FILES, "Attempt to open %s succeeded",
124 this->name_.c_str());
126 this->token_.add_writer(task);
129 return this->descriptor_ >= 0;
132 // Open the file with the contents in memory.
134 bool
135 File_read::open(const Task* task, const std::string& name,
136 const unsigned char* contents, off_t size)
138 gold_assert(this->token_.is_writable()
139 && this->descriptor_ < 0
140 && !this->is_descriptor_opened_
141 && this->name_.empty());
142 this->name_ = name;
143 this->contents_ = contents;
144 this->size_ = size;
145 this->token_.add_writer(task);
146 return true;
149 // Reopen a descriptor if necessary.
151 void
152 File_read::reopen_descriptor()
154 if (!this->is_descriptor_opened_)
156 this->descriptor_ = open_descriptor(this->descriptor_,
157 this->name_.c_str(),
158 O_RDONLY);
159 if (this->descriptor_ < 0)
160 gold_fatal(_("could not reopen file %s"), this->name_.c_str());
161 this->is_descriptor_opened_ = true;
165 // Release the file. This is called when we are done with the file in
166 // a Task.
168 void
169 File_read::release()
171 gold_assert(this->is_locked());
173 File_read::total_mapped_bytes += this->mapped_bytes_;
174 File_read::current_mapped_bytes += this->mapped_bytes_;
175 this->mapped_bytes_ = 0;
176 if (File_read::current_mapped_bytes > File_read::maximum_mapped_bytes)
177 File_read::maximum_mapped_bytes = File_read::current_mapped_bytes;
179 // Only clear views if there is only one attached object. Otherwise
180 // we waste time trying to clear cached archive views. Similarly
181 // for releasing the descriptor.
182 if (this->object_count_ <= 1)
184 this->clear_views(false);
185 if (this->is_descriptor_opened_)
187 release_descriptor(this->descriptor_, false);
188 this->is_descriptor_opened_ = false;
192 this->released_ = true;
195 // Lock the file.
197 void
198 File_read::lock(const Task* task)
200 gold_assert(this->released_);
201 this->token_.add_writer(task);
202 this->released_ = false;
205 // Unlock the file.
207 void
208 File_read::unlock(const Task* task)
210 this->release();
211 this->token_.remove_writer(task);
214 // Return whether the file is locked.
216 bool
217 File_read::is_locked() const
219 if (!this->token_.is_writable())
220 return true;
221 // The file is not locked, so it should have been released.
222 gold_assert(this->released_);
223 return false;
226 // See if we have a view which covers the file starting at START for
227 // SIZE bytes. Return a pointer to the View if found, NULL if not.
228 // If BYTESHIFT is not -1U, the returned View must have the specified
229 // byte shift; otherwise, it may have any byte shift. If VSHIFTED is
230 // not NULL, this sets *VSHIFTED to a view which would have worked if
231 // not for the requested BYTESHIFT.
233 inline File_read::View*
234 File_read::find_view(off_t start, section_size_type size,
235 unsigned int byteshift, File_read::View** vshifted) const
237 if (vshifted != NULL)
238 *vshifted = NULL;
240 off_t page = File_read::page_offset(start);
242 unsigned int bszero = 0;
243 Views::const_iterator p = this->views_.upper_bound(std::make_pair(page - 1,
244 bszero));
246 while (p != this->views_.end() && p->first.first <= page)
248 if (p->second->start() <= start
249 && (p->second->start() + static_cast<off_t>(p->second->size())
250 >= start + static_cast<off_t>(size)))
252 if (byteshift == -1U || byteshift == p->second->byteshift())
254 p->second->set_accessed();
255 return p->second;
258 if (vshifted != NULL && *vshifted == NULL)
259 *vshifted = p->second;
262 ++p;
265 return NULL;
268 // Read SIZE bytes from the file starting at offset START. Read into
269 // the buffer at P.
271 void
272 File_read::do_read(off_t start, section_size_type size, void* p)
274 ssize_t bytes;
275 if (this->contents_ != NULL)
277 bytes = this->size_ - start;
278 if (static_cast<section_size_type>(bytes) >= size)
280 memcpy(p, this->contents_ + start, size);
281 return;
284 else
286 this->reopen_descriptor();
287 bytes = ::pread(this->descriptor_, p, size, start);
288 if (static_cast<section_size_type>(bytes) == size)
289 return;
291 if (bytes < 0)
293 gold_fatal(_("%s: pread failed: %s"),
294 this->filename().c_str(), strerror(errno));
295 return;
299 gold_fatal(_("%s: file too short: read only %lld of %lld bytes at %lld"),
300 this->filename().c_str(),
301 static_cast<long long>(bytes),
302 static_cast<long long>(size),
303 static_cast<long long>(start));
306 // Read data from the file.
308 void
309 File_read::read(off_t start, section_size_type size, void* p)
311 const File_read::View* pv = this->find_view(start, size, -1U, NULL);
312 if (pv != NULL)
314 memcpy(p, pv->data() + (start - pv->start() + pv->byteshift()), size);
315 return;
318 this->do_read(start, size, p);
321 // Add a new view. There may already be an existing view at this
322 // offset. If there is, the new view will be larger, and should
323 // replace the old view.
325 void
326 File_read::add_view(File_read::View* v)
328 std::pair<Views::iterator, bool> ins =
329 this->views_.insert(std::make_pair(std::make_pair(v->start(),
330 v->byteshift()),
331 v));
332 if (ins.second)
333 return;
335 // There was an existing view at this offset. It must not be large
336 // enough. We can't delete it here, since something might be using
337 // it; we put it on a list to be deleted when the file is unlocked.
338 File_read::View* vold = ins.first->second;
339 gold_assert(vold->size() < v->size());
340 if (vold->should_cache())
342 v->set_cache();
343 vold->clear_cache();
345 this->saved_views_.push_back(vold);
347 ins.first->second = v;
350 // Make a new view with a specified byteshift, reading the data from
351 // the file.
353 File_read::View*
354 File_read::make_view(off_t start, section_size_type size,
355 unsigned int byteshift, bool cache)
357 gold_assert(size > 0);
359 // Check that start and end of the view are within the file.
360 if (start > this->size_
361 || (static_cast<unsigned long long>(size)
362 > static_cast<unsigned long long>(this->size_ - start)))
363 gold_fatal(_("%s: attempt to map %lld bytes at offset %lld exceeds "
364 "size of file; the file may be corrupt"),
365 this->filename().c_str(),
366 static_cast<long long>(size),
367 static_cast<long long>(start));
369 off_t poff = File_read::page_offset(start);
371 section_size_type psize = File_read::pages(size + (start - poff));
373 if (poff + static_cast<off_t>(psize) >= this->size_)
375 psize = this->size_ - poff;
376 gold_assert(psize >= size);
379 File_read::View* v;
380 if (this->contents_ != NULL || byteshift != 0)
382 unsigned char* p = new unsigned char[psize + byteshift];
383 memset(p, 0, byteshift);
384 this->do_read(poff, psize, p + byteshift);
385 v = new File_read::View(poff, psize, p, byteshift, cache, false);
387 else
389 this->reopen_descriptor();
390 void* p = ::mmap(NULL, psize, PROT_READ, MAP_PRIVATE,
391 this->descriptor_, poff);
392 if (p == MAP_FAILED)
393 gold_fatal(_("%s: mmap offset %lld size %lld failed: %s"),
394 this->filename().c_str(),
395 static_cast<long long>(poff),
396 static_cast<long long>(psize),
397 strerror(errno));
399 this->mapped_bytes_ += psize;
401 const unsigned char* pbytes = static_cast<const unsigned char*>(p);
402 v = new File_read::View(poff, psize, pbytes, 0, cache, true);
405 this->add_view(v);
407 return v;
410 // Find a View or make a new one, shifted as required by the file
411 // offset OFFSET and ALIGNED.
413 File_read::View*
414 File_read::find_or_make_view(off_t offset, off_t start,
415 section_size_type size, bool aligned, bool cache)
417 unsigned int byteshift;
418 if (offset == 0)
419 byteshift = 0;
420 else
422 unsigned int target_size = (!parameters->target_valid()
423 ? 64
424 : parameters->target().get_size());
425 byteshift = offset & ((target_size / 8) - 1);
427 // Set BYTESHIFT to the number of dummy bytes which must be
428 // inserted before the data in order for this data to be
429 // aligned.
430 if (byteshift != 0)
431 byteshift = (target_size / 8) - byteshift;
434 // Try to find a View with the required BYTESHIFT.
435 File_read::View* vshifted;
436 File_read::View* v = this->find_view(offset + start, size,
437 aligned ? byteshift : -1U,
438 &vshifted);
439 if (v != NULL)
441 if (cache)
442 v->set_cache();
443 return v;
446 // If VSHIFTED is not NULL, then it has the data we need, but with
447 // the wrong byteshift.
448 v = vshifted;
449 if (v != NULL)
451 gold_assert(aligned);
453 unsigned char* pbytes = new unsigned char[v->size() + byteshift];
454 memset(pbytes, 0, byteshift);
455 memcpy(pbytes + byteshift, v->data() + v->byteshift(), v->size());
457 File_read::View* shifted_view = new File_read::View(v->start(), v->size(),
458 pbytes, byteshift,
459 cache, false);
461 this->add_view(shifted_view);
462 return shifted_view;
465 // Make a new view. If we don't need an aligned view, use a
466 // byteshift of 0, so that we can use mmap.
467 return this->make_view(offset + start, size,
468 aligned ? byteshift : 0,
469 cache);
472 // Get a view into the file.
474 const unsigned char*
475 File_read::get_view(off_t offset, off_t start, section_size_type size,
476 bool aligned, bool cache)
478 File_read::View* pv = this->find_or_make_view(offset, start, size,
479 aligned, cache);
480 return pv->data() + (offset + start - pv->start() + pv->byteshift());
483 File_view*
484 File_read::get_lasting_view(off_t offset, off_t start, section_size_type size,
485 bool aligned, bool cache)
487 File_read::View* pv = this->find_or_make_view(offset, start, size,
488 aligned, cache);
489 pv->lock();
490 return new File_view(*this, pv,
491 (pv->data()
492 + (offset + start - pv->start() + pv->byteshift())));
495 // Use readv to read COUNT entries from RM starting at START. BASE
496 // must be added to all file offsets in RM.
498 void
499 File_read::do_readv(off_t base, const Read_multiple& rm, size_t start,
500 size_t count)
502 unsigned char discard[File_read::page_size];
503 iovec iov[File_read::max_readv_entries * 2];
504 size_t iov_index = 0;
506 off_t first_offset = rm[start].file_offset;
507 off_t last_offset = first_offset;
508 ssize_t want = 0;
509 for (size_t i = 0; i < count; ++i)
511 const Read_multiple_entry& i_entry(rm[start + i]);
513 if (i_entry.file_offset > last_offset)
515 size_t skip = i_entry.file_offset - last_offset;
516 gold_assert(skip <= sizeof discard);
518 iov[iov_index].iov_base = discard;
519 iov[iov_index].iov_len = skip;
520 ++iov_index;
522 want += skip;
525 iov[iov_index].iov_base = i_entry.buffer;
526 iov[iov_index].iov_len = i_entry.size;
527 ++iov_index;
529 want += i_entry.size;
531 last_offset = i_entry.file_offset + i_entry.size;
534 this->reopen_descriptor();
536 gold_assert(iov_index < sizeof iov / sizeof iov[0]);
538 if (::lseek(this->descriptor_, base + first_offset, SEEK_SET) < 0)
539 gold_fatal(_("%s: lseek failed: %s"),
540 this->filename().c_str(), strerror(errno));
542 ssize_t got = ::readv(this->descriptor_, iov, iov_index);
544 if (got < 0)
545 gold_fatal(_("%s: readv failed: %s"),
546 this->filename().c_str(), strerror(errno));
547 if (got != want)
548 gold_fatal(_("%s: file too short: read only %zd of %zd bytes at %lld"),
549 this->filename().c_str(),
550 got, want, static_cast<long long>(base + first_offset));
553 // Read several pieces of data from the file.
555 void
556 File_read::read_multiple(off_t base, const Read_multiple& rm)
558 size_t count = rm.size();
559 size_t i = 0;
560 while (i < count)
562 // Find up to MAX_READV_ENTRIES consecutive entries which are
563 // less than one page apart.
564 const Read_multiple_entry& i_entry(rm[i]);
565 off_t i_off = i_entry.file_offset;
566 off_t end_off = i_off + i_entry.size;
567 size_t j;
568 for (j = i + 1; j < count; ++j)
570 if (j - i >= File_read::max_readv_entries)
571 break;
572 const Read_multiple_entry& j_entry(rm[j]);
573 off_t j_off = j_entry.file_offset;
574 gold_assert(j_off >= end_off);
575 off_t j_end_off = j_off + j_entry.size;
576 if (j_end_off - end_off >= File_read::page_size)
577 break;
578 end_off = j_end_off;
581 if (j == i + 1)
582 this->read(base + i_off, i_entry.size, i_entry.buffer);
583 else
585 File_read::View* view = this->find_view(base + i_off,
586 end_off - i_off,
587 -1U, NULL);
588 if (view == NULL)
589 this->do_readv(base, rm, i, j - i);
590 else
592 const unsigned char* v = (view->data()
593 + (base + i_off - view->start()
594 + view->byteshift()));
595 for (size_t k = i; k < j; ++k)
597 const Read_multiple_entry& k_entry(rm[k]);
598 gold_assert((convert_to_section_size_type(k_entry.file_offset
599 - i_off)
600 + k_entry.size)
601 <= convert_to_section_size_type(end_off
602 - i_off));
603 memcpy(k_entry.buffer,
604 v + (k_entry.file_offset - i_off),
605 k_entry.size);
610 i = j;
614 // Mark all views as no longer cached.
616 void
617 File_read::clear_view_cache_marks()
619 // Just ignore this if there are multiple objects associated with
620 // the file. Otherwise we will wind up uncaching and freeing some
621 // views for other objects.
622 if (this->object_count_ > 1)
623 return;
625 for (Views::iterator p = this->views_.begin();
626 p != this->views_.end();
627 ++p)
628 p->second->clear_cache();
629 for (Saved_views::iterator p = this->saved_views_.begin();
630 p != this->saved_views_.end();
631 ++p)
632 (*p)->clear_cache();
635 // Remove all the file views. For a file which has multiple
636 // associated objects (i.e., an archive), we keep accessed views
637 // around until next time, in the hopes that they will be useful for
638 // the next object.
640 void
641 File_read::clear_views(bool destroying)
643 Views::iterator p = this->views_.begin();
644 while (p != this->views_.end())
646 bool should_delete;
647 if (p->second->is_locked())
648 should_delete = false;
649 else if (destroying)
650 should_delete = true;
651 else if (p->second->should_cache())
652 should_delete = false;
653 else if (this->object_count_ > 1 && p->second->accessed())
654 should_delete = false;
655 else
656 should_delete = true;
658 if (should_delete)
660 delete p->second;
662 // map::erase invalidates only the iterator to the deleted
663 // element.
664 Views::iterator pe = p;
665 ++p;
666 this->views_.erase(pe);
668 else
670 gold_assert(!destroying);
671 p->second->clear_accessed();
672 ++p;
676 Saved_views::iterator q = this->saved_views_.begin();
677 while (q != this->saved_views_.end())
679 if (!(*q)->is_locked())
681 delete *q;
682 q = this->saved_views_.erase(q);
684 else
686 gold_assert(!destroying);
687 ++q;
692 // Print statistical information to stderr. This is used for --stats.
694 void
695 File_read::print_stats()
697 fprintf(stderr, _("%s: total bytes mapped for read: %llu\n"),
698 program_name, File_read::total_mapped_bytes);
699 fprintf(stderr, _("%s: maximum bytes mapped for read at one time: %llu\n"),
700 program_name, File_read::maximum_mapped_bytes);
703 // Class File_view.
705 File_view::~File_view()
707 gold_assert(this->file_.is_locked());
708 this->view_->unlock();
711 // Class Input_file.
713 // Create a file for testing.
715 Input_file::Input_file(const Task* task, const char* name,
716 const unsigned char* contents, off_t size)
717 : file_()
719 this->input_argument_ =
720 new Input_file_argument(name, false, "", false,
721 Position_dependent_options());
722 bool ok = this->file_.open(task, name, contents, size);
723 gold_assert(ok);
726 // Return the position dependent options in force for this file.
728 const Position_dependent_options&
729 Input_file::options() const
731 return this->input_argument_->options();
734 // Return the name given by the user. For -lc this will return "c".
736 const char*
737 Input_file::name() const
739 return this->input_argument_->name();
742 // Return whether this file is in a system directory.
744 bool
745 Input_file::is_in_system_directory() const
747 if (this->is_in_sysroot())
748 return true;
749 return parameters->options().is_in_system_directory(this->filename());
752 // Return whether we are only reading symbols.
754 bool
755 Input_file::just_symbols() const
757 return this->input_argument_->just_symbols();
760 // Return whether this is a file that we will search for in the list
761 // of directories.
763 bool
764 Input_file::will_search_for() const
766 return (!IS_ABSOLUTE_PATH(this->input_argument_->name())
767 && (this->input_argument_->is_lib()
768 || this->input_argument_->extra_search_path() != NULL));
771 // Return the file last modification time. Calls gold_fatal if the stat
772 // system call failed.
774 Timespec
775 File_read::get_mtime()
777 struct stat file_stat;
778 this->reopen_descriptor();
780 if (fstat(this->descriptor_, &file_stat) < 0)
781 gold_fatal(_("%s: stat failed: %s"), this->name_.c_str(),
782 strerror(errno));
783 // TODO: do a configure check if st_mtim is present and get the
784 // nanoseconds part if it is.
785 return Timespec(file_stat.st_mtime, 0);
788 // Open the file.
790 // If the filename is not absolute, we assume it is in the current
791 // directory *except* when:
792 // A) input_argument_->is_lib() is true; or
793 // B) input_argument_->extra_search_path() is not empty.
794 // In both cases, we look in extra_search_path + library_path to find
795 // the file location, rather than the current directory.
797 bool
798 Input_file::open(const Dirsearch& dirpath, const Task* task, int *pindex)
800 std::string name;
802 // Case 1: name is an absolute file, just try to open it
803 // Case 2: name is relative but is_lib is false and extra_search_path
804 // is empty
805 if (IS_ABSOLUTE_PATH(this->input_argument_->name())
806 || (!this->input_argument_->is_lib()
807 && this->input_argument_->extra_search_path() == NULL))
809 name = this->input_argument_->name();
810 this->found_name_ = name;
812 // Case 3: is_lib is true
813 else if (this->input_argument_->is_lib())
815 // We don't yet support extra_search_path with -l.
816 gold_assert(this->input_argument_->extra_search_path() == NULL);
817 std::string n1("lib");
818 n1 += this->input_argument_->name();
819 std::string n2;
820 if (parameters->options().is_static()
821 || !this->input_argument_->options().Bdynamic())
822 n1 += ".a";
823 else
825 n2 = n1 + ".a";
826 n1 += ".so";
828 name = dirpath.find(n1, n2, &this->is_in_sysroot_, pindex);
829 if (name.empty())
831 gold_error(_("cannot find -l%s"),
832 this->input_argument_->name());
833 return false;
835 if (n2.empty() || name[name.length() - 1] == 'o')
836 this->found_name_ = n1;
837 else
838 this->found_name_ = n2;
840 // Case 4: extra_search_path is not empty
841 else
843 gold_assert(this->input_argument_->extra_search_path() != NULL);
845 // First, check extra_search_path.
846 name = this->input_argument_->extra_search_path();
847 if (!IS_DIR_SEPARATOR (name[name.length() - 1]))
848 name += '/';
849 name += this->input_argument_->name();
850 struct stat dummy_stat;
851 if (*pindex > 0 || ::stat(name.c_str(), &dummy_stat) < 0)
853 // extra_search_path failed, so check the normal search-path.
854 int index = *pindex;
855 if (index > 0)
856 --index;
857 name = dirpath.find(this->input_argument_->name(), "",
858 &this->is_in_sysroot_, &index);
859 if (name.empty())
861 gold_error(_("cannot find %s"),
862 this->input_argument_->name());
863 return false;
865 *pindex = index + 1;
867 this->found_name_ = this->input_argument_->name();
870 // Now that we've figured out where the file lives, try to open it.
872 General_options::Object_format format =
873 this->input_argument_->options().format_enum();
874 bool ok;
875 if (format == General_options::OBJECT_FORMAT_ELF)
876 ok = this->file_.open(task, name);
877 else
879 gold_assert(format == General_options::OBJECT_FORMAT_BINARY);
880 ok = this->open_binary(task, name);
883 if (!ok)
885 gold_error(_("cannot open %s: %s"),
886 name.c_str(), strerror(errno));
887 return false;
890 return true;
893 // Open a file for --format binary.
895 bool
896 Input_file::open_binary(const Task* task, const std::string& name)
898 // In order to open a binary file, we need machine code, size, and
899 // endianness. We may not have a valid target at this point, in
900 // which case we use the default target.
901 const Target* target;
902 if (parameters->target_valid())
903 target = &parameters->target();
904 else
905 target = &parameters->default_target();
907 Binary_to_elf binary_to_elf(target->machine_code(),
908 target->get_size(),
909 target->is_big_endian(),
910 name);
911 if (!binary_to_elf.convert(task))
912 return false;
913 return this->file_.open(task, name, binary_to_elf.converted_data_leak(),
914 binary_to_elf.converted_size());
917 } // End namespace gold.