Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
148 user(s) are online (80 user(s) are browsing Forums)

Members: 1
Guests: 147

clint, more...

Headlines

 
  Register To Post  

undefined reference to __reent_magic
Home away from home
Home away from home


See User information
I'm working on some shared library based exporter plugins for SketchBlock.

I've come across this

undefined reference to __reent_magic

error twice now , first time in libjpeg.a second time in libpng.a

It seems to be associated with the error reporting callbacks, in the case of libjpeg I replaced the error code with custom code, but although I could do that with libpng I'd like to work out how to fix this at src.

Naturally I'm building the library with -nostartfiles and opening INewlib for myself in the startup code.

Any ideas on what this symbol does and how to get it into my shared.library ?

Using the libpng.a and libjpeg.a from the SDK. (I think...)

Go to top
Re: undefined reference to __reent_magic
Not too shy to talk
Not too shy to talk


See User information
i made a text search for _reent_magic (one underscore at beginning) snside lots of amiga files and it seems used in several binary
Perhaps something like a #include <reent.h> is missing...


Alain

Go to top
Re: undefined reference to __reent_magic
Home away from home
Home away from home


See User information
@thellier

__reent_magic (deinetly two underscores ) is not defined in
reent.h or in sys/reent.h . They are included indirectly via stdio etc I think anyway.

It seems to be defined in

newlib/lib/crtbegin.o

Anyone know how to initialise it?



Go to top
Re: undefined reference to __reent_magic
Amigans Defender
Amigans Defender


See User information
I thought this error was caused by using libraries built for clib2 in a program built for newlib, or vice versa.

Maybe try rebuilding the libraries with the compiler+options you're using for the other code?

Go to top
Re: undefined reference to __reent_magic
Home away from home
Home away from home


See User information
@Chris

Quote:

I thought this error was caused by using libraries built for clib2 in a program built for newlib, or vice versa.


I'm fairly sure I'm using newlib compiled libPNG and the sysmbol does seem to be in the crtbegin.o object so I don;t think it's a mixng clib2 with newlib thing.

I just tried defining the symbol with

uint32 __reent_magic;


in my library init.c and it now links (as it would) but more interesting the png loader now works as expected.

I tried that before with the jpeg lib and it caused crashes, unless the crash was for some other reason, and just a coincidence (there were a few other errors to fix).

Possible work arround, love to hear from someone who "knows"....


Go to top
Re: undefined reference to __reent_magic
Just can't stay away
Just can't stay away


See User information
it's due newlib/clib2 mixing.

Go to top
Re: undefined reference to __reent_magic
Home away from home
Home away from home


See User information
@spotUP

No it's not. At least not in this case.

Yes you would get that error sometimes if you accidentally linked in a newlib based library to a clib2 based project, but in this case I'm not linking against clib2 but newlb.


Go to top
Re: undefined reference to __reent_magic
Just can't stay away
Just can't stay away


See User information
@broadblues
Quote:
but in this case I'm not linking against clib2 but newlb.

In my SDK the newlib/lib directory contains links to clib2 libraries (libamiga.a & libdebug.a). Is it possible that either of those libs are being linked in unintentionally??

Amiga X1000 with 2GB memory & OS 4.1FE + Radeon HD 5450

Go to top
Re: undefined reference to __reent_magic
Just can't stay away
Just can't stay away


See User information
@xenic

Libamiga.a doesn't use any clib functions so it doesn't matter whether you link it with clib2 or newlib. I think the same applies to libdebug.a as well.

Go to top
Re: undefined reference to __reent_magic
Just can't stay away
Just can't stay away


See User information
@broadblues

The symbol __reent_magic is in crtbegin.o (startup code). It's defined as an alias of SysBase but other than that I don't really know what it's used for.

Go to top
Re: undefined reference to __reent_magic
Home away from home
Home away from home


See User information
@salass00

Quote:

The symbol __reent_magic is in crtbegin.o (startup code). It's defined as an alias of SysBase but other than that I don't really know what it's used for.


hmm so defineing as

struct Library *__reent_magic = (struct Library *)SysBase

somewhere in my code should be enough?




Go to top
Re: undefined reference to __reent_magic
Just can't stay away
Just can't stay away


See User information
@broadblues

You could also just add:

extern struct Library *__reent_magic __attribute__((alias("SysBase")));

in the same file where you define the SysBase global.

This way they will use the same space in the executable so you won't have to init them separately.

The extern looks weird but is needed because otherwise the alias will only work locally.

Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2023 The XOOPS Project