Added the load address and the section flags to ElfSection.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@39275 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
2ee3a4e272
commit
e2ea5a6646
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
|
||||
@ -23,13 +23,16 @@
|
||||
// #pragma mark - ElfSection
|
||||
|
||||
|
||||
ElfSection::ElfSection(const char* name, int fd, off_t offset, off_t size)
|
||||
ElfSection::ElfSection(const char* name, int fd, off_t offset, off_t size,
|
||||
target_addr_t loadAddress, uint32 flags)
|
||||
:
|
||||
fName(name),
|
||||
fFD(fd),
|
||||
fOffset(offset),
|
||||
fSize(size),
|
||||
fData(NULL),
|
||||
fLoadAddress(loadAddress),
|
||||
fFlags(flags),
|
||||
fLoadCount(0)
|
||||
{
|
||||
}
|
||||
@ -190,7 +193,8 @@ ElfFile::Init(const char* fileName)
|
||||
size_t sectionStringSize = stringSectionHeader->sh_size;
|
||||
|
||||
ElfSection* sectionStringSection = new(std::nothrow) ElfSection(".shstrtab",
|
||||
fFD, stringSectionHeader->sh_offset, sectionStringSize);
|
||||
fFD, stringSectionHeader->sh_offset, sectionStringSize,
|
||||
stringSectionHeader->sh_addr, stringSectionHeader->sh_flags);
|
||||
if (sectionStringSection == NULL)
|
||||
return B_NO_MEMORY;
|
||||
fSections.Add(sectionStringSection);
|
||||
@ -215,7 +219,8 @@ ElfFile::Init(const char* fileName)
|
||||
|
||||
// create an ElfSection
|
||||
ElfSection* section = new(std::nothrow) ElfSection(name, fFD,
|
||||
sectionHeader->sh_offset, sectionHeader->sh_size);
|
||||
sectionHeader->sh_offset, sectionHeader->sh_size,
|
||||
sectionHeader->sh_addr, sectionHeader->sh_flags);
|
||||
if (section == NULL)
|
||||
return B_NO_MEMORY;
|
||||
fSections.Add(section);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Copyright 2009-2010, Ingo Weinhold, ingo_weinhold@gmx.de.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*/
|
||||
#ifndef ELF_FILE_H
|
||||
@ -18,13 +18,18 @@
|
||||
class ElfSection : public DoublyLinkedListLinkImpl<ElfSection> {
|
||||
public:
|
||||
ElfSection(const char* name, int fd,
|
||||
off_t offset, off_t size);
|
||||
off_t offset, off_t size,
|
||||
target_addr_t loadAddress, uint32 flags);
|
||||
~ElfSection();
|
||||
|
||||
const char* Name() const { return fName; }
|
||||
off_t Offset() const { return fOffset; }
|
||||
off_t Size() const { return fSize; }
|
||||
const void* Data() const { return fData; }
|
||||
target_addr_t LoadAddress() const
|
||||
{ return fLoadAddress; }
|
||||
bool IsWritable() const
|
||||
{ return (fFlags & SHF_WRITE) != 0; }
|
||||
|
||||
status_t Load();
|
||||
void Unload();
|
||||
@ -35,6 +40,8 @@ private:
|
||||
off_t fOffset;
|
||||
off_t fSize;
|
||||
void* fData;
|
||||
target_addr_t fLoadAddress;
|
||||
uint32 fFlags;
|
||||
int32 fLoadCount;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user