SIZEOF("Section") and STARTOF("Section") can be known

Fixes #890
This commit is contained in:
Rangi
2021-06-20 16:10:27 -04:00
committed by Eldred Habert
parent 06b57aa1ce
commit a67f5d6e01
7 changed files with 87 additions and 17 deletions

View File

@@ -13,6 +13,7 @@
#include <stdbool.h>
#include "linkdefs.h"
#include "platform.h" // NONNULL
extern uint8_t fillByte;
@@ -76,4 +77,6 @@ void sect_BinaryFileSlice(char const *s, int32_t start_pos, int32_t length);
void sect_PushSection(void);
void sect_PopSection(void);
bool sect_IsSizeKnown(struct Section const NONNULL(name));
#endif

View File

@@ -49,8 +49,10 @@
/* MSVC doesn't support `[static N]` for array arguments from C99 */
#ifdef _MSC_VER
# define MIN_NB_ELMS(N)
# define NONNULL(ptr) *ptr
#else
# define MIN_NB_ELMS(N) static (N)
# define NONNULL(ptr) ptr[static 1]
#endif
// MSVC uses a different name for O_RDWR, and needs an additional _O_BINARY flag