[PATCH 37/57][Arm][OBJDUMP] Add framework for MVE instructions
[binutils-gdb.git] / gold / dwp.h
blobacb32bbd5e24312d93c38fe94dcf83c71277ebb9
1 // dwp.h -- general definitions for dwp.
3 // Copyright (C) 2012-2019 Free Software Foundation, Inc.
4 // Written by Cary Coutant <ccoutant@google.com>.
6 // This file is part of dwp, the DWARF packaging utility.
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 3 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 // MA 02110-1301, USA.
23 #ifndef DWP_DWP_H
24 #define DWP_DWP_H 1
26 #include "config.h"
27 #include "ansidecl.h"
29 #include <cstddef>
30 #include <cstdlib>
31 #include <cstring>
32 #include <stdint.h>
33 #include <sys/types.h>
35 #include "system.h"
37 namespace gold
40 extern const char* program_name;
42 class General_options;
43 class Command_line;
44 class Dirsearch;
45 class Input_objects;
46 class Mapfile;
47 class Symbol;
48 class Symbol_table;
49 class Layout;
50 class Task;
51 class Workqueue;
52 class Output_file;
53 template<int size, bool big_endian>
54 struct Relocate_info;
56 // The size of a section if we are going to look at the contents.
57 typedef size_t section_size_type;
59 // An offset within a section when we are looking at the contents.
60 typedef ptrdiff_t section_offset_type;
62 inline bool
63 is_prefix_of(const char* prefix, const char* str)
65 return strncmp(prefix, str, strlen(prefix)) == 0;
68 // Exit status codes.
70 enum Exit_status
72 GOLD_OK = EXIT_SUCCESS,
73 GOLD_ERR = EXIT_FAILURE,
74 GOLD_FALLBACK = EXIT_FAILURE + 1
77 // This function is called to exit the program. Status is true to
78 // exit success (0) and false to exit failure (1).
79 extern void
80 gold_exit(Exit_status status) ATTRIBUTE_NORETURN;
82 // This function is called to emit an error message and then
83 // immediately exit with failure.
84 extern void
85 gold_fatal(const char* format, ...) ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF_1;
87 // This function is called to issue a warning.
88 extern void
89 gold_warning(const char* msg, ...) ATTRIBUTE_PRINTF_1;
91 // This function is called to print an informational message.
92 extern void
93 gold_info(const char* msg, ...) ATTRIBUTE_PRINTF_1;
95 #define gold_unreachable() \
96 (gold::do_gold_unreachable(__FILE__, __LINE__, \
97 static_cast<const char*>(__FUNCTION__)))
99 extern void do_gold_unreachable(const char*, int, const char*)
100 ATTRIBUTE_NORETURN;
102 // Assertion check.
104 #define gold_assert(expr) ((void)(!(expr) ? gold_unreachable(), 0 : 0))
106 // Convert numeric types without unnoticed loss of precision.
107 template<typename To, typename From>
108 inline To
109 convert_types(const From from)
111 To to = from;
112 gold_assert(static_cast<From>(to) == from);
113 return to;
116 // A common case of convert_types<>: convert to section_size_type.
117 template<typename From>
118 inline section_size_type
119 convert_to_section_size_type(const From from)
120 { return convert_types<section_size_type, From>(from); }
122 }; // End namespace gold.
124 #endif // !defined(DWP_DWP_H)