AmigaLabs / binutils-gdb

binutils targeted for ppc-amigaos systems (AmigaOS NG like OS4.1).
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git
GNU General Public License v2.0
0 stars 0 forks source link

gl4es programs fail to initialize, maybe due to usage of constructors/destructors, maybe due to getproc() functions #11

Closed kas1e closed 1 year ago

kas1e commented 1 year ago

Find out that GL4ES programs, while builds, fail on running, without ability to initialize drawing context properly. Not sure what the reasons, but initialization process are there: https://github.com/ptitSeb/gl4es/blob/master/src/gl/init.c

Maybe related to constructors/destructors, maybe related to the getproc() functions, for now didn't know..

kas1e commented 1 year ago

Some more info:

After adding some prinfs, i can say that from this init.c file, these parts are used for amigaos4 build:

__attribute__((constructor(101)))  // line 82
__attribute__((destructor)) // line 722

So, GL4ES tried to create additional constructor/destructor pair (that 101 one), but seems to fail.

Probably because it wants to use ctros/dtors additional constructor (101) in , and fail because of non-working fini/init constructors in which we don't have also calls to the “old” ctros/dtors constructors ?

If that the case, we probably need to think how to switch to the old ctor/dtors way , because very possible that to fix this properly there will be needs to fix newlib/clib2 (to support and fini/init, and calls to ctros/dtors from) which out of binutils scope, probably.

kas1e commented 1 year ago

Issue were on the binutils build with init/fini array support which is not yet implemented in our LIBcs , so that why it fail. Once we fall back to older .ctors/.dtors way (via set in ld/emulparams/amigaos.sh ENABLE_INITFINI_ARRAY=no, as it was in older adtools) , everything start to work again.

So the issue is more like about proper implementation of init/fini arrays, for which we already had a ticket for.