Pigweed
 
Loading...
Searching...
No Matches
must_place.ld.h
1// Copyright 2024 The Pigweed Authors
2//
3// Licensed under the Apache License, Version 2.0 (the "License"); you may not
4// use this file except in compliance with the License. You may obtain a copy of
5// the License at
6//
7// https://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12// License for the specific language governing permissions and limitations under
13// the License.
14#pragma once
15
18
19// clang-format off
21#define ___PW_MUST_PLACE(isection, start_sym, end_sym) \
22 start_sym = .; \
23 isection \
24 end_sym = .; \
25 ASSERT(start_sym != end_sym, \
26 "Error: No symbols found in pattern below"); \
27 ASSERT(start_sym != end_sym, #isection)
28
29#define __PW_MUST_PLACE(isection, sym_prefix, unique) \
30 ___PW_MUST_PLACE(isection, sym_prefix ## start_ ## unique, sym_prefix ## end_ ## unique)
31
32#define _PW_MUST_PLACE(isection, sym_prefix, unique) \
33 __PW_MUST_PLACE(isection, sym_prefix, unique)
35
79#define PW_MUST_PLACE(isection) \
80 _PW_MUST_PLACE(isection, __section_place_, __LINE__)
81