Use // line comments not /* block comments

This commit is contained in:
Rangi42
2025-01-27 18:11:50 -05:00
committed by Rangi
parent c5e59f40fd
commit b8b60207f5
81 changed files with 383 additions and 571 deletions

View File

@@ -1,4 +1,4 @@
/* SPDX-License-Identifier: MIT */
// SPDX-License-Identifier: MIT
#include "link/assign.hpp"
@@ -48,11 +48,9 @@ static void initFreeSpace() {
}
}
/*
* Assigns a section to a given memory location
* @param section The section to assign
* @param location The location to assign the section to
*/
// Assigns a section to a given memory location
// @param section The section to assign
// @param location The location to assign the section to
static void assignSection(Section &section, MemoryLocation const &location) {
// Propagate the assigned location to all UNIONs/FRAGMENTs
// so `jr` patches in them will have the correct offset
@@ -66,15 +64,13 @@ static void assignSection(Section &section, MemoryLocation const &location) {
out_AddSection(section);
}
/*
* Checks whether a given location is suitable for placing a given section
* This checks not only that the location has enough room for the section, but
* also that the constraints (alignment...) are respected.
* @param section The section to be placed
* @param freeSpace The candidate free space to place the section into
* @param location The location to attempt placing the section at
* @return True if the location is suitable, false otherwise.
*/
// Checks whether a given location is suitable for placing a given section
// This checks not only that the location has enough room for the section, but
// also that the constraints (alignment...) are respected.
// @param section The section to be placed
// @param freeSpace The candidate free space to place the section into
// @param location The location to attempt placing the section at
// @return True if the location is suitable, false otherwise.
static bool isLocationSuitable(
Section const &section, FreeSpace const &freeSpace, MemoryLocation const &location
) {
@@ -90,13 +86,11 @@ static bool isLocationSuitable(
return location.address + section.size <= freeSpace.address + freeSpace.size;
}
/*
* Finds a suitable location to place a section at.
* @param section The section to be placed
* @param location A pointer to a memory location that will be filled
* @return The index into `memory[section->type]` of the free space encompassing the location,
* or -1 if none was found
*/
// Finds a suitable location to place a section at.
// @param section The section to be placed
// @param location A pointer to a memory location that will be filled
// @return The index into `memory[section->type]` of the free space encompassing the location,
// or -1 if none was found
static ssize_t getPlacement(Section const &section, MemoryLocation &location) {
SectionTypeInfo const &typeInfo = sectionTypeInfo[section.type];
@@ -206,12 +200,10 @@ static ssize_t getPlacement(Section const &section, MemoryLocation &location) {
}
}
/*
* Places a section in a suitable location, or error out if it fails to.
* @warning Due to the implemented algorithm, this should be called with
* sections of decreasing size.
* @param section The section to place
*/
// Places a section in a suitable location, or error out if it fails to.
// @warning Due to the implemented algorithm, this should be called with
// sections of decreasing size.
// @param section The section to place
static void placeSection(Section &section) {
MemoryLocation location;
@@ -336,11 +328,9 @@ static constexpr uint8_t ALIGN_CONSTRAINED = 1 << 0;
// clang-format on
static std::deque<Section *> unassignedSections[1 << 3];
/*
* Categorize a section depending on how constrained it is
* This is so the most-constrained sections are placed first
* @param section The section to categorize
*/
// Categorize a section depending on how constrained it is
// This is so the most-constrained sections are placed first
// @param section The section to categorize
static void categorizeSection(Section &section) {
uint8_t constraints = 0;