mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-08 19:25:47 +00:00
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
This commit is contained in:
@@ -75,9 +75,9 @@ public:
|
|||||||
/// return a MemoryBuffer.
|
/// return a MemoryBuffer.
|
||||||
static error_code getOpenFile(int FD, const char *Filename,
|
static error_code getOpenFile(int FD, const char *Filename,
|
||||||
OwningPtr<MemoryBuffer> &result,
|
OwningPtr<MemoryBuffer> &result,
|
||||||
size_t FileSize = -1,
|
uint64_t FileSize = -1,
|
||||||
size_t MapSize = -1,
|
uint64_t MapSize = -1,
|
||||||
off_t Offset = 0,
|
int64_t Offset = 0,
|
||||||
bool RequiresNullTerminator = true);
|
bool RequiresNullTerminator = true);
|
||||||
|
|
||||||
/// getMemBuffer - Open the specified memory range as a MemoryBuffer. Note
|
/// getMemBuffer - Open the specified memory range as a MemoryBuffer. Note
|
||||||
|
@@ -275,16 +275,16 @@ static bool shouldUseMmap(int FD,
|
|||||||
|
|
||||||
error_code MemoryBuffer::getOpenFile(int FD, const char *Filename,
|
error_code MemoryBuffer::getOpenFile(int FD, const char *Filename,
|
||||||
OwningPtr<MemoryBuffer> &result,
|
OwningPtr<MemoryBuffer> &result,
|
||||||
size_t FileSize, size_t MapSize,
|
uint64_t FileSize, uint64_t MapSize,
|
||||||
off_t Offset,
|
int64_t Offset,
|
||||||
bool RequiresNullTerminator) {
|
bool RequiresNullTerminator) {
|
||||||
static int PageSize = sys::Process::GetPageSize();
|
static int PageSize = sys::Process::GetPageSize();
|
||||||
|
|
||||||
// Default is to map the full file.
|
// 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
|
// 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.
|
// file descriptor is cheaper than stat on a random path.
|
||||||
if (FileSize == size_t(-1)) {
|
if (FileSize == uint64_t(-1)) {
|
||||||
struct stat FileInfo;
|
struct stat FileInfo;
|
||||||
// TODO: This should use fstat64 when available.
|
// TODO: This should use fstat64 when available.
|
||||||
if (fstat(FD, &FileInfo) == -1) {
|
if (fstat(FD, &FileInfo) == -1) {
|
||||||
|
@@ -246,7 +246,7 @@ static ld_plugin_status claim_file_hook(const ld_plugin_input_file *file,
|
|||||||
return LDPS_ERR;
|
return LDPS_ERR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
off_t offset = 0;
|
int64_t offset = 0;
|
||||||
// Gold has found what might be IR part-way inside of a file, such as
|
// Gold has found what might be IR part-way inside of a file, such as
|
||||||
// an .a archive.
|
// an .a archive.
|
||||||
if (file->offset) {
|
if (file->offset) {
|
||||||
|
Reference in New Issue
Block a user