Rename RELOLIS to RELOPPC_LIS.

This relocation is specific to PowerPC.  @davidgiven suggested the
name RELOPPC_LIS in
https://github.com/davidgiven/ack/pull/52#issuecomment-279856501

Reindent the list in h/out.h and util/led/ack.out.5 because
RELOLIS_PPC is a long name.  I use spaces and no tabs because the tabs
looked bad in the manual page.
This commit is contained in:
George Koehler 2017-10-18 15:39:31 -04:00
parent 41f3bf78cd
commit 73ad5a227d
5 changed files with 23 additions and 22 deletions

14
h/out.h
View file

@ -61,13 +61,13 @@ struct outname {
/* /*
* relocation type bits * relocation type bits
*/ */
#define RELSZ 0x0fff /* relocation length */ #define RELSZ 0x0fff /* relocation length */
#define RELO1 1 /* 1 byte */ #define RELO1 1 /* 1 byte */
#define RELO2 2 /* 2 bytes */ #define RELO2 2 /* 2 bytes */
#define RELO4 3 /* 4 bytes */ #define RELO4 3 /* 4 bytes */
#define RELOPPC 4 /* PowerPC 26-bit address */ #define RELOPPC 4 /* PowerPC 26-bit address */
#define RELOLIS 5 /* PowerPC lis */ #define RELOPPC_LIS 5 /* PowerPC lis */
#define RELOVC4 6 /* VideoCore IV address in 32-bit instruction */ #define RELOVC4 6 /* VideoCore IV address in 32-bit instruction */
#define RELPC 0x2000 /* pc relative */ #define RELPC 0x2000 /* pc relative */
#define RELBR 0x4000 /* High order byte lowest address. */ #define RELBR 0x4000 /* High order byte lowest address. */

View file

@ -42,8 +42,8 @@ void emit_hl(word_t in)
case OP_HA: /* ha16[expr] */ case OP_HA: /* ha16[expr] */
if (PASS_RELO && (hl_expr.typ & S_TYP) != S_ABS) { if (PASS_RELO && (hl_expr.typ & S_TYP) != S_ABS) {
/* /*
* RELOLIS only works with lis _, _ (same as * RELOPPC_LIS only works with lis _, _ (same
* addis _, r0, _). Check if instruction * as addis _, r0, _). Check if instruction
* isn't addis or register RA isn't r0. * isn't addis or register RA isn't r0.
*/ */
if ((in & 0xfc1f0000) != (0x3c000000)) if ((in & 0xfc1f0000) != (0x3c000000))
@ -55,7 +55,7 @@ void emit_hl(word_t in)
* Low 26 bits: signed offset * Low 26 bits: signed offset
*/ */
fit(fitx(hl_expr.val, 26)); fit(fitx(hl_expr.val, 26));
newrelo(hl_expr.typ, RELOLIS | FIXUPFLAGS); newrelo(hl_expr.typ, RELOPPC_LIS | FIXUPFLAGS);
reg = (in >> 21) & 0x1f; reg = (in >> 21) & 0x1f;
in = (hl_token == OP_HA) << 31; in = (hl_token == OP_HA) << 31;
in |= reg << 26; in |= reg << 26;

View file

@ -140,7 +140,7 @@ showrelo()
case RELOPPC: case RELOPPC:
printf("\tPowerPC 26-bit address\n"); printf("\tPowerPC 26-bit address\n");
break; break;
case RELOLIS: case RELOPPC_LIS:
printf("\tPowerPC lis instruction\n"); printf("\tPowerPC lis instruction\n");
break; break;
case RELOVC4: case RELOVC4:

View file

@ -161,13 +161,14 @@ struct outrelo {
/* /*
* relocation type bits * relocation type bits
*/ */
#define RELSZ 0x0fff /* relocation length */ #define RELSZ 0x0fff /* relocation length */
#define RELO1 0x01 /* 1 byte */ #define RELO1 1 /* 1 byte */
#define RELO2 0x02 /* 2 bytes */ #define RELO2 2 /* 2 bytes */
#define RELO4 0x03 /* 4 bytes */ #define RELO4 3 /* 4 bytes */
#define RELOPPC 0x04 /* 26-bit PowerPC address */ #define RELOPPC 4 /* PowerPC 26-bit address */
#define RELOLIS 0x05 /* PowerPC lis */ #define RELOPPC_LIS 5 /* PowerPC lis */
#define RELOVC4 0x06 /* VideoCore IV address in 32-bit insruction */ #define RELOVC4 6 /* VideoCore IV address in 32-bit instruction */
#define RELPC 0x2000 /* pc relative */ #define RELPC 0x2000 /* pc relative */
#define RELBR 0x4000 /* High order byte lowest address. */ #define RELBR 0x4000 /* High order byte lowest address. */
#define RELWR 0x8000 /* High order word lowest address. */ #define RELWR 0x8000 /* High order word lowest address. */
@ -231,7 +232,7 @@ VideoCore IV instruction.
The relocation depends on the instruction, and uses an offset encoded The relocation depends on the instruction, and uses an offset encoded
in the instruction. in the instruction.
.PP .PP
RELOLIS assembles a PowerPC \fBlis\fR instruction. RELOPPC_LIS assembles a PowerPC \fBlis\fR instruction.
The relocatable datum is a 4-byte integer. The relocatable datum is a 4-byte integer.
The high bit is set for ha16 or clear for hi16. The high bit is set for ha16 or clear for hi16.
The next 5 bits are the register \fIRT\fR. The next 5 bits are the register \fIRT\fR.

View file

@ -169,7 +169,7 @@ static uint32_t get_powerpc_valu(char* addr, uint16_t type)
(unsigned long)opcode1, (unsigned long)opcode2); (unsigned long)opcode1, (unsigned long)opcode2);
} }
/* RELOLIS stores a signed 26-bit offset in the low bits. */ /* RELOPPC_LIS stores a signed 26-bit offset in the low bits. */
static uint32_t get_lis_valu(char *addr, uint16_t type) static uint32_t get_lis_valu(char *addr, uint16_t type)
{ {
uint32_t valu = read4(addr, type) & 0x03ffffff; uint32_t valu = read4(addr, type) & 0x03ffffff;
@ -193,7 +193,7 @@ static uint32_t getvalu(char* addr, uint16_t type)
return read4(addr, type); return read4(addr, type);
case RELOPPC: case RELOPPC:
return get_powerpc_valu(addr, type); return get_powerpc_valu(addr, type);
case RELOLIS: case RELOPPC_LIS:
return get_lis_valu(addr, type); return get_lis_valu(addr, type);
case RELOVC4: case RELOVC4:
return get_vc4_valu(addr); return get_vc4_valu(addr);
@ -389,7 +389,7 @@ static putvalu(uint32_t valu, char* addr, uint16_t type)
case RELOPPC: case RELOPPC:
put_powerpc_valu(addr, valu, type); put_powerpc_valu(addr, valu, type);
break; break;
case RELOLIS: case RELOPPC_LIS:
put_lis_valu(addr, valu, type); put_lis_valu(addr, valu, type);
break; break;
case RELOVC4: case RELOVC4: