Fix a whole pile of issues related to the failed attempt to increase

the number of types of relocation possible in the object file. (Now,
hopefully, working.)

Also change the object serialiser/deserialiser to never try to read or
write raw structures; it's way safer this way and we don't need the
performance boost any more.

--HG--
branch : default-branch
This commit is contained in:
David Given
2016-03-18 21:46:55 +01:00
parent fd7e9f9046
commit ef8e6e25e0
9 changed files with 27 additions and 123 deletions

View File

@@ -150,7 +150,6 @@ struct outrelo {
uint16_t or_type; /* type of reference */
uint16_t or_sect; /* referencing section */
uint16_t or_nami; /* referenced symbol index */
uint16_t _padding; /* padding for alignment; ignore */
uint32_t or_addr; /* referencing address */
};
.fi
@@ -285,15 +284,6 @@ object file.
.br
The following miscellaneous defines might come in handy when reading
object files:
.PP
.nf
/*
* structure format strings
*/
#define SF_HEAD "22222244"
#define SF_SECT "44444"
#define SF_RELO "1124"
#define SF_NAME "4224"
.fi
.PP
.nf
@@ -302,7 +292,7 @@ object files:
*/
#define SZ_HEAD 20
#define SZ_SECT 20
#define SZ_RELO 8
#define SZ_RELO 10
#define SZ_NAME 12
.fi
.PP

View File

@@ -108,10 +108,7 @@ static long get_vc4_valu(char* addr)
* The bits in type indicate how many bytes the value occupies and what
* significance should be attributed to each byte.
*/
static long
getvalu(addr, type)
char addr[];
char type;
static long getvalu(char* addr, uint16_t type)
{
switch (type & RELSZ) {
case RELO1:
@@ -127,7 +124,7 @@ getvalu(addr, type)
case RELOVC4:
return get_vc4_valu(addr);
default:
fatal("bad relocation size");
fatal("bad relocation type %x", type & RELSZ);
}
/* NOTREACHED */
}
@@ -228,11 +225,7 @@ static void put_vc4_valu(char* addr, long value)
* significance should be attributed to each byte.
* We do not check for overflow.
*/
static
putvalu(valu, addr, type)
long valu;
char addr[];
char type;
static putvalu(long valu, char* addr, uint16_t type)
{
switch (type & RELSZ) {
@@ -259,7 +252,7 @@ putvalu(valu, addr, type)
put_vc4_valu(addr, valu);
break;
default:
fatal("bad relocation size");
fatal("bad relocation type %x", type & RELSZ);
}
}