Git Product home page Git Product logo

Comments (21)

bebbo avatar bebbo commented on August 28, 2024 1

added cxxglue.c to the clib2 too

Thanks! I guess that's not pushed to GitHub yet?

it's live: https://github.com/bebbo/clib2

from amiga-gcc.

hitman-codehq avatar hitman-codehq commented on August 28, 2024

Hello @Midar, there were some problems with exceptions in a previous version of Bebbo's GCC, and you can see that there was a long conversation here:

#218

There is a attachment in that issue (Exceptions.zip) which contains some test code. Interestingly, both of the test cases inside that code are now broken.

So it seems that it's back. So which change introduced it...

from amiga-gcc.

hitman-codehq avatar hitman-codehq commented on August 28, 2024

@bebbo I looked back in the history to November last year (when I last build a working version of the compiler) and I can't see any changes that would obviously cause exceptions to stop working. The only thing that might make a difference is a change to libamiga.a. Debugging this is a bit beyond me.

from amiga-gcc.

bebbo avatar bebbo commented on August 28, 2024

exceptions did work on 10th of April with libnix and do work with newlib too now.

from amiga-gcc.

hitman-codehq avatar hitman-codehq commented on August 28, 2024

@bebbo the problem is that I use clib, not libnix or newlib. Do you remember what change caused the problem?

from amiga-gcc.

bebbo avatar bebbo commented on August 28, 2024

@bebbo the problem is that I use clib, not libnix or newlib.

Oh ... I'm so sorry.
You have to add the cxxglue.o which can e.g. be found in libnix: /build-Linux-m68k-amigaos/libnix/lib/nix/cxxglue.o.

Do you remember what change caused the problem?
No - I don't test the clib2 c++ combination.
The problems here seem to be caused by

  • no longer adding cxxglue.o to the provided input files, now the symbol ___init_eh is wanted. Nothing in clib2 provides that atm.
  • stabs/constructors were replaced with sections. clib2 got updated accordingly.

from amiga-gcc.

bebbo avatar bebbo commented on August 28, 2024

added cxxglue.c to the clib2 too

from amiga-gcc.

hitman-codehq avatar hitman-codehq commented on August 28, 2024

added cxxglue.c to the clib2 too

Thanks! I guess that's not pushed to GitHub yet?

from amiga-gcc.

hitman-codehq avatar hitman-codehq commented on August 28, 2024

BTW @bebbo I am experimenting with using libnix instead of clib2. Can you confirm that the way to do this is to specify -mcrt=nix20 both when compiling and when linking? I want to make sure I'm doing it correctly.

I remember seeing some instructions on your GitHub page a while ago, but I can't find them now.

from amiga-gcc.

bebbo avatar bebbo commented on August 28, 2024

BTW @bebbo I am experimenting with using libnix instead of clib2. Can you confirm that the way to do this is to specify -mcrt=nix20 both when compiling and when linking? I want to make sure I'm doing it correctly.

I remember seeing some instructions on your GitHub page a while ago, but I can't find them now.

You always add it to compile an link once.
Ensure that it doesn't appear twice at the linking stage.

from amiga-gcc.

hitman-codehq avatar hitman-codehq commented on August 28, 2024

Thank you for the tips! I can confirm that after rebuilding with the latest amiga-gcc repo version and the new clib2, the exception handling is working again.

from amiga-gcc.

hitman-codehq avatar hitman-codehq commented on August 28, 2024

Actually I am having some trouble with getting my software to work with -mcrt=nix20. My libauto.a entry points are crashing. @bebbo you may remember this issue from last year:

#289

We had some problem the the following code:

void OpenAslBase() attribute((constructor));

void OpenAslBase()
{
AslBase = SafeOpenLibrary("asl.library");
}

Should this be working with -mcrt=nix20? The code is crashing hard at startup and it seems that the functions like OpenAslBase() are not actually getting called - the crash happens in the C++ startup code. With -mcrt=clib2 it is working.

from amiga-gcc.

bebbo avatar bebbo commented on August 28, 2024

It looks like some library couldn't be opened. The init code could crash if the dos.library wasn't already opened... this is fixed now.

attribute((constructor)) does work

from amiga-gcc.

Midar avatar Midar commented on August 28, 2024

Sorry for the late response, I finally have working computer again now.

Unfortunately nothing has changed, abort() gets called immediately. The usual failure mode was that exceptions just aren't caught, but it seems in this cases just entering a try block is already aborting everything?

// Edit: @try itself works, the abort() is on the first @throw. It just turned out there was a @throw during startup already.

from amiga-gcc.

Midar avatar Midar commented on August 28, 2024

Debugged it: It's the same problem again. m68k-amiga-gcc doesn't link in the glue any more, only m68k-amiga-g++ does. This is the same issue as a few years ago.

from amiga-gcc.

hitman-codehq avatar hitman-codehq commented on August 28, 2024

@Midar I have had similar problems in the past, due to using gcc instead of g++, so it's important to use the correct compiler front end if you are targeting C++.

Another "gotcha" that caught me out is that you have to use the same compiler switches for all .cpp files that you are building. I have one file in my support library (a BSD socket wrapper class) that uses C++ exceptions, so I was enabling exceptions just for that file, to try and make my executable smaller. But this meant that on some C++ compilers, exception handling was broken! It has to be enabled for all files to work properly.

Actually, using C++ exception handling for one single file has caused so many problems that I regret using it! Plus it has made all of my binaries larger.

from amiga-gcc.

Midar avatar Midar commented on August 28, 2024

@hitman-codehq m68k-amigaos-gcc would be the correct compiler for ObjC with exceptions, though.

from amiga-gcc.

bebbo avatar bebbo commented on August 28, 2024

you could have used the option -Wl,-u___init_eh ...

from amiga-gcc.

Midar avatar Midar commented on August 28, 2024

Ah, good idea! That works, excellent!

from amiga-gcc.

bebbo avatar bebbo commented on August 28, 2024

giving -fexceptions to the linker via gcc does the same now.

from amiga-gcc.

Midar avatar Midar commented on August 28, 2024

Thanks, that brings it back to the old behavior - I could revert all hacks now.

from amiga-gcc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.