1/* Copyright (C) 2021-2024 Free Software Foundation, Inc.
2   Contributed by Oracle.
3
4   This file is part of GNU Binutils.
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 3, or (at your option)
9   any later version.
10
11   This program is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with this program; if not, write to the Free Software
18   Foundation, 51 Franklin Street - Fifth Floor, Boston,
19   MA 02110-1301, USA.  */
20
21#ifndef _INFO_H
22#define _INFO_H
23
24/* Header file for .info section format */
25#include <inttypes.h>
26
27/* The format of the .info section from a single object file is:
28 * Fixed-length info_header
29 * Variable length string padded to a multiple of 4 bytes, giving
30 *  the name of the source file from which this contribution comes.
31 * Zero or more entries.
32 *
33 * In an executable, there will be multiple occurrences of the above.
34 * The size of the info section will be a multiple of 4 bytes.
35 */
36
37struct info_header
38{
39  char endian;      /* 0 for big, 1 for little */
40  char magic[3];    /* The string "SUN" */
41  uint32_t cnt;     /* number of entries for this section */
42  uint16_t len;     /* The length of the header, including the string */
43  uint16_t version; /* The version number of this block */
44  uint16_t phase;   /* The compiler phase that produced this info */
45  uint16_t spare;
46};
47
48#define PHASE_UNKNOWN       0
49#define PHASE_F77           1
50#define PHASE_CC            2
51#define PHASE_CPLUS         3
52#define PHASE_F95           4
53#define PHASE_IROPT         5
54#define PHASE_MAX           255
55#define F95_COPYINOUT       ((PHASE_F95 << 24) | 1)
56
57/* An entry consists of a fixed-size struct entry, possibly followed by
58 * a variable length data structure whose format is determined by the
59 * type of an entry. The size of an entry is a multiple of 4 bytes.
60 */
61
62struct entry_header
63{
64  uint32_t type;    /* The type of this entry. High 8 bits is the phase.
65		     * Low 24 bits is the type. */
66  uint16_t len;     /* length of this entry */
67  uint16_t col;     /* Column number in source line */
68  uint32_t msgnum;  /* Message number. High 8 bits is the phase.
69		     * Low 24 bits is the type. */
70  uint32_t line;    /* Line number in source file */
71};
72
73#endif
74