20 March 2023, 21:36 | #1441 |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 680
|
|
20 March 2023, 21:46 | #1442 | |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 680
|
Quote:
I wonder why this should work with native g++ Code:
make all g++ ./mylib/hello.cpp -c -o ./mylib/hello.o g++ ./mylib/count.cpp -c -o ./mylib/count.o ar rcs ./mylib/libmylib.a ./mylib/hello.o ./mylib/count.o g++ -L./mylib -lmylib test.cpp /usr/local/bin/ld: /tmp/ccnPte5H.o: in function `main': test.cpp:(.text+0x4e): undefined reference to `Greeter::greet(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)' /usr/local/bin/ld: test.cpp:(.text+0x7c): undefined reference to `Count::sum(int, int)' collect2: error: ld returned 1 exit status make: *** [Makefile:19: all] Error 1 => you are applying the $(LDFLAGS) too early, the linker is working from left to right. I also recommend using -noixemul. ALWAYS. Also you might give the program a name. And make the all: rule the first rule in your Makefile. Plus stop complaining about the size, you get what you order. Using streams adds you a huge rat tail of code. Also exception handling / rtti, even if not used. You might also try the linker option -gc-sections (-Wl,-gc-sections if invoked via gcc) => exclude / omit the features that aren't needed. Last edited by bebbo; 21 March 2023 at 06:18. |
|
20 March 2023, 23:07 | #1443 | |
Registered User
Join Date: Jul 2020
Location: Roma
Posts: 4
|
Quote:
Code:
#include <iostream> int main () { std::cout << "Hello world\n"; } Code:
m68k-amigaos-g++ -noixemul hello.cpp Code:
ls -al drwxrwxr-x 2 user user 4096 mar 20 23:04 . drwxr-xr-x 13 user user 4096 mar 20 23:03 .. -rwxrwxr-x 1 user user 1145560 mar 20 23:04 a.out -rw-rw-r-- 1 user user 70 mar 20 23:03 hello.cpp |
|
20 March 2023, 23:27 | #1444 | ||
Registered User
Join Date: Jul 2020
Location: Roma
Posts: 4
|
Quote:
Quote:
Thank you again for your wonderful product. |
||
21 March 2023, 00:30 | #1445 |
Registered User
Join Date: Sep 2007
Location: Melbourne/Australia
Posts: 4,400
|
|
21 March 2023, 07:35 | #1446 | |
old chunk of coal
Join Date: Nov 2011
Location: Hungary
Posts: 1,289
|
Quote:
|
|
21 March 2023, 11:22 | #1447 | |
Registered User
Join Date: Jul 2020
Location: Roma
Posts: 4
|
Quote:
-noixemul reduces the file to 20kb. Thank you. |
|
04 April 2023, 10:53 | #1448 |
Registered User
Join Date: Apr 2016
Location: Perth, Australia
Posts: 384
|
Hi all,
I have been trying to upgrade the VSCode Amiga gcc toolchain to the latest gcc amiga toolchain here. I compiled the toolchain fine and I have been trying to modify my Makefile which was initially created from the VSCode extension with some small changes that I made. I've tried to change the Makefile to point to the new tools. It compiles into object files ok but it just fails when linking it doesn't even tell me why. I'm very frustrated atm because I've tried all day to get it working. Does anyone have any insights? When I run the make command I get this output after it successfully compiles into object files: Code:
Compiling src/support/gcc8_c_support.c Assembling src/support/gcc8_a_support.s Assembling src/support/depacker_doynax.s Assembling src/support/depacker_doynax_vasm.asm Linking out/a.elf /opt/amiga/bin/m68k-amigaos-gcc -g -MP -MMD -m68000 -Ofast -O0 -Wextra -Wno-unused-function -Wno-volatile-register-var -fomit-frame-pointer -fno-tree-loop-distribution -flto -fwhole-program -fno-exceptions -D__NO_NET_API -D__NOLIBBASE__ -Wl,--emit-relocs,-Ttext=0,-Map=out/a.map,-I/opt/amiga/m68k-amigaos/include-I/opt/amiga/m68k-amigaos/sys-include,-I/opt/amiga/m68k-amigaos/ndk-include obj/amiga.o obj/console.o obj/gui.o obj/main.o obj/math.o obj/openai.o obj/speech.o obj/stringutil.o obj/sprintf.o obj/gcc8_c_support.o obj/gcc8_a_support.o obj/depacker_doynax.o obj/depacker_doynax_vasm.o -o out/a.elf collect2: fatal error: /opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/nm returned 1 exit status compilation terminated. make: *** [out/a.elf] Error 1 My Makefile is as follows: Code:
# to generate assembler listing with LTO, add to LDFLAGS: -Wa,-adhln=$@.listing,--listing-rhs-width=200 # for better annotations add -dA -dP # to generate assembler source with LTO, add to LDFLAGS: -save-temps=cwd ifdef OS WINDOWS = 1 SHELL = cmd.exe endif subdirs := $(wildcard */) $(wildcard src/*/) VPATH = $(subdirs) cpp_sources := $(wildcard *.cpp) $(wildcard $(addsuffix *.cpp,$(subdirs))) cpp_objects := $(addprefix obj/,$(patsubst %.cpp,%.o,$(notdir $(cpp_sources)))) c_sources := $(wildcard *.c) $(wildcard $(addsuffix *.c,$(subdirs))) c_objects := $(addprefix obj/,$(patsubst %.c,%.o,$(notdir $(c_sources)))) s_sources := support/gcc8_a_support.s support/depacker_doynax.s s_objects := $(addprefix obj/,$(patsubst %.s,%.o,$(notdir $(s_sources)))) vasm_sources := $(wildcard *.asm) $(wildcard $(addsuffix *.asm, $(subdirs))) vasm_objects := $(addprefix obj/, $(patsubst %.asm,%.o,$(notdir $(vasm_sources)))) objects := $(cpp_objects) $(c_objects) $(s_objects) $(vasm_objects) # https://stackoverflow.com/questions/4036191/sources-from-subdirectories-in-makefile/4038459 # http://www.microhowto.info/howto/automatically_generate_makefile_dependencies.html program = out/a OUT = $(program) CC = /opt/amiga/bin/m68k-amigaos-gcc VASM = /opt/amiga/bin/vasmm68k_mot ifdef WINDOWS SDKDIR = $(abspath $(dir $(shell where $(CC)))..\m68k-amiga-elf\sys-include) else # SDKDIR = $(abspath $(dir $(shell which $(CC)))../m68k-amiga-elf/sys-include) SDKDIR = /opt/amiga/m68k-amigaos/sys-include NDKDIR = /opt/amiga/m68k-amigaos/ndk-include INCDIR = /opt/amiga/m68k-amigaos/include CCPATH = /opt/amiga/bin/m68k-amiga-elf-gcc ELFOBJDUMP = /opt/amiga/bin/m68k-amigaos-objdump endif CCFLAGS = -g -MP -MMD -m68000 -Ofast -O0 -Wextra -Wno-unused-function -Wno-volatile-register-var -fomit-frame-pointer -fno-tree-loop-distribution -flto -fwhole-program -fno-exceptions -D__NO_NET_API -D__NOLIBBASE__ CPPFLAGS= $(CCFLAGS) -fno-rtti -fcoroutines -fno-use-cxa-atexit ASFLAGS = -Wa,-g,--register-prefix-optional,-I$(SDKDIR),-I$(NDKDIR),-I$(INCDIR),-D LDFLAGS = -Wl,--emit-relocs,-Ttext=0,-Map=$(OUT).map,-I$(INCDIR)-I$(SDKDIR),-I$(NDKDIR) VASMFLAGS = -m68000 -Felf -opt-fconst -nowarn=62 -dwarf=3 -quiet -x -I. -I$(INCDIR) -I$(SDKDIR) -I$(NDKDIR) all: $(OUT).exe $(OUT).exe: $(OUT).elf $(info Elf2Hunk $(program).exe) elf2hunk $(OUT).elf $(OUT).exe -s $(OUT).elf: $(objects) $(info Linking $(program).elf) $(CC) $(CCFLAGS) $(LDFLAGS) $(objects) -o $@ $(ELFOBJDUMP) --no-show-raw-ins --visualize-jumps -S $@ >$(OUT).s clean: $(info Cleaning...) ifdef WINDOWS @del /q obj\* out\* else @$(RM) obj/* out/* endif -include $(objects:.o=.d) $(cpp_objects) : obj/%.o : %.cpp $(info Compiling $<) @$(CC) $(CPPFLAGS) -c -o $@ $(CURDIR)/$< $(c_objects) : obj/%.o : %.c $(info Compiling $<) @$(CC) $(CCFLAGS) -c -o $@ $(CURDIR)/$< $(s_objects): obj/%.o : %.s $(info Assembling $<) @$(CC) $(CCFLAGS) $(ASFLAGS) -c -o $@ $(CURDIR)/$< $(vasm_objects): obj/%.o : %.asm $(info Assembling $<) @$(VASM) $(VASMFLAGS) -o $@ $(CURDIR)/$< I really appreciate any assistance helping me because I'm making an exciting app for AmigaOS and I'd love to be able to use the AmigaOS 3.2 NDK Last edited by Nightfox; 04 April 2023 at 10:59. |
05 April 2023, 08:45 | #1449 |
Registered User
Join Date: Jul 2017
Location: San Jose
Posts: 652
|
From a quick glance I can see your VASMFLAGS to produce .elf object files. That doesn’t work with Bebbo’s toolchain. His will generate HUNK object files all throughout. Try passing -Fhunk to vasm and report back.
|
05 April 2023, 10:32 | #1450 |
Registered User
Join Date: Apr 2016
Location: Perth, Australia
Posts: 384
|
Thanks. I get a new error now.
Code:
Compiling src/support/gcc8_c_support.c Assembling src/support/gcc8_a_support.s Assembling src/support/depacker_doynax.s Assembling src/support/depacker_doynax_vasm.asm error 3004: section attributes <r> not supported error 3004: section attributes <r> not supported error 3004: section attributes <r> not supported error 3004: section attributes <r> not supported error 3004: section attributes <r> not supported ***maximum number of errors reached!*** |
05 April 2023, 10:37 | #1451 |
Registered User
|
Another thing you could try, is using -flto for complling and linking, then stripping all the executable debug symbols. That is, if you want to try with stdc++ iostreams again.
|
05 April 2023, 19:51 | #1452 | |
Registered User
Join Date: Jul 2017
Location: San Jose
Posts: 652
|
Quote:
This sounds to me as if there’s incompatible syntax in this file and vasm complains about it. Can you post some of the offending lines? |
|
06 April 2023, 04:15 | #1453 |
Registered User
Join Date: Apr 2016
Location: Perth, Australia
Posts: 384
|
Here it is. I don't even think I need it for my app anyway. As I said it just came with the default project.
Code:
;------------------------------------------------------------------------------- ;Lempel-Ziv decompressor. Call doynamitedepack to decode the entire buffer in ;one go. ; ;This is a fork of the 68000 depacker by Michael Hillebrandt (Axis/Oxyron) ;for the 6502 Doynamite format, except with the encoding rearranged to take ;somewhat better advantage of the 68k architecture. ; ;The present version is 210 bytes long including the tables and should fit ;snugly in the 68020+ cache. ; ;Note that the scheme with a split input stream for odd literal bytes requires ;a significant safety buffer for forward in-place decompression (about 3% but ;dependent on the file to be processed) ; ;Parameters: ;a0 = Input buffer to be decompressed. Must be 16-bit aligned! ;a1 = Output buffer. Points to the end of the data at exit ; ;Register legend: ;d0 = 32-bit shift register terminated by a least-significant 1 bit. ;d1 = Run length. ;d2 = Match offset length in bits. ;d3 = Match offset bitmask. ;d4 = Constant offset type mask. ;d5 = Constant offset length bit mask. ;a0 = Bit-stream pointer. ;a1 = Continuous output pointer. ;a2 = Unaligned literal pointer ahead of the bit-stream. Points to the end of ; the source buffer at exit. ;a3 = Mid-point where the literal buffer meets the bit-stream at EOF ;a4 = Match source pointer. ;------------------------------------------------------------------------------- ;Ensure that the shift-register contains at least 16-bits of data by ;checking whether the trailing word is zero, and if so filling up with ;another word DOY_REFILL macro DOY_REFILL1 doy_full\@ DOY_REFILL2 doy_full\@: endm DOY_REFILL1 macro tst.w d0 bne.s \1 endm DOY_REFILL2 macro ;This swaps in the new bits ahead of the move.w (a0)+,d0 ;old, but that's fine as long as the swap.w d0 ;encoder is in on the scheme endm ;Entry point. Wind up the decruncher _doynaxdepack_vasm: movea.l (a0)+,a2 ;Unaligned literal buffer at the end of adda.l a0,a2 ;the stream move.l a2,a3 move.l (a0)+,d0 ;Seed the shift register moveq #@70,d4 ;Masks for match offset extraction moveq #@10,d5 bra.s doy_literal ;******** Copy a literal sequence ******** doy_lcopy: ;Copy two bytes at a time, with the move.b (a0)+,(a1)+ ;deferral of the length LSB helping move.b (a0)+,(a1)+ ;slightly in the unrolling dbf d1,doy_lcopy lsl.l #2,d0 ;Copy odd bytes separately in order bcc.s doy_match ;to keep the source aligned doy_lsingle: move.b (a2)+,(a1)+ ;******** Process a match ******** ;Start by refilling the bit-buffer doy_match: DOY_REFILL1 doy_mprefix cmp.l a0,a3 ;Take the opportunity to test for the bls.s doy_return ;end of the stream while refilling doy_mrefill: DOY_REFILL2 doy_mprefix: ;Fetch the first three bits identifying the match length, and look up ;the corresponding table entry rol.l #3+3,d0 move.w d0,d1 and.w d4,d1 eor.w d1,d0 movem.w doy_table(pc,d1.w),d2/d3/a4 ;Extract the offset bits and compute the relative source address from it rol.l d2,d0 ;Reduced by 3 to account for 8x offset and.w d0,d3 ;scaling eor.w d3,d0 suba.w d3,a4 adda.l a1,a4 ;Decode the match length DOY_REFILL and.w d5,d1 ;Check the initial length bit from the beq.s doy_mcopy ;type triple moveq #1,d1 ;This loops peeks at the next flag tst.l d0 ;through the sign bit bit while keeping bpl.s doy_mendlen2 ;the LSB in carry lsl.l #2,d0 bpl.s doy_mendlen1 doy_mgetlen: addx.b d1,d1 lsl.l #2,d0 bmi.s doy_mgetlen doy_mendlen1: addx.b d1,d1 doy_mendlen2: ;Copy the match data a word at a time. Note that the minimum length is ;two bytes lsl.l #2,d0 ;The trailing length payload bit is bcc.s doy_mhalf ;stored out-of-order doy_mcopy: move.b (a4)+,(a1)+ doy_mhalf: move.b (a4)+,(a1)+ dbf d1,doy_mcopy ;Fetch a bit flag to see whether what follows is a literal run or ;another match add.l d0,d0 bcc.s doy_match ;******** Process a run of literal bytes ******** DOY_REFILL ;Replenish the shift-register doy_literal: ;Extract delta-coded run length in the same swizzled format as the ;matches above moveq #0,d1 add.l d0,d0 bcc.s doy_lsingle ;Single out the one-byte case bpl.s doy_lendlen doy_lgetlen: addx.b d1,d1 lsl.l #2,d0 bmi.s doy_lgetlen doy_lendlen: addx.b d1,d1 ;Branch off to the main copying loop unless the run length is 256 bytes ;or greater, in which case the sixteen guaranteed bits in the buffer ;may have run out. ;In the latter case simply give up and stuff the payload bits back onto ;the stream before fetching a literal 16-bit run length instead doy_lcopy_near: dbvs d1,doy_lcopy add.l d0,d0 eor.w d1,d0 ror.l #7+1,d0 ;Note that the constant MSB acts as a move.w (a0)+,d1 ;substitute for the unfetched stop bit bra.s doy_lcopy_near ;******** Offset coding tables ******** DOY_OFFSET macro dc.w (\1)-3 ;Bit count, reduced by three dc.w (1<<(\1))-1 ;Bit mask dc.w -(\2) ;Base offset endm doy_table: DOY_OFFSET 3,1 ;Short A doy_return: rts DOY_OFFSET 4,1 ;Long A dc.w 0 ;(Empty hole) DOY_OFFSET 6,1+8 ;Short B dc.w 0 ;(Empty hole) DOY_OFFSET 7,1+16 ;Long B dc.w 0 ;(Empty hole) DOY_OFFSET 8,1+8+64 ;Short C dc.w 0 ;(Empty hole) DOY_OFFSET 10,1+16+128 ;Long C dc.w 0 ;(Empty hole) DOY_OFFSET 10,1+8+64+256 ;Short D dc.w 0 ;(Empty hole) DOY_OFFSET 13,1+16+128+1024 ;Long D xdef _doynaxdepack_vasm |
06 April 2023, 13:10 | #1454 |
Registered User
Join Date: Dec 2016
Location: Warsaw area
Posts: 152
|
I think you have mixed two GCC extensions in your VSCode. The files you show here (doynax decompressor and gcc.... files in support/ directory) come from example template project for Bartman's / Abyss toolchain. I'm pretty sure they will not work with Bebbo's. Or at least you need some extra effort to port them.
|
06 April 2023, 20:30 | #1455 |
Registered User
Join Date: Jul 2017
Location: San Jose
Posts: 652
|
Are the leading white spaces missing in the file or is it just the EAB forum software that mangled it?
|
10 April 2023, 06:59 | #1456 |
Registered User
Join Date: Apr 2016
Location: Perth, Australia
Posts: 384
|
It was in the file I believe. But anyway I have deleted it and I have managed to get the app compiling.
It was going great fore a few days until I needed to link amiga.lib. I get this error: Code:
/opt/amiga/lib/gcc/m68k-amigaos/6.5.0b/../../../../m68k-amigaos/bin/ld: relocatable linking with relocations from format a.out-amiga (/opt/amiga/m68k-amigaos/lib//libamiga.a(layoutmenus.o)) to format amiga (out/a.exe) is not supported collect2: fatal error: ld returned 1 exit status |
10 April 2023, 11:13 | #1457 | |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 680
|
Quote:
... your provided link options? |
|
10 April 2023, 12:47 | #1458 |
Registered User
Join Date: Apr 2016
Location: Perth, Australia
Posts: 384
|
The current state of my Makefile:
Code:
# to generate assembler listing with LTO, add to LDFLAGS: -Wa,-adhln=$@.listing,--listing-rhs-width=200 # for better annotations add -dA -dP # to generate assembler source with LTO, add to LDFLAGS: -save-temps=cwd ifdef OS WINDOWS = 1 SHELL = cmd.exe endif subdirs := $(wildcard */) $(wildcard src/*/) VPATH = $(subdirs) cpp_sources := $(wildcard *.cpp) $(wildcard $(addsuffix *.cpp,$(subdirs))) cpp_objects := $(addprefix obj/,$(patsubst %.cpp,%.o,$(notdir $(cpp_sources)))) c_sources := $(wildcard *.c) $(wildcard $(addsuffix *.c,$(subdirs))) c_objects := $(addprefix obj/,$(patsubst %.c,%.o,$(notdir $(c_sources)))) s_sources := $(wildcard *.s) $(wildcard $(addsuffix *.s,$(subdirs))) s_objects := $(addprefix obj/,$(patsubst %.s,%.o,$(notdir $(s_sources)))) vasm_sources := $(wildcard *.asm) $(wildcard $(addsuffix *.asm, $(subdirs))) vasm_objects := $(addprefix obj/, $(patsubst %.asm,%.o,$(notdir $(vasm_sources)))) objects := $(cpp_objects) $(c_objects) $(s_objects) $(vasm_objects) # https://stackoverflow.com/questions/4036191/sources-from-subdirectories-in-makefile/4038459 # http://www.microhowto.info/howto/automatically_generate_makefile_dependencies.html program = out/a OUT = $(program) CC = /opt/amiga/bin/m68k-amigaos-gcc VASM = /opt/amiga/bin/vasmm68k_mot ifdef WINDOWS SDKDIR = $(abspath $(dir $(shell where $(CC)))..\m68k-amiga-elf\sys-include) else # SDKDIR = $(abspath $(dir $(shell which $(CC)))../m68k-amiga-elf/sys-include) SDKDIR = /opt/amiga/m68k-amigaos/sys-include NDKDIR = /opt/amiga/m68k-amigaos/ndk-include INCDIR = /opt/amiga/m68k-amigaos/include endif CCFLAGS = -g -MP -MMD -m68000 -Ofast -Wextra -Wno-unused-function -Wno-volatile-register-var -fomit-frame-pointer -fno-tree-loop-distribution -flto -fwhole-program -fno-exceptions -D__NOLIBBASE__ -noixemul -fbaserel -lamiga CPPFLAGS= $(CCFLAGS) -fno-rtti -fcoroutines -fno-use-cxa-atexit ASFLAGS = -Wa,-g,--register-prefix-optional,-I$(SDKDIR),-I$(NDKDIR),-I$(INCDIR),-D LDFLAGS = -Wl,--emit-relocs,-Ttext=0,-Map=$(OUT).map VASMFLAGS = -m68000 -Fhunk -opt-fconst -nowarn=62 -dwarf=3 -quiet -x -I. -I$(INCDIR) -I$(SDKDIR) -I$(NDKDIR) all: $(OUT).exe $(OUT).exe: $(objects) $(info Linking $(program).exe) $(CC) $(CCFLAGS) $(LDFLAGS) $(objects) -o $@ clean: $(info Cleaning...) ifdef WINDOWS @del /q obj\* out\* else @$(RM) obj/* out/* endif -include $(objects:.o=.d) $(cpp_objects) : obj/%.o : %.cpp $(info Compiling $<) $(CC) $(CPPFLAGS) -c -o $@ $(CURDIR)/$< $(c_objects) : obj/%.o : %.c $(info Compiling $<) $(CC) $(CCFLAGS) -c -o $@ $(CURDIR)/$< $(s_objects): obj/%.o : %.s $(info Assembling $<) $(CC) $(CCFLAGS) $(ASFLAGS) -c -o $@ $(CURDIR)/$< $(vasm_objects): obj/%.o : %.asm $(info Assembling $<) $(VASM) $(VASMFLAGS) -o $@ $(CURDIR)/$< |
10 April 2023, 20:11 | #1459 |
bye
Join Date: Jun 2016
Location: Some / Where
Posts: 680
|
|
11 April 2023, 11:36 | #1460 |
Registered User
Join Date: Apr 2016
Location: Perth, Australia
Posts: 384
|
That was left over from the project from the Amiga C vscode extension. What do I need to change about it to fix it for this tool chain?
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
New GCC based dev toolchain for AmigaOS 3.x | cla | Coders. Releases | 8 | 24 December 2017 10:18 |
Issue with photon/xxxx WinUAE Toolchain | arpz | Coders. Asm / Hardware | 2 | 26 September 2015 22:33 |
New 68k gcc toolchain | arti | Coders. C/C++ | 17 | 31 July 2015 03:59 |
Hannibal's WinUAE Demo Toolchain 5 | Bobic | Amiga scene | 1 | 23 July 2015 21:04 |
From gcc to vbcc. | Cowcat | Coders. General | 9 | 06 June 2014 14:45 |
|
|