summaryrefslogtreecommitdiff
path: root/include/labels.h
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@linux.intel.com>2018-06-01 18:02:54 -0700
committerH. Peter Anvin <hpa@linux.intel.com>2018-06-01 18:06:25 -0700
commit98578071b9d71ecaa2344dd9c185237c1765041e (patch)
tree74dfdf8b0f587364f34ae804dc7ce0cd7d81ba7e /include/labels.h
parent8413e8167a21a922bbf99660165bb091e71bf1c0 (diff)
downloadnasm-98578071b9d71ecaa2344dd9c185237c1765041e.tar.gz
Cleanup of label renaming infrastructure, add subsection support
In order to support Mach-O better, add support for subsections, as used by Mach-O "subsections_via_symbols". We also want to add infrastructure to support this by downcalling to the backend to indicate if a new subsection is needed. Currently this supports a maximum of 2^14 subsections per section for Mach-O; this can be addressed by adding a level of indirection (or cleaning up the handling of sections so we have an actual data structure.) Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
Diffstat (limited to 'include/labels.h')
-rw-r--r--include/labels.h34
1 files changed, 24 insertions, 10 deletions
diff --git a/include/labels.h b/include/labels.h
index 3e8ac3ed..9cf57c1b 100644
--- a/include/labels.h
+++ b/include/labels.h
@@ -1,6 +1,6 @@
/* ----------------------------------------------------------------------- *
*
- * Copyright 1996-2017 The NASM Authors - All Rights Reserved
+ * Copyright 1996-2018 The NASM Authors - All Rights Reserved
* See the file AUTHORS included with the NASM distribution for
* the specific copyright holders.
*
@@ -40,20 +40,34 @@
#include "compiler.h"
-extern char lprefix[PREFIX_MAX];
-extern char lpostfix[PREFIX_MAX];
+enum mangle_index {
+ LM_LPREFIX, /* Local variable prefix */
+ LM_LSUFFIX, /* Local variable suffix */
+ LM_GPREFIX, /* Global variable prefix */
+ LM_GSUFFIX /* GLobal variable suffix */
+};
+
+enum label_type {
+ LBL_LOCAL, /* Must be zero */
+ LBL_GLOBAL,
+ LBL_STATIC,
+ LBL_EXTERN,
+ LBL_COMMON,
+ LBL_SPECIAL, /* Magic symbols like ..start */
+ LBL_BACKEND /* Backend-defined symbols like ..got */
+};
bool lookup_label(const char *label, int32_t *segment, int64_t *offset);
bool is_extern(const char *label);
-void define_label(char *label, int32_t segment, int64_t offset, char *special,
- bool is_norm, bool isextrn);
-void redefine_label(char *label, int32_t segment, int64_t offset, char *special,
- bool is_norm, bool isextrn);
-void define_common(char *label, int32_t segment, int32_t size, char *special);
-void declare_as_global(char *label, char *special);
+void define_label(const char *label, int32_t segment, int64_t offset,
+ bool normal);
+void backend_label(const char *label, int32_t segment, int64_t offset);
+bool declare_label(const char *label, enum label_type type,
+ const char *special);
+void set_label_mangle(enum mangle_index which, const char *what);
int init_labels(void);
void cleanup_labels(void);
-char *local_scope(char *label);
+const char *local_scope(const char *label);
extern uint64_t global_offset_changed;