summaryrefslogtreecommitdiff
path: root/output
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2019-09-12 20:21:03 -0400
committerH. Peter Anvin <hpa@zytor.com>2019-09-12 20:21:03 -0400
commit90b1ccff86d530b140eb391ede3c50e33bcf9410 (patch)
tree1ef248693a5d5b8c226a99f2626734f4f76f88c5 /output
parent495fda63418600229f36a3a7de62b75620be34b6 (diff)
downloadnasm-90b1ccff86d530b140eb391ede3c50e33bcf9410.tar.gz
Drop unnecessary EXTERN symbols
Currently, NASM always issues as an unknown symbol any symbol declared EXTERN. This is highly undesirable when using common header files, as it might cause the linker to pull in a bunch of unnecessary modules, depending on how smart the linker is. Add a new REQUIRED directive which behaves like the old EXTERN, for the use cases which might still need this behavior. Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
Diffstat (limited to 'output')
-rw-r--r--output/outbin.c6
-rw-r--r--output/outmacho.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/output/outbin.c b/output/outbin.c
index 8baa648a..5c2f0631 100644
--- a/output/outbin.c
+++ b/output/outbin.c
@@ -642,7 +642,7 @@ static void bin_cleanup(void)
if (map_control & MAP_SYMBOLS) {
int32_t segment;
int64_t offset;
- bool found_label;
+ enum label_type found_label;
fprintf(rf, "-- Symbols ");
for (h = 68; h; h--)
@@ -655,7 +655,7 @@ static void bin_cleanup(void)
fprintf(rf, "\n\nValue Name\n");
list_for_each(l, no_seg_labels) {
found_label = lookup_label(l->name, &segment, &offset);
- nasm_assert(found_label);
+ nasm_assert(found_label != LBL_NONE);
fprintf(rf, "%08"PRIX64" %s\n", offset, l->name);
}
fprintf(rf, "\n\n");
@@ -668,7 +668,7 @@ static void bin_cleanup(void)
fprintf(rf, "\n\nReal Virtual Name\n");
list_for_each(l, s->labels) {
found_label = lookup_label(l->name, &segment, &offset);
- nasm_assert(found_label);
+ nasm_assert(found_label != LBL_NONE);
fprintf(rf, "%16"PRIX64" %16"PRIX64" %s\n",
s->start + offset, s->vstart + offset,
l->name);
diff --git a/output/outmacho.c b/output/outmacho.c
index 5ad6601d..6cbaa012 100644
--- a/output/outmacho.c
+++ b/output/outmacho.c
@@ -1740,7 +1740,7 @@ static bool macho_set_section_attribute_by_symbol(const char *label, uint32_t fl
int32_t nasm_seg;
int64_t offset;
- if (!lookup_label(label, &nasm_seg, &offset)) {
+ if (lookup_label(label, &nasm_seg, &offset) == LBL_NONE) {
nasm_error(ERR_NONFATAL, "unknown symbol `%s' in no_dead_strip", label);
return false;
}