mirror of
https://github.com/gbdev/rgbds.git
synced 2025-11-21 10:42:07 +00:00
Improve section overflow error message
When trying to fix a section becoming too large, the size it reached is necessary to know whether to optimize away a few bytes or split it entirely. This error is also commonly encountered when INCBINing too large a slice of a file, in which case the amount of bytes by which the section is too large is again an useful information
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* This file is part of RGBDS.
|
* This file is part of RGBDS.
|
||||||
*
|
*
|
||||||
* Copyright (c) 1997-2018, Carsten Sorensen and RGBDS contributors.
|
* Copyright (c) 1997-2019, Carsten Sorensen and RGBDS contributors.
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: MIT
|
* SPDX-License-Identifier: MIT
|
||||||
*/
|
*/
|
||||||
@@ -516,8 +516,9 @@ static void checksectionoverflow(uint32_t delta_size)
|
|||||||
{
|
{
|
||||||
uint32_t maxsize = getmaxsectionsize(pCurrentSection->nType,
|
uint32_t maxsize = getmaxsectionsize(pCurrentSection->nType,
|
||||||
pCurrentSection->pzName);
|
pCurrentSection->pzName);
|
||||||
|
uint32_t new_size = pCurrentSection->nPC + delta_size;
|
||||||
|
|
||||||
if (pCurrentSection->nPC + delta_size > maxsize) {
|
if (new_size > maxsize) {
|
||||||
/*
|
/*
|
||||||
* This check is here to trap broken code that generates
|
* This check is here to trap broken code that generates
|
||||||
* sections that are too big and to prevent the assembler from
|
* sections that are too big and to prevent the assembler from
|
||||||
@@ -525,8 +526,8 @@ static void checksectionoverflow(uint32_t delta_size)
|
|||||||
* memory.
|
* memory.
|
||||||
* The real check must be done at the linking stage.
|
* The real check must be done at the linking stage.
|
||||||
*/
|
*/
|
||||||
fatalerror("Section '%s' is too big (max size = 0x%X bytes).",
|
fatalerror("Section '%s' is too big (max size = 0x%X bytes, reached 0x%X).",
|
||||||
pCurrentSection->pzName, maxsize);
|
pCurrentSection->pzName, maxsize, new_size);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user