Assembler Error on last PB 6.01 beta 2

Just starting out? Need help? Post your questions and find answers here.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Assembler Error on last PB 6.01 beta 2

Post by Caronte3D »

Image

Code: Select all

!macro ppublic name{
        !if name eq _SYS_StaticStringEnd
                !repeat $-_SYS_StaticStringStart
                        !load zczc from _SYS_StaticStringStart+%-1
                        !store zczc xor 137 at _SYS_StaticStringStart+%-1
                !end repeat
        !end if
        !public name}
!public fix ppublic
CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
  !mov edi,_SYS_StaticStringStart
  !mov ecx,_SYS_StaticStringEnd-_SYS_StaticStringStart
  !@@:
        !xor byte[edi],137
        !inc edi
        !dec ecx
CompilerElse
  !mov rdi,_SYS_StaticStringStart
  !mov rcx,_SYS_StaticStringEnd-_SYS_StaticStringStart
  !@@:
        !xor byte[rdi],137
        !inc rdi
        !dec rcx
CompilerEndIf
!jnz @b
juergenkulow
Enthusiast
Enthusiast
Posts: 544
Joined: Wed Sep 25, 2019 10:18 am

Re: Assembler Error on last PB 6.01 beta 2

Post by juergenkulow »

I get a different error message:

Code: Select all

PureBasic 6.01 LTS beta 2 (Linux - x64)
Loading external modules...
Starting compilation...
Starting compilation...
25 lines processed.
Creating the executable.
Error: Assembler
purebasic.asm [60]:
mov rdi,_SYS_StaticStringStart
error: undefined symbol '_SYS_StaticStringStart'.

Code: Select all

; 
; PureBasic 6.01 LTS beta 2 (Linux - x64) - generated code
; 
; (c) 2022 Fantaisie Software
; 
; The header must remain intact for Re-Assembly
; 
; :System
; :Import
; 
format ELF64
; 
; 
extrn memset
public PB_MemoryBase
public PB_ArgC
public PB_ArgV

macro pb_public symbol
{
  public  symbol
_#symbol:
symbol:
}

; 
extrn SYS_InitPureBasic


section '.text' executable align 4096

public main
main:

  MOV    [PB_InitialStackValue],rsp
  SUB    rsp,40
  MOV    [PB_ArgC],edi
  MOV    [PB_ArgV],rsi
  CALL   SYS_InitPureBasic
; !macro ppublic name{
macro ppublic name{
; !if name eq _SYS_StaticStringEnd
if name eq _SYS_StaticStringEnd
; !repeat $-_SYS_StaticStringStart
repeat $-_SYS_StaticStringStart
; !load zczc from _SYS_StaticStringStart+%-1
load zczc from _SYS_StaticStringStart+%-1
; !store zczc xor 137 at _SYS_StaticStringStart+%-1
store zczc xor 137 at _SYS_StaticStringStart+%-1
; !end repeat
end repeat
; !end if
end if
; !public name}
public name}
; !public fix ppublic
public fix ppublic
; CompilerIf #PB_Compiler_Processor = #PB_Processor_x86
; !mov rdi,_SYS_StaticStringStart
mov rdi,_SYS_StaticStringStart
; !mov rcx,_SYS_StaticStringEnd-_SYS_StaticStringStart
mov rcx,_SYS_StaticStringEnd-_SYS_StaticStringStart
; !@@:
@@:
; !xor byte[rdi],137
xor byte[rdi],137
; !inc rdi
inc rdi
; !dec rcx
dec rcx
; CompilerEndIf
; !jnz @b
jnz @b
_PB_EOP:
_PB_EOP_NoValue:
  CALL   PB_EndFunctions
  MOV    rsp,[PB_InitialStackValue]
  MOV    rax,[PB_ExitCode]
  RET
PB_EndFunctions:
  SUB    rsp,40
  ADD    rsp,40
  RET

section '.data' writeable
pb_public PB_DEBUGGER_LineNumber
  dd     -1
pb_public PB_DEBUGGER_IncludedFiles
  dd     0
pb_public PB_DEBUGGER_FileName
  db     0
pb_public PB_Compiler_Unicode
  dd     1
pb_public PB_Compiler_Thread
  dd     0
pb_public PB_Compiler_Purifier
  dd     0
pb_public PB_Compiler_Debugger
  dd     0
align 8
align 8
align 8
s_s:
  dq     0
  dq     -1
align 8
align 8
PStubmemset:
  dq     memset

_PB_BSSSection:
align 8

I_BSSStart:
PB_MemoryBase:  rq 1
PB_ArgC:  rd 1
PB_ArgV:  rq 1
PB_ExitCode:  rq 1
PB_InitialStackValue:  rq 1
align 8
PB_DataPointer rq 1
align 8
align 8
align 8
align 8
I_BSSEnd:
section '.data' writeable
SYS_EndDataSection:
Also 6.00 LTS:

Code: Select all

PureBasic 6.00 LTS (Linux - x64)
Loading external modules...
Starting compilation...
Starting compilation...
25 lines processed.
Creating the executable.
Error: Assembler
purebasic.asm [60]:
mov rdi,_SYS_StaticStringStart
error: undefined symbol '_SYS_StaticStringStart'.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Assembler Error on last PB 6.01 beta 2

Post by Caronte3D »

This a bug or is the normal behaviour from now?
juergenkulow
Enthusiast
Enthusiast
Posts: 544
Joined: Wed Sep 25, 2019 10:18 am

Re: Assembler Error on last PB 6.01 beta 2

Post by juergenkulow »

Caronte3D wrote: Fri Feb 03, 2023 5:11 pm This a bug or is the normal behaviour from now?
The variable, register, bit width and direction of your error message, does not match the error message from your source code.
"MOV dword [_PB_StringBasePosition],eax" is not equal to "mov rdi,_SYS_StaticStringStart".
A code that contains the error "
Error: Assembler
purebasic.asm [line]:
MOV dword [_PB_StringBasePosition],eax
error: undefined symbol '_PB_StringBasePosition'."
would be helpful.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Assembler Error on last PB 6.01 beta 2

Post by Caronte3D »

I have used this snippet of code on several projects without any problem until this last beta.
juergenkulow
Enthusiast
Enthusiast
Posts: 544
Joined: Wed Sep 25, 2019 10:18 am

Re: Assembler Error on last PB 6.01 beta 2

Post by juergenkulow »

However, it is a different snippet of code that triggers the error message. Please look at purebasic.asm Line 23389 generated with command line pbcompiler /commented .
Edit pbcompiler /commented
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Assembler Error on last PB 6.01 beta 2

Post by Caronte3D »

I know what you mean, but if before it was ok, now would be too (IMHO).
For me, it's a bug.
Fred
Administrator
Administrator
Posts: 16617
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Assembler Error on last PB 6.01 beta 2

Post by Fred »

_SYS_StaticStringStart is only generated if you need strings, just put 'a$ = "test"' at the top of your code, and it will work.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Assembler Error on last PB 6.01 beta 2

Post by Caronte3D »

Fred wrote: Sat Feb 04, 2023 12:36 pm _SYS_StaticStringStart is only generated if you need strings, just put 'a$ = "test"' at the top of your code, and it will work.
I still get the same error :?
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Assembler Error on last PB 6.01 beta 2

Post by Caronte3D »

Wait a moment :shock:
Now I get the same error even with these lines commented :shock: :shock: :shock: :shock:
What sorcery is that? :lol:
Any ideas?
Image
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Assembler Error on last PB 6.01 beta 2

Post by mk-soft »

You can also copy the MessageBox to the clipboard with Ctrl-C and do not always need to create a ScreenShot.

P.S. With me there are no errors with your code!
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
Fred
Administrator
Administrator
Posts: 16617
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: Assembler Error on last PB 6.01 beta 2

Post by Fred »

I don't think it's a bug, you just throwing some random asm to the compiler and expect it will link all this properly ? You're also toying with PB internal here which are subject to change at anytime (all SYS_xxx functions are private). If you post an actual code which does something, I could take a closer look if it doesn't link as expected.
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Assembler Error on last PB 6.01 beta 2

Post by Caronte3D »

Sorry Fred, I'm not throwing some random asm to the compiler, It's a code snippet I used many times, but I don't have experience with ASM, the code is from: viewtopic.php?p=468652&hilit=%21Macro+p ... 7B#p468652

Tha fact is I don't know why after removed thesse lines, the error persist, the only way to get the source compiled, is to use the C backend (without the asm code). It's very strange :?

Sure is something I can't see.

I will pack the source that throw the error, and PM you :wink:
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Assembler Error on last PB 6.01 beta 2

Post by Caronte3D »

I want to say, the: 'a$ = "test"' tick works on other of my sources, but not in one that throws the error (even if I remove the ASM lines). I'm confused :? It's like if something where in cache or something like that.

Forgot to indcate I'm using the x86 version of PB
User avatar
Caronte3D
Addict
Addict
Posts: 1027
Joined: Fri Jan 22, 2016 5:33 pm
Location: Some Universe

Re: Assembler Error on last PB 6.01 beta 2

Post by Caronte3D »

More info:
If I uncheck the thread-safe executable, the sorce compiles ok 🤷‍♂️
Post Reply