GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_elf_note.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later
2/*
3 * Copyright (C) 2024 Cyril Hrubis <metan@ucw.cz>
4 */
5
11#ifndef GP_ELF_NOTE_H
12#define GP_ELF_NOTE_H
13
14#include <core/gp_common.h>
15#include <stdint.h>
16
17#define GP_ELF_NOTE_VENDOR "gfxprim"
18
26 uint32_t namesz;
28 uint32_t descsz;
30 uint32_t type;
32 char name[sizeof(GP_ELF_NOTE_VENDOR)];
34 char desc_data[];
35};
36
74#define GP_ELF_NOTE(note_namespace, note_type, note_c_type, note_c_type_size, ...) \
75 __attribute__((used, section(".note." GP_ELF_NOTE_VENDOR "." note_namespace), aligned(4))) \
76 static const struct { \
77 const struct gp_elf_note_hdr hdr; \
78 const note_c_type; \
79 } GP_UNIQUE_ID(gp_elf_note_) = { \
80 .hdr = { \
81 .namesz = sizeof(GP_ELF_NOTE_VENDOR), \
82 .descsz = note_c_type_size, \
83 .type = note_type, \
84 .name = GP_ELF_NOTE_VENDOR, \
85 }, \
86 .desc = __VA_ARGS__, \
87 };
88
104#define GP_ELF_NOTE_STR(note_namespace, note_type, note_str) \
105 GP_ELF_NOTE(note_namespace, note_type, char desc[sizeof(note_str)], sizeof(note_str), note_str)
106
116void gp_elf_notes_process(void (*callback)(uint32_t note_type, const void *note_desc, void *priv),
117 void *priv);
118
119#endif /* GP_ELF_NOTE_H */
Common macros.
void gp_elf_notes_process(void(*callback)(uint32_t note_type, const void *note_desc, void *priv), void *priv)
Runs a callback on each gfxprim ELF note.
ELF note header as defined in ELF ABI.
Definition gp_elf_note.h:24
uint32_t type
4 bytes of note type.
Definition gp_elf_note.h:30
uint32_t descsz
4 bytes of note description size.
Definition gp_elf_note.h:28
char desc_data[]
A descsz bytes of payload data.
Definition gp_elf_note.h:34
uint32_t namesz
4 bytes of note name size.
Definition gp_elf_note.h:26
char name[sizeof("gfxprim")]
A namesz long null terminated string of the entry owner, i.e. "gfxprim".
Definition gp_elf_note.h:32