Skip to content

Commit

Permalink
Renamed "abi" to "osabi" 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 9108025 commit 88be35a
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 31 deletions.
4 changes: 2 additions & 2 deletions include/fatelf.h
Expand Up @@ -20,8 +20,8 @@
/* Values on disk are always littleendian, and align like Elf64. */
typedef struct FATELF_binary_info
{
uint16_t abi;
uint16_t abi_version;
uint16_t osabi;
uint16_t osabi_version;
uint16_t machine;
uint16_t reserved0;
uint64_t offset;
Expand Down
4 changes: 2 additions & 2 deletions utils/fatelf-glue.c
Expand Up @@ -44,8 +44,8 @@ static int fatelf_glue(const char *out, const char **bins, const int bincount)
{
const FATELF_binary_info *other = &header->binaries[j];
const int same = (other->machine == info->machine) &&
(other->abi == info->abi) &&
(other->abi_version == info->abi_version);
(other->osabi == info->osabi) &&
(other->osabi_version == info->osabi_version);
if (same)
xfail("'%s' and '%s' are for the same target.", bins[j], fname);
} // for
Expand Down
10 changes: 5 additions & 5 deletions utils/fatelf-info.c
Expand Up @@ -22,13 +22,13 @@ static int fatelf_info(const char *fname)
{
const FATELF_binary_info *bin = &header->binaries[i];
const fatelf_machine_info *machine = get_machine_by_id(bin->machine);
const fatelf_abi_info *abi = get_abi_by_id(bin->abi);
const fatelf_osabi_info *osabi = get_osabi_by_id(bin->osabi);

printf("Binary at index #%d:\n", i);
printf(" ABI %u (%s%s%s) version %u,\n",
(unsigned int) bin->abi, abi ? abi->name : "???",
abi ? ": " : "", abi ? abi->desc : "",
(unsigned int) bin->abi_version);
printf(" OSABI %u (%s%s%s) version %u,\n",
(unsigned int) bin->osabi, osabi ? osabi->name : "???",
osabi ? ": " : "", osabi ? osabi->desc : "",
(unsigned int) bin->osabi_version);
printf(" Machine %u (%s%s%s)\n",
(unsigned int) bin->machine, machine ? machine->name : "???",
machine ? ": " : "", machine ? machine->desc : "");
Expand Down
36 changes: 18 additions & 18 deletions utils/fatelf-utils.c
Expand Up @@ -133,8 +133,8 @@ void xread_elf_header(const char *fname, const int fd, FATELF_binary_info *info)
xread(fname, fd, buf, sizeof (buf), 1);
if (memcmp(magic, buf, sizeof (magic)) != 0)
xfail("'%s' is not an ELF binary");
info->abi = (uint16_t) buf[7];
info->abi_version = (uint16_t) buf[8];
info->osabi = (uint16_t) buf[7];
info->osabi_version = (uint16_t) buf[8];
if (buf[5] == 0) // bigendian
info->machine = (((uint16_t)buf[18]) << 8) | (((uint16_t)buf[19]));
else if (buf[5] == 1) // littleendian
Expand Down Expand Up @@ -250,8 +250,8 @@ void xwrite_fatelf_header(const char *fname, const int fd,

for (i = 0; i < header->num_binaries; i++)
{
ptr = putui16(ptr, header->binaries[i].abi);
ptr = putui16(ptr, header->binaries[i].abi_version);
ptr = putui16(ptr, header->binaries[i].osabi);
ptr = putui16(ptr, header->binaries[i].osabi_version);
ptr = putui16(ptr, header->binaries[i].machine);
ptr = putui16(ptr, header->binaries[i].reserved0);
ptr = putui64(ptr, header->binaries[i].offset);
Expand Down Expand Up @@ -304,8 +304,8 @@ FATELF_header *xread_fatelf_header(const char *fname, const int fd)

for (i = 0; i < bincount; i++)
{
ptr = getui16(ptr, &header->binaries[i].abi);
ptr = getui16(ptr, &header->binaries[i].abi_version);
ptr = getui16(ptr, &header->binaries[i].osabi);
ptr = getui16(ptr, &header->binaries[i].osabi_version);
ptr = getui16(ptr, &header->binaries[i].machine);
ptr = getui16(ptr, &header->binaries[i].reserved0);
ptr = getui64(ptr, &header->binaries[i].offset);
Expand Down Expand Up @@ -435,7 +435,7 @@ static const fatelf_machine_info machines[] =

// !!! FIXME: these names/descs aren't set in stone.
// List from: http://www.sco.com/developers/gabi/latest/ch4.eheader.html
static const fatelf_abi_info abis[] =
static const fatelf_osabi_info osabis[] =
{
// MUST BE SORTED BY ID!
{ 0, "sysv", "UNIX System V" },
Expand Down Expand Up @@ -487,32 +487,32 @@ const fatelf_machine_info *get_machine_by_name(const char *name)
} // get_machine_by_name


const fatelf_abi_info *get_abi_by_id(const uint16_t id)
const fatelf_osabi_info *get_osabi_by_id(const uint16_t id)
{
int i;
for (i = 0; i < (sizeof (abis) / sizeof (abis[0])); i++)
for (i = 0; i < (sizeof (osabis) / sizeof (osabis[0])); i++)
{
if (abis[i].id == id)
return &abis[i];
else if (abis[i].id > id)
if (osabis[i].id == id)
return &osabis[i];
else if (osabis[i].id > id)
break; // not found (sorted by id).
} // for

return NULL;
} // get_abi_by_id
} // get_osabi_by_id


const fatelf_abi_info *get_abi_by_name(const char *name)
const fatelf_osabi_info *get_osabi_by_name(const char *name)
{
int i;
for (i = 0; i < (sizeof (abis) / sizeof (abis[0])); i++)
for (i = 0; i < (sizeof (osabis) / sizeof (osabis[0])); i++)
{
if (strcmp(abis[i].name, name) == 0)
return &abis[i];
if (strcmp(osabis[i].name, name) == 0)
return &osabis[i];
} // for

return NULL;
} // get_abi_by_name
} // get_osabi_by_name


void xfatelf_init(int argc, const char **argv)
Expand Down
8 changes: 4 additions & 4 deletions utils/fatelf-utils.h
Expand Up @@ -35,12 +35,12 @@ typedef struct fatelf_machine_info
} fatelf_machine_info;


typedef struct fatelf_abi_info
typedef struct fatelf_osabi_info
{
uint16_t id;
const char *name;
const char *desc;
} fatelf_abi_info;
} fatelf_osabi_info;


// all functions that start with 'x' may call exit() on error!
Expand Down Expand Up @@ -87,8 +87,8 @@ uint64_t align_to_page(const uint64_t offset);

const fatelf_machine_info *get_machine_by_id(const uint16_t id);
const fatelf_machine_info *get_machine_by_name(const char *name);
const fatelf_abi_info *get_abi_by_id(const uint16_t id);
const fatelf_abi_info *get_abi_by_name(const char *name);
const fatelf_osabi_info *get_osabi_by_id(const uint16_t id);
const fatelf_osabi_info *get_osabi_by_name(const char *name);

// Call this at the start of main().
void xfatelf_init(int argc, const char **argv);
Expand Down

0 comments on commit 88be35a

Please sign in to comment.