llvm.org GIT mirror llvm / 71280b5
use 64-bit types instead of off_t/size_t to avoid the issue when gold plugin is built with Large File Support (sizeof(off_t) == 64 on i686) and the rest of LLVM is built w/o Large File Support (sizeof(off_t) == 32 on i686) which corrupts the stack. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@139873 91177308-0d34-0410-b5e6-96231b3b80d8 Ivan Krasin 8 years ago
3 changed file(s) with 8 addition(s) and 8 deletion(s). Raw diff Collapse all Expand all
7474 /// return a MemoryBuffer.
7575 static error_code getOpenFile(int FD, const char *Filename,
7676 OwningPtr &result,
77 size_t FileSize = -1,
78 size_t MapSize = -1,
79 off_t Offset = 0,
77 uint64_t FileSize = -1,
78 uint64_t MapSize = -1,
79 int64_t Offset = 0,
8080 bool RequiresNullTerminator = true);
8181
8282 /// getMemBuffer - Open the specified memory range as a MemoryBuffer. Note
274274
275275 error_code MemoryBuffer::getOpenFile(int FD, const char *Filename,
276276 OwningPtr &result,
277 size_t FileSize, size_t MapSize,
278 off_t Offset,
277 uint64_t FileSize, uint64_t MapSize,
278 int64_t Offset,
279279 bool RequiresNullTerminator) {
280280 static int PageSize = sys::Process::GetPageSize();
281281
282282 // Default is to map the full file.
283 if (MapSize == size_t(-1)) {
283 if (MapSize == uint64_t(-1)) {
284284 // If we don't know the file size, use fstat to find out. fstat on an open
285285 // file descriptor is cheaper than stat on a random path.
286 if (FileSize == size_t(-1)) {
286 if (FileSize == uint64_t(-1)) {
287287 struct stat FileInfo;
288288 // TODO: This should use fstat64 when available.
289289 if (fstat(FD, &FileInfo) == -1) {
245245 return LDPS_ERR;
246246 }
247247 } else {
248 off_t offset = 0;
248 int64_t offset = 0;
249249 // Gold has found what might be IR part-way inside of a file, such as
250250 // an .a archive.
251251 if (file->offset) {