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