elf.h: rename ELF_MAGIC to ELFMAG
- This is how it is named in other versions of elf.h (Linux, glibc, possibly more) - ELF_MAGIC is used by libelf for the same thing, and the defines conflicts, breaking libelf build on Haiku.
This commit is contained in:
@@ -75,7 +75,7 @@ typedef struct {
|
|||||||
#endif
|
#endif
|
||||||
} Elf64_Ehdr;
|
} Elf64_Ehdr;
|
||||||
|
|
||||||
#define ELF_MAGIC "\x7f""ELF"
|
#define ELFMAG "\x7f""ELF"
|
||||||
|
|
||||||
/* e_ident[] indices */
|
/* e_ident[] indices */
|
||||||
#define EI_MAG0 0
|
#define EI_MAG0 0
|
||||||
|
|||||||
@@ -277,7 +277,7 @@ ImageFile::_LoadFile(const char* path, addr_t* _textAddress, size_t* _textSize,
|
|||||||
|
|
||||||
// examine the elf header
|
// examine the elf header
|
||||||
elf_ehdr* elfHeader = (elf_ehdr*)fMappedFile;
|
elf_ehdr* elfHeader = (elf_ehdr*)fMappedFile;
|
||||||
if (memcmp(elfHeader->e_ident, ELF_MAGIC, 4) != 0)
|
if (memcmp(elfHeader->e_ident, ELFMAG, 4) != 0)
|
||||||
return B_NOT_AN_EXECUTABLE;
|
return B_NOT_AN_EXECUTABLE;
|
||||||
|
|
||||||
if (elfHeader->e_ident[4] != ELF_CLASS)
|
if (elfHeader->e_ident[4] != ELF_CLASS)
|
||||||
|
|||||||
@@ -224,7 +224,7 @@ ElfFile::Init(const char* fileName)
|
|||||||
return bytesRead < 0 ? errno : B_ERROR;
|
return bytesRead < 0 ? errno : B_ERROR;
|
||||||
|
|
||||||
// magic
|
// magic
|
||||||
if (!memcmp(elfIdent, ELF_MAGIC, 4) == 0)
|
if (!memcmp(elfIdent, ELFMAG, 4) == 0)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
// endianess
|
// endianess
|
||||||
|
|||||||
@@ -42,9 +42,6 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
|||||||
# define elf_w(x) _Uelf64_##x
|
# define elf_w(x) _Uelf64_##x
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __HAIKU__
|
|
||||||
# define ELFMAG ELF_MAGIC
|
|
||||||
#endif
|
|
||||||
#ifndef SELFMAG
|
#ifndef SELFMAG
|
||||||
# define SELFMAG 4
|
# define SELFMAG 4
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ ELFLoader<Class>::Create(int fd, preloaded_image** _image)
|
|||||||
|
|
||||||
const EhdrType& elfHeader = image->elf_header;
|
const EhdrType& elfHeader = image->elf_header;
|
||||||
|
|
||||||
if (memcmp(elfHeader.e_ident, ELF_MAGIC, 4) != 0
|
if (memcmp(elfHeader.e_ident, ELFMAG, 4) != 0
|
||||||
|| elfHeader.e_ident[4] != Class::kIdentClass
|
|| elfHeader.e_ident[4] != Class::kIdentClass
|
||||||
|| elfHeader.e_phoff == 0
|
|| elfHeader.e_phoff == 0
|
||||||
|| !elfHeader.IsHostEndian()
|
|| !elfHeader.IsHostEndian()
|
||||||
|
|||||||
@@ -1093,10 +1093,10 @@ private:
|
|||||||
memset(&header, 0, sizeof(header));
|
memset(&header, 0, sizeof(header));
|
||||||
|
|
||||||
// e_ident
|
// e_ident
|
||||||
header.e_ident[EI_MAG0] = ELF_MAGIC[0];
|
header.e_ident[EI_MAG0] = ELFMAG[0];
|
||||||
header.e_ident[EI_MAG1] = ELF_MAGIC[1];
|
header.e_ident[EI_MAG1] = ELFMAG[1];
|
||||||
header.e_ident[EI_MAG2] = ELF_MAGIC[2];
|
header.e_ident[EI_MAG2] = ELFMAG[2];
|
||||||
header.e_ident[EI_MAG3] = ELF_MAGIC[3];
|
header.e_ident[EI_MAG3] = ELFMAG[3];
|
||||||
#ifdef B_HAIKU_64_BIT
|
#ifdef B_HAIKU_64_BIT
|
||||||
header.e_ident[EI_CLASS] = ELFCLASS64;
|
header.e_ident[EI_CLASS] = ELFCLASS64;
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -1107,7 +1107,7 @@ elf_relocate(struct elf_image_info* image, struct elf_image_info* resolveImage)
|
|||||||
static int
|
static int
|
||||||
verify_eheader(elf_ehdr *elfHeader)
|
verify_eheader(elf_ehdr *elfHeader)
|
||||||
{
|
{
|
||||||
if (memcmp(elfHeader->e_ident, ELF_MAGIC, 4) != 0)
|
if (memcmp(elfHeader->e_ident, ELFMAG, 4) != 0)
|
||||||
return B_NOT_AN_EXECUTABLE;
|
return B_NOT_AN_EXECUTABLE;
|
||||||
|
|
||||||
if (elfHeader->e_ident[4] != ELF_CLASS)
|
if (elfHeader->e_ident[4] != ELF_CLASS)
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ status_t
|
|||||||
parse_elf_header(elf_ehdr* eheader, int32* _pheaderSize,
|
parse_elf_header(elf_ehdr* eheader, int32* _pheaderSize,
|
||||||
int32* _sheaderSize)
|
int32* _sheaderSize)
|
||||||
{
|
{
|
||||||
if (memcmp(eheader->e_ident, ELF_MAGIC, 4) != 0)
|
if (memcmp(eheader->e_ident, ELFMAG, 4) != 0)
|
||||||
return B_NOT_AN_EXECUTABLE;
|
return B_NOT_AN_EXECUTABLE;
|
||||||
|
|
||||||
if (eheader->e_ident[4] != ELF_CLASS)
|
if (eheader->e_ident[4] != ELF_CLASS)
|
||||||
|
|||||||
@@ -629,7 +629,7 @@ get_executable_architecture(int fd, const char** _architecture)
|
|||||||
return B_NOT_AN_EXECUTABLE;
|
return B_NOT_AN_EXECUTABLE;
|
||||||
|
|
||||||
// check whether this is indeed an ELF file
|
// check whether this is indeed an ELF file
|
||||||
if (memcmp(elfHeader.e_ident, ELF_MAGIC, 4) != 0)
|
if (memcmp(elfHeader.e_ident, ELFMAG, 4) != 0)
|
||||||
return B_NOT_AN_EXECUTABLE;
|
return B_NOT_AN_EXECUTABLE;
|
||||||
|
|
||||||
// check the architecture
|
// check the architecture
|
||||||
|
|||||||
Reference in New Issue
Block a user