nidud / asmc

Masm compatible assembler
GNU General Public License v2.0
37 stars 6 forks source link

Compilation error with GCC 11.4 #11

Closed birdie-github closed 5 months ago

birdie-github commented 5 months ago
Assembling: src/tokenize.asm
gcc -Wl,-pie,-z,now,-z,noexecstack -s -o asmc64 *.o
 Assembling: src/typeid.asm
/usr/bin/ld: assemble.o: in function `SetMasm510':
assemble.asm:(.text+0xb5e): undefined reference to `Tokenize'
/usr/bin/ld: data.o:(.text+0x1c8): undefined reference to `Tokenize'
/usr/bin/ld: data.o:(.text+0x1e6): undefined reference to `Tokenize'
/usr/bin/ld: data.o:(.text+0x365): undefined reference to `Tokenize'
/usr/bin/ld: data.o:(.text+0x407): undefined reference to `Tokenize'
/usr/bin/ld: data.o:(.text+0x5bf): more undefined references to `Tokenize' follow
/usr/bin/ld: macro.o: in function `StoreMacro':
macro.asm:(.text+0x6b5): undefined reference to `GetToken'
/usr/bin/ld: macro.asm:(.text+0x708): undefined reference to `GetToken'
/usr/bin/ld: macro.asm:(.text+0x7c1): undefined reference to `GetToken'
/usr/bin/ld: macro.asm:(.text+0x9b2): undefined reference to `GetToken'
/usr/bin/ld: mem2mem.o: in function `mem2mem':
mem2mem.asm:(.text+0x703): undefined reference to `Tokenize'
/usr/bin/ld: mem2mem.asm:(.text+0x787): undefined reference to `Tokenize'
/usr/bin/ld: new.o:(.text+0x3f6): undefined reference to `Tokenize'
/usr/bin/ld: parser.o: in function `ParseLine':
parser.asm:(.text+0x346b): undefined reference to `Tokenize'
/usr/bin/ld: parser.asm:(.text+0x34cd): undefined reference to `Tokenize'
/usr/bin/ld: parser.o:parser.asm:(.text+0x4026): more undefined references to `Tokenize' follow
collect2: error: ld returned 1 exit status
make: *** [makefile:58: asmc64] Error 1
 Assembling: src/types.asm
 Assembling: src/undef.asm
gcc -Wl,-pie,-z,now,-z,noexecstack -s -o asmc *.o

Using GCC 11.4.1. It builds with 13.1 though.

nidud commented 5 months ago

Test case (Ubuntu):

$ gcc --version
gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0
$ ldd --version
ldd (Ubuntu GLIBC 2.35-0ubuntu3.7) 2.35
$ git clone https://github.com/nidud/asmc.git
$ cd asmc/source/asmc
$ make
chmod a+x ../../bin/asmc64
../../bin/asmc64 -fpic -Zp8 -Cs -Iinc -I../../include ../libc/fltintrn/*.asm src/*.asm
Asmc Macro Assembler (x64) Version 2.34.49
Copyright (C) The Asmc Contributors. All Rights Reserved.

 Assembling: ../libc/fltintrn/__addo.asm
 ...
gcc -Wl,-pie,-z,now,-z,noexecstack -s -o asmc *.o
../../bin/asmc64 -DASMC64 -fpic -Zp8 -Cs -Iinc -I../../include ../libc/fltintrn/*.asm src/*.asm
Asmc Macro Assembler (x64) Version 2.34.49
Copyright (C) The Asmc Contributors. All Rights Reserved.

 Assembling: ../libc/fltintrn/__addo.asm
 ...
gcc -Wl,-pie,-z,now,-z,noexecstack -s -o asmc64 *.o
rm *.o
nidud commented 5 months ago

Did a test in Manjaro:

$ gcc --version
gcc (GCC) 13.2.1 2023080
$ ldd --version
ldd (GNU libc) 2.39
$ git clone https://github.com/nidud/asmc.git
$ cd asmc/source/asmc
$ make
...

So it seems to work, at least using the default settings.

birdie-github commented 5 months ago

Maybe RHEL 9.3 has some weirdness, dunno.

nidud commented 5 months ago

Maybe RHEL 9.3 has some weirdness, dunno.

There's a mixed bag of Linux distributions with a variety of dependencies. Some are also exclusively 64-bit so it's difficult to provide binaries that works for all.

In most cases the default setting using a dynamically linked 64-bit binary works. However, there is a statically linked 32-bit binary provided for incompatibility issues like this, so you may try to see if that works.

To test this change the line in the makefile acc = asmc64 to acc = asmc