Commit Graph

46 Commits

Author SHA1 Message Date
Reid Spencer 69fb378858 When reading the symbol table, make sure to delete the ArchiveMember
created by reading the symbol table.

llvm-svn: 28251
2006-05-12 17:56:20 +00:00
Jeff Cohen 9978476c14 Apply bug fix supplied by Greg Pettyjohn for a bug he found: '<invalid>' is not a legal path on Windows.
llvm-svn: 28153
2006-05-06 23:25:53 +00:00
Duraid Madina c58523442a more C++ daintiness
llvm-svn: 25023
2005-12-26 14:31:26 +00:00
Reid Spencer 3fd1b4c9bf Fix a problem with llvm-ranlib that (on some platforms) caused the archive
file to become corrupted due to interactions between mmap'd memory segments
and file descriptors closing. The problem is completely avoiding by using
a third temporary file.

Patch provided by Evan Jones

llvm-svn: 24527
2005-11-30 05:21:10 +00:00
Chris Lattner bde3845548 DONT_BUILD_RELINKED is gone and implied by BUILD_ARCHIVE now
llvm-svn: 23940
2005-10-24 02:26:13 +00:00
Chris Lattner 1e3d3148bb speed up Archive::isBytecodeArchive in the case when the archive doesn't have
an llvm-ranlib symtab.  This speeds up gccld -native on an almost empty .o file
from 1.63s to 0.18s.

llvm-svn: 23406
2005-09-23 06:22:58 +00:00
Reid Spencer af48d8643d Final Changes For PR495:
This chagne just renames some sys::Path methods to ensure they are not
misused. The Path documentation now divides methods into two dimensions:
Path/Disk and accessor/mutator. Path accessors and mutators only operate
on the Path object itself without making any disk accesses. Disk accessors
and mutators will also access or modify the file system. Because of the
potentially destructive nature of disk mutators, it was decided that all
such methods should end in the work "Disk" to ensure the user recognizes
that the change will occur on the file system. This patch makes that
change. The method name changes are:

makeReadable        -> makeReadableOnDisk
makeWriteable       -> makeWriteableOnDisk
makeExecutable      -> makeExecutableOnDisk
setStatusInfo       -> setStatusInfoOnDisk
createDirectory     -> createDirectoryOnDisk
createFile          -> createFileOnDisk
createTemporaryFile -> createTemporaryFileOnDisk
destroy             -> eraseFromDisk
rename              -> renamePathOnDisk

These changes pass the Linux Deja Gnu tests.

llvm-svn: 22354
2005-07-08 03:08:58 +00:00
Reid Spencer c9c0473fa5 For PR495:
Get rid of the difference between file paths and directory paths. The Path
class now simply stores a path that can refer to either a file or a
directory. This required various changes in the implementation and interface
of the class with the corresponding impact to its users. Doxygen comments were
also updated to reflect these changes. Interface changes are:

appendDirectory -> appendComponent
appendFile -> appendComponent
elideDirectory -> eraseComponent
elideFile -> eraseComponent
elideSuffix -> eraseSuffix
renameFile -> rename
setDirectory -> set
setFile -> set

Changes pass Dejagnu and llvm-test/SingleSource tests.

llvm-svn: 22349
2005-07-07 23:21:43 +00:00
Misha Brukman 291f6b7223 Remove vim settings from source code; people should use llvm/utils/vim/vimrc
llvm-svn: 21704
2005-05-05 22:33:09 +00:00
Misha Brukman 01808caded Remove trailing whitespace
llvm-svn: 21416
2005-04-21 21:13:18 +00:00
Reid Spencer c8b5d60937 Use the actual uid/gid for defaulting the fields in the archive.
llvm-svn: 21405
2005-04-21 17:49:57 +00:00
Reid Spencer ce7ce1628f Eliminate calls to system dependent function getuid by using
the newly implemented sys::Process::GetCurrentUserId function. Replace
similarly for getgid.

llvm-svn: 21402
2005-04-21 16:15:19 +00:00
Misha Brukman 8cd50bf269 Initialize fields mode, uid, and gid.
Patch by Markus Oberhumer.  Thanks!

llvm-svn: 21369
2005-04-20 03:55:35 +00:00
Misha Brukman bebcaeb816 Align comments together for consistency
llvm-svn: 21368
2005-04-20 03:52:59 +00:00
Reid Spencer 709e10ed92 Implement an isBytecodeArchive method to determine if an archive contains
bytecode file members or not.
Patch Contributed By Adam Treat

llvm-svn: 20338
2005-02-26 22:00:32 +00:00
Jeff Cohen 971e03d74a Properly close mapped files.
llvm-svn: 19863
2005-01-28 01:17:07 +00:00
Jeff Cohen c8f1f4bc8e Use binary mode for reading/writing bytecode files
llvm-svn: 19751
2005-01-22 17:36:17 +00:00
Reid Spencer 9f4bb585f5 Remove potential platform portability issue with size of "int".
llvm-svn: 19172
2004-12-29 01:20:24 +00:00
Jeff Cohen be92640355 Fix problems uncovered by VC++ (first time compiled by VC++)
llvm-svn: 19056
2004-12-20 03:23:46 +00:00
Reid Spencer 9329172767 For PR351:
* Remove #inclusion of FileUtilities.h, not needed any more.
* Convert getUniqueFilename -> sys::Pat::makeUnique()

llvm-svn: 18948
2004-12-15 01:51:56 +00:00
Reid Spencer ac9fe82875 Make sure the Archive gets deleted if there's an error.
llvm-svn: 18869
2004-12-13 03:22:31 +00:00
Reid Spencer a204547e32 Implement error handling in OpenAndLoad* functions so the Linker can handle it.
llvm-svn: 18853
2004-12-13 02:59:03 +00:00
Reid Spencer 5ccfd5a48b Path::get -> Path::toString
llvm-svn: 18785
2004-12-11 00:14:15 +00:00
Reid Spencer 8a3312cab3 Compute the firstFileOffset correctly after reading the LLVM symbol table.
llvm-svn: 18300
2004-11-28 03:13:02 +00:00
Reid Spencer af6fd29a08 Adjust to Compressor interface change
llvm-svn: 18249
2004-11-25 19:38:05 +00:00
Reid Spencer a193f3cdbf Allow reading of member names that begin with an _ character.
llvm-svn: 18179
2004-11-23 22:35:39 +00:00
Reid Spencer 7a32486483 Distinguish between BSD4.4 and SVR4 symbol tables
llvm-svn: 18044
2004-11-20 07:29:40 +00:00
Reid Spencer 78e12c73e5 Correct the computation of when to add the padding. It is not based on the
member's size. It is based on the oddness/evenness of the file pointer.
This fixes a bug with llvm-ar not being able to read archives produced by
llvm-ranlib when there are members with odd long file name lengths.

llvm-svn: 17997
2004-11-19 17:08:00 +00:00
Reid Spencer fc9f779039 Don't save an iterator, just use post-increment.
llvm-svn: 17981
2004-11-19 03:44:10 +00:00
Reid Spencer 39a0347b79 Make findModulesDefiningSymbols modify its symbols argument so we can \
eliminate symbols defined by the archive efficiently

llvm-svn: 17976
2004-11-19 03:18:22 +00:00
Reid Spencer 67c46c8d70 Fix some things for Mac OSX archives:
* ensure trailing spaces are eliminated so they don't factor into the
  length of a member's name.
* make sure all the bytes of a name are written even if the name ends in
  multiple null characters (bug in OSX ar)
* make sure we provide the full member name when searching for symbols so
  the module name is not accidentally duplicated.

llvm-svn: 17918
2004-11-17 18:28:29 +00:00
Reid Spencer b58bf5fa28 Make sure we parse bytecode with a module identifier that reflects the full
name of the module: "Archive.a(object.o)"

llvm-svn: 17917
2004-11-17 18:25:21 +00:00
Reid Spencer 1154bb6b43 Adjust long file name writing to match BSD 4.4 and Mac OSX style archives.
llvm-svn: 17910
2004-11-17 16:14:21 +00:00
Reid Spencer 0dea46fe67 Despite documentation to the contrary, Mac OSX and BSD 4.4 archive formats
*do* include the length of the long file in the length of the member and
they are *not* null terminated.

llvm-svn: 17909
2004-11-17 16:13:11 +00:00
Reid Spencer 4c66d89b33 Fix typeo in comment.
llvm-svn: 17892
2004-11-16 07:05:16 +00:00
Reid Spencer 8d784fbd3f Per code review:\
* Make the numVbrBytes function more efficient and better documented \
* Fix a bug in name truncation \
* Add comments before functions \
* Get rid of functions that are now inlined into the header \
* Do not have Archive doing symbol table printing \
* Put assert comments into the assert so they print out \
* Make sure foreign symbol tables are written

llvm-svn: 17884
2004-11-16 06:47:30 +00:00
Reid Spencer 4abd79e8ea Per code review:\
* Make sure we write out the foreign symbol table if we read one \
* Make the padding calculation more efficiently and avoid Solaris warnings

llvm-svn: 17883
2004-11-16 06:47:19 +00:00
Reid Spencer 40878f35de Per code review:\
* Make sure all members are initialized upon construction

llvm-svn: 17882
2004-11-16 06:47:07 +00:00
Reid Spencer cbd9aeb587 * Make sure the string table gets read even if there isn't a foreign
symbol table.
* Make sure we update the file pointer for each member when rebuilding the
  symbol table.

llvm-svn: 17812
2004-11-15 01:40:20 +00:00
Reid Spencer fcf5ef7a4a Changes necessary to enable linking of archives without LLVM symbol tables.
llvm-svn: 17811
2004-11-15 01:20:11 +00:00
Reid Spencer f0c201b34d Completely rewritten to allow reading of archives and symbol table lookup in a more efficient manner.
llvm-svn: 17767
2004-11-14 21:58:33 +00:00
Reid Spencer 948ff3d628 Implementation declarations for Archive
llvm-svn: 17766
2004-11-14 21:57:46 +00:00
Reid Spencer ba09b3bf28 First working version
llvm-svn: 17765
2004-11-14 21:56:59 +00:00
Reid Spencer b9e561e90c Moved to lib/Bytecode/Archive in preparation for re-write.
llvm-svn: 17742
2004-11-14 19:59:40 +00:00
Reid Spencer 0f8359b061 Makefile for the LLVMArchive library.
llvm-svn: 17500
2004-11-06 08:52:36 +00:00
Reid Spencer 0cc653e59b First kinda/sorta working version of the Archive library. Reading is not
yet supported but writing works. Way too early to review this. More to come

llvm-svn: 17499
2004-11-06 08:51:45 +00:00