aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyrill Gorcunov <gorcunov@gmail.com>2018-12-01 21:29:14 +0300
committerCyrill Gorcunov <gorcunov@gmail.com>2018-12-01 21:29:14 +0300
commit4dc5360b6019f462571af7d86f9eb5792ddb78f8 (patch)
tree0dd704f04552322e629b5842be5d7fb4c0067821
parent8525757a315e6d3a5b8d2d4175dd6fb5e2133ec6 (diff)
downloadnasm-4dc5360b6019f462571af7d86f9eb5792ddb78f8.tar.gz
nasm-4dc5360b6019f462571af7d86f9eb5792ddb78f8.tar.xz
nasm-4dc5360b6019f462571af7d86f9eb5792ddb78f8.zip
output: aout -- Use nasm_error helpers
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r--output/outaout.c97
1 files changed, 47 insertions, 50 deletions
diff --git a/output/outaout.c b/output/outaout.c
index 0ad797e4..ccfda4dc 100644
--- a/output/outaout.c
+++ b/output/outaout.c
@@ -275,7 +275,7 @@ static void aout_deflabel(char *name, int32_t segment, int64_t offset,
if (strcmp(name, "..gotpc") && strcmp(name, "..gotoff") &&
strcmp(name, "..got") && strcmp(name, "..plt") &&
strcmp(name, "..sym"))
- nasm_error(ERR_NONFATAL, "unrecognised special symbol `%s'", name);
+ nasm_nonfatal("unrecognised special symbol `%s'", name);
return;
}
@@ -298,8 +298,8 @@ static void aout_deflabel(char *name, int32_t segment, int64_t offset,
e = evaluate(stdscan, NULL, &tokval, NULL, 1, NULL);
if (e) {
if (!is_simple(e))
- nasm_error(ERR_NONFATAL, "cannot use relocatable"
- " expression as symbol size");
+ nasm_nonfatal("cannot use relocatable"
+ " expression as symbol size");
else
(*s)->size = reloc_value(e);
}
@@ -367,8 +367,8 @@ static void aout_deflabel(char *name, int32_t segment, int64_t offset,
!nasm_strnicmp(special, "object", n))
sym->type |= SYM_DATA;
else
- nasm_error(ERR_NONFATAL, "unrecognised symbol type `%.*s'",
- n, special);
+ nasm_nonfatal("unrecognised symbol type `%.*s'",
+ n, special);
if (special[n]) {
struct tokenval tokval;
expr *e;
@@ -376,8 +376,8 @@ static void aout_deflabel(char *name, int32_t segment, int64_t offset,
char *saveme = stdscan_get();
if (!bsd) {
- nasm_error(ERR_NONFATAL, "Linux a.out does not support"
- " symbol size information");
+ nasm_nonfatal("Linux a.out does not support"
+ " symbol size information");
} else {
while (special[n] && nasm_isspace(special[n]))
n++;
@@ -396,8 +396,8 @@ static void aout_deflabel(char *name, int32_t segment, int64_t offset,
sym->name = nasm_strdup(name);
} else if (e) {
if (!is_simple(e))
- nasm_error(ERR_NONFATAL, "cannot use relocatable"
- " expression as symbol size");
+ nasm_nonfatal("cannot use relocatable"
+ " expression as symbol size");
else
sym->size = reloc_value(e);
}
@@ -422,7 +422,7 @@ static void aout_deflabel(char *name, int32_t segment, int64_t offset,
nsyms++; /* and another for the size */
if (special && !special_used)
- nasm_error(ERR_NONFATAL, "no special symbol features supported here");
+ nasm_nonfatal("no special symbol features supported here");
}
static void aout_add_reloc(struct Section *sect, int32_t segment,
@@ -490,8 +490,8 @@ static int32_t aout_add_gsym_reloc(struct Section *sect,
shead = sbss.gsyms;
if (!shead) {
if (exact && offset != 0)
- nasm_error(ERR_NONFATAL, "unable to find a suitable global symbol"
- " for this reference");
+ nasm_nonfatal("unable to find a suitable global symbol"
+ " for this reference");
else
aout_add_reloc(sect, segment, type, bytes);
return offset;
@@ -514,8 +514,8 @@ static int32_t aout_add_gsym_reloc(struct Section *sect,
sym = sm;
}
if (!sym && exact) {
- nasm_error(ERR_NONFATAL, "unable to find a suitable global symbol"
- " for this reference");
+ nasm_nonfatal("unable to find a suitable global symbol"
+ " for this reference");
return 0;
}
@@ -561,8 +561,8 @@ static int32_t aout_add_gotoff_reloc(struct Section *sect, int32_t segment,
else if (segment == sbss.index)
asym = sbss.asym;
if (!asym)
- nasm_error(ERR_NONFATAL, "`..gotoff' relocations require a non-global"
- " symbol in the section");
+ nasm_nonfatal("`..gotoff' relocations require a non-global"
+ " symbol in the section");
r = *sect->tail = nasm_malloc(sizeof(struct Reloc));
sect->tail = &r->next;
@@ -593,14 +593,14 @@ static void aout_out(int32_t segto, const void *data,
else if (segto == sbss.index)
s = NULL;
else {
- nasm_error(ERR_WARNING, "attempt to assemble code in"
- " segment %d: defaulting to `.text'", segto);
+ nasm_warn("attempt to assemble code in"
+ " segment %d: defaulting to `.text'", segto);
s = &stext;
}
if (!s && type != OUT_RESERVE) {
- nasm_error(ERR_WARNING, "attempt to initialize memory in the"
- " BSS section: ignored");
+ nasm_warn("attempt to initialize memory in the"
+ " BSS section: ignored");
sbss.len += realsize(type, size);
return;
}
@@ -609,9 +609,9 @@ static void aout_out(int32_t segto, const void *data,
if (type == OUT_RESERVE) {
if (s) {
- nasm_error(ERR_WARNING, "uninitialized space declared in"
- " %s section: zeroing",
- (segto == stext.index ? "code" : "data"));
+ nasm_warn("uninitialized space declared in"
+ " %s section: zeroing",
+ (segto == stext.index ? "code" : "data"));
aout_sect_write(s, NULL, size);
} else
sbss.len += size;
@@ -622,15 +622,14 @@ static void aout_out(int32_t segto, const void *data,
addr = *(int64_t *)data;
if (segment != NO_SEG) {
if (segment % 2) {
- nasm_error(ERR_NONFATAL, "a.out format does not support"
- " segment base references");
+ nasm_nonfatal("a.out format does not support"
+ " segment base references");
} else {
if (wrt == NO_SEG) {
aout_add_reloc(s, segment, RELTYPE_ABSOLUTE, asize);
} else if (!bsd) {
- nasm_error(ERR_NONFATAL,
- "Linux a.out format does not support"
- " any use of WRT");
+ nasm_nonfatal("Linux a.out format does not support"
+ " any use of WRT");
wrt = NO_SEG; /* we can at least _try_ to continue */
} else if (wrt == aout_gotpc_sect + 1) {
is_pic = 0x40;
@@ -648,13 +647,11 @@ static void aout_out(int32_t segto, const void *data,
false);
} else if (wrt == aout_plt_sect + 1) {
is_pic = 0x40;
- nasm_error(ERR_NONFATAL,
- "a.out format cannot produce non-PC-"
- "relative PLT references");
+ nasm_nonfatal("a.out format cannot produce non-PC-"
+ "relative PLT references");
} else {
- nasm_error(ERR_NONFATAL,
- "a.out format does not support this"
- " use of WRT");
+ nasm_nonfatal("a.out format does not support this"
+ " use of WRT");
wrt = NO_SEG; /* we can at least _try_ to continue */
}
}
@@ -667,14 +664,14 @@ static void aout_out(int32_t segto, const void *data,
aout_sect_write(s, mydata, asize);
} else if (type == OUT_REL2ADR) {
if (segment != NO_SEG && segment % 2) {
- nasm_error(ERR_NONFATAL, "a.out format does not support"
- " segment base references");
+ nasm_nonfatal("a.out format does not support"
+ " segment base references");
} else {
if (wrt == NO_SEG) {
aout_add_reloc(s, segment, RELTYPE_RELATIVE, 2);
} else if (!bsd) {
- nasm_error(ERR_NONFATAL, "Linux a.out format does not support"
- " any use of WRT");
+ nasm_nonfatal("Linux a.out format does not support"
+ " any use of WRT");
wrt = NO_SEG; /* we can at least _try_ to continue */
} else if (wrt == aout_plt_sect + 1) {
is_pic = 0x40;
@@ -682,11 +679,11 @@ static void aout_out(int32_t segto, const void *data,
} else if (wrt == aout_gotpc_sect + 1 ||
wrt == aout_gotoff_sect + 1 ||
wrt == aout_got_sect + 1) {
- nasm_error(ERR_NONFATAL, "a.out format cannot produce PC-"
- "relative GOT references");
+ nasm_nonfatal("a.out format cannot produce PC-"
+ "relative GOT references");
} else {
- nasm_error(ERR_NONFATAL, "a.out format does not support this"
- " use of WRT");
+ nasm_nonfatal("a.out format does not support this"
+ " use of WRT");
wrt = NO_SEG; /* we can at least _try_ to continue */
}
}
@@ -695,14 +692,14 @@ static void aout_out(int32_t segto, const void *data,
aout_sect_write(s, mydata, 2L);
} else if (type == OUT_REL4ADR) {
if (segment != NO_SEG && segment % 2) {
- nasm_error(ERR_NONFATAL, "a.out format does not support"
- " segment base references");
+ nasm_nonfatal("a.out format does not support"
+ " segment base references");
} else {
if (wrt == NO_SEG) {
aout_add_reloc(s, segment, RELTYPE_RELATIVE, 4);
} else if (!bsd) {
- nasm_error(ERR_NONFATAL, "Linux a.out format does not support"
- " any use of WRT");
+ nasm_nonfatal("Linux a.out format does not support"
+ " any use of WRT");
wrt = NO_SEG; /* we can at least _try_ to continue */
} else if (wrt == aout_plt_sect + 1) {
is_pic = 0x40;
@@ -710,11 +707,11 @@ static void aout_out(int32_t segto, const void *data,
} else if (wrt == aout_gotpc_sect + 1 ||
wrt == aout_gotoff_sect + 1 ||
wrt == aout_got_sect + 1) {
- nasm_error(ERR_NONFATAL, "a.out format cannot produce PC-"
- "relative GOT references");
+ nasm_nonfatal("a.out format cannot produce PC-"
+ "relative GOT references");
} else {
- nasm_error(ERR_NONFATAL, "a.out format does not support this"
- " use of WRT");
+ nasm_nonfatal("a.out format does not support this"
+ " use of WRT");
wrt = NO_SEG; /* we can at least _try_ to continue */
}
}