Skip to content

Commit

Permalink
Changed "cpu" to "machine" to match ELF spec vocabulary.
Browse files Browse the repository at this point in the history
  • Loading branch information
icculus committed Sep 7, 2009
1 parent afb7e2a commit de9b998
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion include/fatelf.h
Expand Up @@ -22,7 +22,7 @@ typedef struct FATELF_binary_info
{
uint16_t abi;
uint16_t abi_version;
uint32_t cpu;
uint32_t machine;
uint64_t offset;
} FATELF_binary_info;

Expand Down
2 changes: 1 addition & 1 deletion utils/fatelf-glue.c
Expand Up @@ -43,7 +43,7 @@ static int fatelf_glue(const char *out, const char **bins, const int bincount)
for (j = 0; j < i; j++)
{
const FATELF_binary_info *other = &header->binaries[j];
const int same = (other->cpu == info->cpu) &&
const int same = (other->machine == info->machine) &&
(other->abi == info->abi) &&
(other->abi_version == info->abi_version);
if (same)
Expand Down
4 changes: 2 additions & 2 deletions utils/fatelf-info.c
Expand Up @@ -21,13 +21,13 @@ static int fatelf_info(const char *fname)
for (i = 0; i < header->num_binaries; i++)
{
const FATELF_binary_info *bin = &header->binaries[i];
const fatelf_machine_info *machine = get_machine_by_id(bin->cpu);
const fatelf_machine_info *machine = get_machine_by_id(bin->machine);
const fatelf_abi_info *abi = get_abi_by_id(bin->abi);
printf(" - ABI %u (%s%s%s) ver %u, mach %u (%s%s%s), off %llu\n",
(unsigned int) bin->abi, abi ? abi->name : "???",
abi ? ": " : "", abi ? abi->desc : "",
(unsigned int) bin->abi_version,
(unsigned int) bin->cpu, machine ? machine->name : "???",
(unsigned int) bin->machine, machine ? machine->name : "???",
machine ? ": " : "", machine ? machine->desc : "",
(unsigned long long) bin->offset);
} // for
Expand Down
8 changes: 4 additions & 4 deletions utils/fatelf-utils.c
Expand Up @@ -136,9 +136,9 @@ void xread_elf_header(const char *fname, const int fd, FATELF_binary_info *info)
info->abi = (uint16_t) buf[7];
info->abi_version = (uint16_t) buf[8];
if (buf[5] == 0) // bigendian
info->cpu = (((uint32_t)buf[18]) << 8) | (((uint32_t)buf[19]));
info->machine = (((uint32_t)buf[18]) << 8) | (((uint32_t)buf[19]));
else if (buf[5] == 1) // littleendian
info->cpu = (((uint32_t)buf[19]) << 8) | (((uint32_t)buf[18]));
info->machine = (((uint32_t)buf[19]) << 8) | (((uint32_t)buf[18]));
else
xfail("Unexpected data encoding in '%s'", fname);
} // xread_elf_header
Expand Down Expand Up @@ -235,7 +235,7 @@ void xwrite_fatelf_header(const char *fname, const int fd,
{
ptr = putui16(ptr, header->binaries[i].abi);
ptr = putui16(ptr, header->binaries[i].abi_version);
ptr = putui32(ptr, header->binaries[i].cpu);
ptr = putui32(ptr, header->binaries[i].machine);
ptr = putui64(ptr, header->binaries[i].offset);
} // for

Expand Down Expand Up @@ -284,7 +284,7 @@ FATELF_header *xread_fatelf_header(const char *fname, const int fd)
{
ptr = getui16(ptr, &header->binaries[i].abi);
ptr = getui16(ptr, &header->binaries[i].abi_version);
ptr = getui32(ptr, &header->binaries[i].cpu);
ptr = getui32(ptr, &header->binaries[i].machine);
ptr = getui64(ptr, &header->binaries[i].offset);
} // for

Expand Down

0 comments on commit de9b998

Please sign in to comment.