mirror of
https://github.com/cc65/cc65.git
synced 2024-12-23 04:30:10 +00:00
Fixed a bug: If all output data was discarded (by using file = "" in the
linker config), CheckExports was never called, which in turn meant that the list of all exports was never built. This caused a crash later when the linker tried to generate a map file. The solution is to separate the creation of the exports list and the check for unresolved imports. git-svn-id: svn://svn.cc65.org/cc65/trunk@3360 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
parent
a456e503e4
commit
9cd0b7705c
@ -262,7 +262,7 @@ void BinWriteTarget (BinDesc* D, struct File* F)
|
||||
* if we get an unresolved symbol.
|
||||
*/
|
||||
D->Undef = 0; /* Reset the counter */
|
||||
CheckExports (BinUnresolved, D);
|
||||
CheckUnresolvedImports (BinUnresolved, D);
|
||||
if (D->Undef > 0) {
|
||||
/* We had unresolved symbols, cannot create output file */
|
||||
Error ("%u unresolved external(s) found - cannot create output file", D->Undef);
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* (C) 1998-2005 Ullrich von Bassewitz */
|
||||
/* Römerstraße 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
@ -576,7 +576,7 @@ static void CheckSymType (const Export* E)
|
||||
Warning ("Address size mismatch for `%s': Symbol is `%s'"
|
||||
", but imported from %s, %s(%lu) as `%s'",
|
||||
GetString (E->Name),
|
||||
ExpAddrSize,
|
||||
ExpAddrSize,
|
||||
ImpObjName,
|
||||
GetSourceFileName (Imp->Obj, Imp->Pos.Name),
|
||||
Imp->Pos.Line,
|
||||
@ -669,9 +669,9 @@ static void CreateExportPool (void)
|
||||
|
||||
|
||||
|
||||
void CheckExports (ExpCheckFunc F, void* Data)
|
||||
/* Check if there are any unresolved symbols. On unresolved symbols, F is
|
||||
* called (see the comments on ExpCheckFunc in the data section).
|
||||
void CheckExports (void)
|
||||
/* Setup the list of all exports and check for export/import symbol type
|
||||
* mismatches.
|
||||
*/
|
||||
{
|
||||
/* Create an export pool */
|
||||
@ -679,8 +679,16 @@ void CheckExports (ExpCheckFunc F, void* Data)
|
||||
|
||||
/* Check for symbol type mismatches */
|
||||
CheckSymTypes ();
|
||||
}
|
||||
|
||||
/* Check for unresolved externals (check here for special bin formats) */
|
||||
|
||||
|
||||
void CheckUnresolvedImports (ExpCheckFunc F, void* Data)
|
||||
/* Check if there are any unresolved imports. On unresolved imports, F is
|
||||
* called (see the comments on ExpCheckFunc in the data section).
|
||||
*/
|
||||
{
|
||||
/* Check for unresolved externals */
|
||||
if (ImpOpen != 0) {
|
||||
/* Print all open imports */
|
||||
PrintUnresolved (F, Data);
|
||||
|
@ -158,8 +158,13 @@ int IsConstExport (const Export* E);
|
||||
long GetExportVal (const Export* E);
|
||||
/* Get the value of this export */
|
||||
|
||||
void CheckExports (ExpCheckFunc F, void* Data);
|
||||
/* Check if there are any unresolved symbols. On unresolved symbols, F is
|
||||
void CheckExports (void);
|
||||
/* Setup the list of all exports and check for export/import symbol type
|
||||
* mismatches.
|
||||
*/
|
||||
|
||||
void CheckUnresolvedImports (ExpCheckFunc F, void* Data);
|
||||
/* Check if there are any unresolved imports. On unresolved imports, F is
|
||||
* called (see the comments on ExpCheckFunc in the data section).
|
||||
*/
|
||||
|
||||
@ -189,7 +194,7 @@ void CircularRefError (const Export* E);
|
||||
/* End of exports.h */
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1998-2003 Ullrich von Bassewitz */
|
||||
/* (C) 1998-2005 Ullrich von Bassewitz */
|
||||
/* Römerstrasse 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
@ -512,6 +512,9 @@ int main (int argc, char* argv [])
|
||||
/* Check module assertions */
|
||||
CheckAssertions ();
|
||||
|
||||
/* Check for import/export mismatches */
|
||||
CheckExports ();
|
||||
|
||||
/* Create the output file */
|
||||
CfgWriteTarget ();
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
/* */
|
||||
/* */
|
||||
/* */
|
||||
/* (C) 1999-2003 Ullrich von Bassewitz */
|
||||
/* (C) 1999-2005 Ullrich von Bassewitz */
|
||||
/* Römerstraße 52 */
|
||||
/* D-70794 Filderstadt */
|
||||
/* EMail: uz@cc65.org */
|
||||
@ -1356,7 +1356,7 @@ void O65WriteTarget (O65Desc* D, File* F)
|
||||
* if we get an unresolved symbol.
|
||||
*/
|
||||
D->Undef = 0; /* Reset the counter */
|
||||
CheckExports (O65Unresolved, D);
|
||||
CheckUnresolvedImports (O65Unresolved, D);
|
||||
if (D->Undef > 0) {
|
||||
/* We had unresolved symbols, cannot create output file */
|
||||
Error ("%u unresolved external(s) found - cannot create output file", D->Undef);
|
||||
|
Loading…
Reference in New Issue
Block a user