Terraspace / UASM

UASM - Macro Assembler
http://www.terraspace.co.uk/uasm.html
Other
221 stars 49 forks source link

UASM 2.57r build problem #208

Closed teoberi closed 1 month ago

teoberi commented 3 months ago

gcc --version

gcc (GCC) 14.2.0 Copyright (C) 2024 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

make -f Makefile-Linux-GCC-64.mak

mkdir GccUnixR gcc -D UNIX -c -IH -D UNIX -DNDEBUG -O2 -funsigned-char -Wwrite-strings -o GccUnixR/main.o main.c main.c: In function ‘main’: main.c:95:17: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 95 | argv[0] = pEnv; | ^ gcc -D UNIX -c -IH -D UNIX -DNDEBUG -O2 -funsigned-char -Wwrite-strings -o GccUnixR/apiemu.o apiemu.c gcc -D UNIX -c -IH -D UNIX -DNDEBUG -O2 -funsigned-char -Wwrite-strings -o GccUnixR/orgfixup.o orgfixup.c gcc -D UNIX -c -IH -D UNIX -DNDEBUG -O2 -funsigned-char -Wwrite-strings -o GccUnixR/assemble.o assemble.c assemble.c: In function ‘PassOneChecks’: assemble.c:1042:32: warning: comparison between pointer and integer 1042 | if ( curr->sym.altname > 1 ) | ^ assemble.c: In function ‘OnePass’: assemble.c:1181:17: error: implicit declaration of function ‘AddSimdTypes’ [-Wimplicit-function-declaration] 1181 | AddSimdTypes(); | ^~~~ In file included from assemble.c:18: assemble.c: In function ‘get_module_name’: H/globals.h:51:17: error: implicit declaration of function ‘strupr’; did you mean ‘_strupr’? [-Wimplicit-function-declaration] 51 | #define _strupr strupr | ^~ assemble.c:1280:5: note: in expansion of macro ‘_strupr’ 1280 | _strupr( ModuleInfo.name ); | ^~~ assemble.c: In function ‘GetExt’: assemble.c:1430:23: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 1430 | return( EXE_EXT ); | ^ assemble.c:1433:23: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 1433 | return( BIN_EXT ); | ^ assemble.c:1435:15: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 1435 | return( OBJ_EXT ); | ^ assemble.c:1437:15: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 1437 | return( LST_EXT ); | ^ assemble.c:1439:15: warning: return discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] 1439 | return( ERR_EXT ); | ^ make: *** [Makefile-Linux-GCC-64.mak:35: GccUnixR/assemble.o] Error 1

john-terraspace commented 3 months ago

Will take a look, I'm on gcc 13.2.0 and it's fine.

teoberi commented 3 months ago

Thank you! It is a problem for Linux distributions that want to compile UASM from sources. Until the problem is solved, I will use the binary that for the first time works perfectly with 7-Zip.

john-terraspace commented 3 months ago

Bane of my life ... I had to setup a complete new Linux machine to do the 2.57 build, Ubuntu 24 lts + installed GCC, which brought down 13.x by default - that seems to be fine. GCC 14 however has made more changes. I've already committed a patch to 2.57 branch that fixes the above error for AddSimdTypes - but now it's moaning about strupr.

grawlinson commented 1 month ago

There seems to be an implementation of strupr here: https://github.com/Terraspace/UASM/blob/540d2159360fac5d3c2ac5efbeb15e0fcf869756/assemble.c#L131-L145

However, changing #if 0 to #if 1 results in more compile errors.

compile output ``` make -f Makefile-Linux-GCC-64.mak gcc -D __UNIX__ -c -IH -D __UNIX__ -DNDEBUG -O2 -funsigned-char -Wwrite-strings -o GccUnixR/codegenv2.o codegenv2.c codegenv2.c: In function ‘hash’: codegenv2.c:38:29: warning: integer constant is so large that it is unsigned 38 | uint_64 fnv_basis = 14695981039346656037; | ^~~~~~~~~~~~~~~~~~~~ codegenv2.c: In function ‘GenerateInstrHash’: codegenv2.c:92:21: error: passing argument 1 of ‘hash’ from incompatible pointer type [-Wincompatible-pointer-types] 92 | return hash(&hashBuffer, len); | ^~~~~~~~~~~ | | | uint_8 (*)[32] {aka unsigned char (*)[32]} codegenv2.c:35:40: note: expected ‘const uint_8 *’ {aka ‘const unsigned char *’} but argument is of type ‘uint_8 (*)[32]’ {aka ‘unsigned char (*)[32]’} 35 | static unsigned int hash(const uint_8* data, int size) | ~~~~~~~~~~~~~~^~~~ codegenv2.c: In function ‘CodeGenV2’: codegenv2.c:1668:42: error: implicit declaration of function ‘get_curr_srcfile’ [-Wimplicit-function-declaration] 1668 | AddLinnumDataRef(get_curr_srcfile(), GetLineNumber()); | ^~~~~~~~~~~~~~~~ codegenv2.c:1668:62: error: implicit declaration of function ‘GetLineNumber’ [-Wimplicit-function-declaration] 1668 | AddLinnumDataRef(get_curr_srcfile(), GetLineNumber()); | ^~~~~~~~~~~~~ codegenv2.c:1705:44: error: passing argument 7 of ‘BuildMemoryEncoding’ from incompatible pointer type [-Wincompatible-pointer-types] 1705 | &dispSize, &displacement, matchedInstr, opExpr, &needB, &needX, &needRR, CodeInfo); | ^~~~~~~~~~~~~ | | | union * codegenv2.c:1225:42: note: expected ‘uint_64 *’ {aka ‘long unsigned int *’} but argument is of type ‘union *’ 1225 | unsigned int* dispSize, uint_64* pDisp, struct Instr_Def* instr, struct expr opExpr[4], bool* needB, | ~~~~~~~~~^~~~~ codegenv2.c:1713:54: error: passing argument 3 of ‘BuildVEX’ from incompatible pointer type [-Wincompatible-pointer-types] 1713 | BuildVEX(&needVEX, &vexSize, &vexBytes, matchedInstr, opExpr, needB, needX, opCount); /* Create the VEX prefix bytes for both reg and memory operands */ | ^~~~~~~~~ | | | unsigned char (*)[3] codegenv2.c:714:69: note: expected ‘unsigned char *’ but argument is of type ‘unsigned char (*)[3]’ 714 | void BuildVEX(bool* needVex, unsigned char* vexSize, unsigned char* vexBytes, struct Instr_Def* instr, struct expr opnd[4], bool needB, bool needX, uint_32 opCount) | ~~~~~~~~~~~~~~~^~~~~~~~ make: *** [Makefile-Linux-GCC-64.mak:35: GccUnixR/codegenv2.o] Error 1 ```

And solving these results in more compile errors. I gave up at this point because I don't know if my fixes were valid.

grawlinson commented 1 month ago

Just noticed that #186 & #216 solve some of these issues. Might be worth pulling them in.

teoberi commented 1 month ago

Fixed by @darealshinji here.