Skip to content

Commit

Permalink
Fix linker issue
Browse files Browse the repository at this point in the history
Linker complained about ___a4_init not being defined. It was
referred to by __restore_a4(). But __restore_a4() is only needed in
-fbaserel builds (which is currently not enabled).

Apparently, the linker would previously define __a4_init regardless of the
linking method, but now removed it from non-base-relative builds, thus leading to
'missing symbol __a4_init' errors.

Fix the issue by making __restore_a4() only being defined when 'FBASEREL' is
defined. There might be an actual compiler-defined preprocessor symbol
indicating -fbaserel builds, but I couldn't find it. FBASEREL can be searched
and replaced later on, if deemed necessary.
  • Loading branch information
mheyer32 committed Oct 3, 2023
1 parent 26f0377 commit 0292930
Show file tree
Hide file tree
Showing 21 changed files with 62 additions and 0 deletions.
3 changes: 3 additions & 0 deletions source/Library/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/about/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/cleanup/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/configopus/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/diskcopy/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
2 changes: 2 additions & 0 deletions source/Modules/diskinfo/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,12 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif

/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/filetype/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/fixicons/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/format/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/ftp/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/icon/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ void __stdargs exit(int __status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/join/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/listerformat/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/misc/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ int _start(void) // must be first for 68k library
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/pathformat/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,13 @@ int _start(void) // must be first for 68k library
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/play/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/print/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/read/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/show/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/themes/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down
3 changes: 3 additions & 0 deletions source/Modules/xadopus/init/libinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,13 @@ __stdargs void exit(int status)
}
#endif

#ifdef FBASEREL
void __restore_a4(void)
{
__asm volatile("\tlea ___a4_init, a4");
}
#endif


/****************************************************************************/

Expand Down

0 comments on commit 0292930

Please sign in to comment.