bebbo / libnix

libnix (v4): a C link library for AmigaOS/m68k
14 stars 9 forks source link

Did something change wrt swapstack.o? #85

Open mheyer32 opened 1 week ago

mheyer32 commented 1 week ago

DOpus is not linking anymore, complaining about a missing swapstack.o:

>>>>>Compiling amiga.c
m68k-amigaos-gcc data.o string_data.o function_data.o menu_data.o palette_routines.o pattern.o key_press.o key_finder_data.o main.o commands.o menus.o popup.o popup_build.o iconpos.o cx.o wb.o text.o help.o eliza.o event_loop.o main_reset.o backdrop.o backdrop_render.o backdrop_idcmp.o backdrop_buttons.o backdrop_utils.o backdrop_arrange.o backdrop_position.o backdrop_open.o backdrop_drag.o backdrop_groups.o backdrop_notify.o backdrop_appicon.o backdrop_devices.o backdrop_snapshot.o backdrop_popup.o backdrop_format.o backdrop_select.o backdrop_info.o backdrop_leftout.o backdrop_replace.o desktop.o desktop_delete.o desktop_drop.o desktop_rename.o desktop_folder.o groups_new.o toolbar.o requesters.o notify.o graphics.o misc.o misc_proc.o dates.o links.o path_routines.o status_text.o scripts.o buffers.o buffers_util.o buffers_sort.o buffers_reselect.o filetypes.o filetypes_proc.o search_data.o lister.o lister_data.o lister_proc.o lister_idcmp.o lister_function.o lister_window.o lister_diskinfo.o lister_display.o lister_busy.o lister_title.o lister_activate.o lister_buffers.o lister_dir.o lister_show.o lister_toolbar.o lister_drop.o lister_icons.o lister_progress.o lister_clip.o lister_menus.o lister_hotname.o lister_edit.o lister_ftp.o buttons.o buttons_data.o buttons_proc.o buttons_draw.o buttons_window.o buttons_display.o buttons_idcmp.o buttons_function.o buttons_run.o buttons_io.o buttons_edit.o buttons_popup.o start_menu.o dirlist_read.o dirlist_scroll.o dirlist_util.o function_launch.o function_paths.o function_readdir.o function_run.o function_parse.o function_internal.o function_external.o function_script.o function_support.o function_filechange.o function_filetype.o function_files.o function_all.o function_none.o function_toggle.o function_copy.o function_delete.o function_makedir.o function_rename.o function_stopsniff.o function_select.o function_select_data.o function_devicelist.o function_change.o function_change_data.o function_scandir.o function_clearbuffers.o function_show.o function_disk.o function_loadbuttons.o function_loadenvironment.o function_loadfonts.o function_leaveout.o function_runprog.o function_addicon.o function_search.o function_getsizes.o function_hunt.o function_parent.o function_user.o function_verify.o function_cli.o function_printdir.o function_set.o function_closebuttons.o function_special.o function_reselect.o function_assign.o function_configure.o function_setbackground.o function_runcommand.o function_reset.o clock_task.o environment.o app_msg.o icons.o icon_function.o file_select.o file_openwith.o window_activate.o cleanup.o tile.o display.o display_pattern.o rexx_proc.o rexx_lister.o rexx_files.o rexx_util.o rexx_data.o rexx_traps.o rexx_apps.o rexx_handler.o rexx_cmd.o rexx_dopus.o dos_notify.o replace.o position.o callback_main.o callback_dir.o callback_help.o callback_lister.o about.o amiga.o -m68020-60 -mtune=68030 -flto -fshort-enums -D__amigaos3__ -D__USE_SYSBASE -D__NO_NET_API -DUSE_64BIT -DCOMPDATE=19.06.2024 -g -ggdb -noixemul -Os -fomit-frame-pointer -specs _gcc.spec -stackswap -ldebug -lamiga -o ../bin.os3/DirectoryOpus_unstripped
/home/matze/amigatoolchain/amiga-gcc-out/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: cannot find swapstack.o: No such file or directory

And indeed, I can't find swapstack.o anywhere in the output directory...

mheyer32 commented 1 week ago

Weird, I did a make update today, now compiling DOpus ends up in:

68k-amigaos-gcc init/libinit.o read.o read_data.o read_strings.o init/amiga.o -m68020-60 -mtune=68030 -flto -fshort-enums -D__amigaos3__ -D__USE_SYSBASE -D__NO_NET_API -DUSE_64BIT -DCOMPDATE=19.06.2024 -g -ggdb -noixemul -Os -fomit-frame-pointer -nostartfiles -ldebug -lamiga -o ../../bin.os3/read.module_unstripped
/tmp/cc6nnJsy.s: Assembler messages:
/tmp/cc6nnJsy.s:2105: Error: syntax error -- statement `jsr (#-36,a6)' ignored
/tmp/cc6nnJsy.s:2804: Error: syntax error -- statement `jsr (#-30,a6)' ignored
/tmp/cc6nnJsy.s:3631: Error: syntax error -- statement `jsr (#-66,a6)' ignored
/tmp/cc6nnJsy.s:3682: Error: syntax error -- statement `jsr (#-66,a6)' ignored
lto-wrapper: fatal error: m68k-amigaos-gcc returned 1 exit status
compilation terminated.
collect2: fatal error: lto-wrapper returned 1 exit status
compilation terminated.
bebbo commented 1 week ago

Weird, I did a make update today, now compiling DOpus ends up in:

68k-amigaos-gcc init/libinit.o read.o read_data.o read_strings.o init/amiga.o -m68020-60 -mtune=68030 -flto -fshort-enums -D__amigaos3__ -D__USE_SYSBASE -D__NO_NET_API -DUSE_64BIT -DCOMPDATE=19.06.2024 -g -ggdb -noixemul -Os -fomit-frame-pointer -nostartfiles -ldebug -lamiga -o ../../bin.os3/read.module_unstripped
/tmp/cc6nnJsy.s: Assembler messages:
/tmp/cc6nnJsy.s:2105: Error: syntax error -- statement `jsr (#-36,a6)' ignored
/tmp/cc6nnJsy.s:2804: Error: syntax error -- statement `jsr (#-30,a6)' ignored
/tmp/cc6nnJsy.s:3631: Error: syntax error -- statement `jsr (#-66,a6)' ignored
/tmp/cc6nnJsy.s:3682: Error: syntax error -- statement `jsr (#-66,a6)' ignored
lto-wrapper: fatal error: m68k-amigaos-gcc returned 1 exit status
compilation terminated.
collect2: fatal error: lto-wrapper returned 1 exit status
compilation terminated.

caused by a bogus fix for https://github.com/bebbo/gcc/issues/233 ... test in 30 mins

bebbo commented 1 week ago

-stackswap

Please update your own spec file and use -u___stkswap since that file is in the library now. Or don't use an own spec and define the reference in the code:

  unsigned long __stack = 42000;
  extern long __stkswap;
  long * __ref = &__stkswap;
mheyer32 commented 1 week ago

Thank you! The compilation error got fixed. Removing the referal to the .spec file and -stackswap and replacing it with -u___stkswap let it compile again. But now the program crashes at startup - could be some other failure.

You can try your own build: checkout https://github.com/mheyer32/dopus5allamigas/tree/new_stackswap

go to /source and build: make os3 release debug=<yes|no>

Then the whole build ends up as a zip file under /release

bebbo commented 1 week ago

if you want to pass -u___stkswap to gcc (and not to the linker directly), then you have to use -Wl,-u___stkswap

mheyer32 commented 6 days ago

So, I was able to track down the crash at DOpus' startup to opening sysinfo.library. It is unclear to me why that is, but I don't think its compiler related. Renaming sysinfo.library gets DOpus to start properly.

Is there a way to confirm that the -Wl,-u___stackswap mechanics are working properly?

bebbo commented 6 days ago
grep stkswap bin.os3/DirectoryOpus_unstripped
bebbo commented 6 days ago

So, I was able to track down the crash at DOpus' startup to opening sysinfo.library. It is unclear to me why that is, but I don't think its compiler related. Renaming sysinfo.library gets DOpus to start properly.

Is there a way to confirm that the -Wl,-u___stackswap mechanics are working properly?

This is wrong. use -Wl,-u___stkswap

mheyer32 commented 6 days ago

Oh, ok, it's typo in my comment. I think I copy&pasted correctly:

https://github.com/mheyer32/dopus5allamigas/commit/ae80ab910defbf63a6d345ff03eb8ea0595b8655

bebbo commented 6 days ago

so what is the grep command printing?

mheyer32 commented 6 days ago

Looks good!(?)

➜  source git:(master) ✗ grep stkswap bin.os3/DirectoryOpus_unstripped
grep: bin.os3/DirectoryOpus_unstripped: binary file matches
bebbo commented 6 days ago

And if you are curious you might test -Wl,-u___checkstack too. Use both together.