rbtree: add rb_search_exact()
[nasm.git] / include / labels.h
bloba825d1fff21fee99a0c3612ca6cd23f2b6ac0501
1 /* ----------------------------------------------------------------------- *
2 *
3 * Copyright 1996-2018 The NASM Authors - All Rights Reserved
4 * See the file AUTHORS included with the NASM distribution for
5 * the specific copyright holders.
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following
9 * conditions are met:
11 * * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 * * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following
15 * disclaimer in the documentation and/or other materials provided
16 * with the distribution.
18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
19 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
20 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
21 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
29 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
30 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 * ----------------------------------------------------------------------- */
34 /*
35 * labels.h header file for labels.c
38 #ifndef LABELS_H
39 #define LABELS_H
41 #include "compiler.h"
43 enum mangle_index {
44 LM_LPREFIX, /* Local variable prefix */
45 LM_LSUFFIX, /* Local variable suffix */
46 LM_GPREFIX, /* Global variable prefix */
47 LM_GSUFFIX /* GLobal variable suffix */
50 enum label_type {
51 LBL_none = -1, /* No label */
52 LBL_LOCAL = 0, /* Must be zero */
53 LBL_STATIC,
54 LBL_GLOBAL,
55 LBL_EXTERN,
56 LBL_REQUIRED, /* Like extern but emit even if unused */
57 LBL_COMMON,
58 LBL_SPECIAL, /* Magic symbols like ..start */
59 LBL_BACKEND /* Backend-defined symbols like ..got */
62 enum label_type lookup_label(const char *label, int32_t *segment, int64_t *offset);
63 static inline bool is_extern(enum label_type type)
65 return type == LBL_EXTERN || type == LBL_REQUIRED;
67 void define_label(const char *label, int32_t segment, int64_t offset,
68 bool normal);
69 void backend_label(const char *label, int32_t segment, int64_t offset);
70 bool declare_label(const char *label, enum label_type type,
71 const char *special);
72 void set_label_mangle(enum mangle_index which, const char *what);
73 int init_labels(void);
74 void cleanup_labels(void);
75 const char *local_scope(const char *label);
77 extern uint64_t global_offset_changed;
79 #endif /* LABELS_H */