d: Fix #error You must define PREFERRED_DEBUGGING_TYPE if DWARF is not supported
[official-gcc.git] / gcc / config / freebsd-d.cc
blob189e4a69e78a3356be3986851b891dc459769323
1 /* FreeBSD support needed only by D front-end.
2 Copyright (C) 2020-2022 Free Software Foundation, Inc.
4 GCC is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 3, or (at your option) any later
7 version.
9 GCC is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
14 You should have received a copy of the GNU General Public License
15 along with GCC; see the file COPYING3. If not see
16 <http://www.gnu.org/licenses/>. */
18 #include "config.h"
19 #include "system.h"
20 #include "coretypes.h"
21 #include "memmodel.h"
22 #include "tm.h"
23 #include "tm_d.h"
24 #include "d/d-target.h"
25 #include "d/d-target-def.h"
27 /* Implement TARGET_D_OS_VERSIONS for FreeBSD targets. */
29 static void
30 freebsd_d_os_builtins (void)
32 char buf[16];
33 snprintf (buf, sizeof (buf), "FreeBSD_%d", FBSD_MAJOR);
35 d_add_builtin_version ("FreeBSD");
36 d_add_builtin_version (xstrdup (buf));
37 d_add_builtin_version ("Posix");
40 /* Handle a call to `__traits(getTargetInfo, "objectFormat")'. */
42 static tree
43 freebsd_d_handle_target_object_format (void)
45 const char *objfmt = "elf";
47 return build_string_literal (strlen (objfmt) + 1, objfmt);
50 /* Implement TARGET_D_REGISTER_OS_TARGET_INFO for FreeBSD targets. */
52 static void
53 freebsd_d_register_target_info (void)
55 const struct d_target_info_spec handlers[] = {
56 { "objectFormat", freebsd_d_handle_target_object_format },
57 { NULL, NULL },
60 d_add_target_info_handlers (handlers);
63 #undef TARGET_D_OS_VERSIONS
64 #define TARGET_D_OS_VERSIONS freebsd_d_os_builtins
66 #undef TARGET_D_REGISTER_OS_TARGET_INFO
67 #define TARGET_D_REGISTER_OS_TARGET_INFO freebsd_d_register_target_info
69 struct gcc_targetdm targetdm = TARGETDM_INITIALIZER;