[llvm-commits] [llvm] r139873 - in /llvm/trunk: include/llvm/Support/MemoryBuffer.h lib/Support/MemoryBuffer.cpp tools/gold/gold-plugin.cpp
Ivan Krasin
krasin at chromium.org
Thu Sep 15 16:13:00 PDT 2011
Author: krasin
Date: Thu Sep 15 18:13:00 2011
New Revision: 139873
URL: http://llvm.org/viewvc/llvm-project?rev=139873&view=rev
Log:
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.
Modified:
llvm/trunk/include/llvm/Support/MemoryBuffer.h
llvm/trunk/lib/Support/MemoryBuffer.cpp
llvm/trunk/tools/gold/gold-plugin.cpp
Modified: llvm/trunk/include/llvm/Support/MemoryBuffer.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/MemoryBuffer.h?rev=139873&r1=139872&r2=139873&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/MemoryBuffer.h (original)
+++ llvm/trunk/include/llvm/Support/MemoryBuffer.h Thu Sep 15 18:13:00 2011
@@ -75,9 +75,9 @@
/// return a MemoryBuffer.
static error_code getOpenFile(int FD, const char *Filename,
OwningPtr<MemoryBuffer> &result,
- size_t FileSize = -1,
- size_t MapSize = -1,
- off_t Offset = 0,
+ uint64_t FileSize = -1,
+ uint64_t MapSize = -1,
+ int64_t Offset = 0,
bool RequiresNullTerminator = true);
/// getMemBuffer - Open the specified memory range as a MemoryBuffer. Note
Modified: llvm/trunk/lib/Support/MemoryBuffer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/MemoryBuffer.cpp?rev=139873&r1=139872&r2=139873&view=diff
==============================================================================
--- llvm/trunk/lib/Support/MemoryBuffer.cpp (original)
+++ llvm/trunk/lib/Support/MemoryBuffer.cpp Thu Sep 15 18:13:00 2011
@@ -275,16 +275,16 @@
error_code MemoryBuffer::getOpenFile(int FD, const char *Filename,
OwningPtr<MemoryBuffer> &result,
- size_t FileSize, size_t MapSize,
- off_t Offset,
+ uint64_t FileSize, uint64_t MapSize,
+ int64_t Offset,
bool RequiresNullTerminator) {
static int PageSize = sys::Process::GetPageSize();
// Default is to map the full file.
- if (MapSize == size_t(-1)) {
+ if (MapSize == uint64_t(-1)) {
// If we don't know the file size, use fstat to find out. fstat on an open
// file descriptor is cheaper than stat on a random path.
- if (FileSize == size_t(-1)) {
+ if (FileSize == uint64_t(-1)) {
struct stat FileInfo;
// TODO: This should use fstat64 when available.
if (fstat(FD, &FileInfo) == -1) {
Modified: llvm/trunk/tools/gold/gold-plugin.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/gold/gold-plugin.cpp?rev=139873&r1=139872&r2=139873&view=diff
==============================================================================
--- llvm/trunk/tools/gold/gold-plugin.cpp (original)
+++ llvm/trunk/tools/gold/gold-plugin.cpp Thu Sep 15 18:13:00 2011
@@ -246,7 +246,7 @@
return LDPS_ERR;
}
} else {
- off_t offset = 0;
+ int64_t offset = 0;
// Gold has found what might be IR part-way inside of a file, such as
// an .a archive.
if (file->offset) {
More information about the llvm-commits
mailing list