mirror of
https://github.com/cc65/cc65.git
synced 2025-01-12 02:30:44 +00:00
Define the __XX_START__ symbol for a memory area earlier, so it may be used in
the expression for the size of the same area. git-svn-id: svn://svn.cc65.org/cc65/trunk@4852 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
5e8252fa36
commit
de14990fbb
@ -1764,13 +1764,32 @@ unsigned CfgProcess (void)
|
|||||||
/* Remember if this is a relocatable memory area */
|
/* Remember if this is a relocatable memory area */
|
||||||
M->Relocatable = RelocatableBinFmt (M->F->Format);
|
M->Relocatable = RelocatableBinFmt (M->F->Format);
|
||||||
|
|
||||||
/* Resolve the start address expression */
|
/* Resolve the start address expression, remember the start address
|
||||||
|
* and mark the memory area as placed.
|
||||||
|
*/
|
||||||
if (!IsConstExpr (M->StartExpr)) {
|
if (!IsConstExpr (M->StartExpr)) {
|
||||||
CfgError (&M->Pos,
|
CfgError (&M->Pos,
|
||||||
"Start address of memory area `%s' is not constant",
|
"Start address of memory area `%s' is not constant",
|
||||||
GetString (M->Name));
|
GetString (M->Name));
|
||||||
}
|
}
|
||||||
M->Start = GetExprVal (M->StartExpr);
|
Addr = M->Start = GetExprVal (M->StartExpr);
|
||||||
|
M->Flags |= MF_PLACED;
|
||||||
|
|
||||||
|
/* If requested, define the symbol for the start of the memory area.
|
||||||
|
* Doing it here means that the expression for the size of the area
|
||||||
|
* may reference this symbol.
|
||||||
|
*/
|
||||||
|
if (M->Flags & MF_DEFINE) {
|
||||||
|
Export* E;
|
||||||
|
StrBuf Buf = STATIC_STRBUF_INITIALIZER;
|
||||||
|
|
||||||
|
/* Define the start of the memory area */
|
||||||
|
SB_Printf (&Buf, "__%s_START__", GetString (M->Name));
|
||||||
|
E = CreateMemoryExport (GetStrBufId (&Buf), M, 0);
|
||||||
|
E->Pos = M->Pos;
|
||||||
|
|
||||||
|
SB_Done (&Buf);
|
||||||
|
}
|
||||||
|
|
||||||
/* Resolve the size expression */
|
/* Resolve the size expression */
|
||||||
if (!IsConstExpr (M->SizeExpr)) {
|
if (!IsConstExpr (M->SizeExpr)) {
|
||||||
@ -1780,12 +1799,6 @@ unsigned CfgProcess (void)
|
|||||||
}
|
}
|
||||||
M->Size = GetExprVal (M->SizeExpr);
|
M->Size = GetExprVal (M->SizeExpr);
|
||||||
|
|
||||||
/* Mark the memory area as placed */
|
|
||||||
M->Flags |= MF_PLACED;
|
|
||||||
|
|
||||||
/* Get the start address of this memory area */
|
|
||||||
Addr = M->Start;
|
|
||||||
|
|
||||||
/* Walk through the segments in this memory area */
|
/* Walk through the segments in this memory area */
|
||||||
for (J = 0; J < CollCount (&M->SegList); ++J) {
|
for (J = 0; J < CollCount (&M->SegList); ++J) {
|
||||||
|
|
||||||
@ -1886,11 +1899,6 @@ unsigned CfgProcess (void)
|
|||||||
Export* E;
|
Export* E;
|
||||||
StrBuf Buf = STATIC_STRBUF_INITIALIZER;
|
StrBuf Buf = STATIC_STRBUF_INITIALIZER;
|
||||||
|
|
||||||
/* Define the start of the memory area */
|
|
||||||
SB_Printf (&Buf, "__%s_START__", GetString (M->Name));
|
|
||||||
E = CreateMemoryExport (GetStrBufId (&Buf), M, 0);
|
|
||||||
E->Pos = M->Pos;
|
|
||||||
|
|
||||||
/* Define the size of the memory area */
|
/* Define the size of the memory area */
|
||||||
SB_Printf (&Buf, "__%s_SIZE__", GetString (M->Name));
|
SB_Printf (&Buf, "__%s_SIZE__", GetString (M->Name));
|
||||||
E = CreateConstExport (GetStrBufId (&Buf), M->Size);
|
E = CreateConstExport (GetStrBufId (&Buf), M->Size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user