X86 Macro compiler/LLVM error

OpenVMS x86 native compilers, cross compilers news and questions.
User avatar

Topic author
cct
Master
Posts: 135
Joined: Sat Aug 15, 2020 9:00 am
Reputation: 0
Location: Cambridge, UK
Status: Offline

X86 Macro compiler/LLVM error

Post by cct » Mon Apr 01, 2024 2:20 pm

Trying to compile some macro code that was ported from VAX to Alpha, and worked on I64, and 3 files are coming up with:

LLVM ERROR: invalid symbol redefinition

Not that I know diddly about macro, but what does this mean?
I have been looking at the latest Vax Macro reference manual and it doesn't reference LLVM at all. Are there any suitable references available?

Also is there any rule fo thumb for what command line to compile old macro on X86?
Last edited by cct on Mon Apr 01, 2024 3:34 pm, edited 2 times in total.
--
Chris


hb
Valued Contributor
Posts: 81
Joined: Mon May 01, 2023 12:11 pm
Reputation: 0
Status: Offline

Re: X86 Macro compiler/LLVM error

Post by hb » Mon Apr 01, 2024 3:54 pm

cct wrote:
Mon Apr 01, 2024 2:20 pm
Trying to compile some macro code that was ported from VAX to Alpha, and worked on I64, and 3 files are coming up with:

LLVM ERROR: invalid symbol redefinition
Do you have a PSECT and a symbol with the same name? Something like:

Code: Select all

$ ty symsect.mar
        .psect code, exe, nowrt
code:   .call_entry
        ret
        .end code
$ macro symsect
LLVM ERROR: invalid symbol redefinition
$
LLVM is a set of compiler and tools that is used to implement the VMS compilers.

Here, LLVM would create an ELF section with the name CODE and a symbol with the same name. And that's invalid in LLVM.

Out of the top of my head I don't know of any specific rule for compiling MACR32 sources. The only thing which comes to mind: explicitly use PSECTs and set EXE and NOWRT for code and NOEXE for data.

User avatar

Topic author
cct
Master
Posts: 135
Joined: Sat Aug 15, 2020 9:00 am
Reputation: 0
Location: Cambridge, UK
Status: Offline

Re: X86 Macro compiler/LLVM error

Post by cct » Mon Apr 01, 2024 6:26 pm

Looks like I do:

Code: Select all

 $ ty BIG_CHARS.MAR
        .TITLE  BIG_CHARS
        .IDENT  /MAC.01/

        .PSECT  $CODE,NOWRT,PIC,SHR,LONG
        .ENTRY  BIG_CHARS,0
        CLRL    R0              ; DUMMY, IN CASE SOMEONE REALLY CALLS US
        RET

        .PSECT  BIG_CHARS,LONG,NOPIC,OVR,REL,GBL,NOSHR,NOEXE,WRT,NOVEC

CHR_0:  .ASCII \     @@@@@  \
        .ASCII \    @@@@@@@ \
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \    @@@@@@@ \
        .ASCII \     @@@@@  \

CHR_1:  .ASCII \      @@@   \
        .ASCII \     @@@@   \
        .ASCII \       @@   \
        .ASCII \       @@   \
        .ASCII \       @@   \
        .ASCII \       @@   \
        .ASCII \     @@@@@@ \
        .ASCII \     @@@@@@ \

CHR_2:  .ASCII \     @@@@@  \
        .ASCII \    @@@@@@@ \
        .ASCII \   @@     @@\
        .ASCII \        @@@ \
        .ASCII \     @@@@   \
        .ASCII \    @@      \
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\

CHR_3:  .ASCII \     @@@@@  \
        .ASCII \    @@@@@@@ \
        .ASCII \   @@     @@\
        .ASCII \        @@@ \
        .ASCII \        @@@ \
        .ASCII \   @@     @@\
        .ASCII \    @@@@@@@ \
        .ASCII \     @@@@@  \

CHR_4:  .ASCII \   @@   @@  \
        .ASCII \   @@   @@  \
        .ASCII \   @@   @@  \
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\
        .ASCII \        @@  \
        .ASCII \        @@  \
        .ASCII \        @@  \

CHR_5:  .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@       \
        .ASCII \   @@@@@@@@ \
        .ASCII \          @@\
        .ASCII \   @@     @@\
        .ASCII \    @@@@@@@ \
        .ASCII \     @@@@@  \

CHR_6:  .ASCII \    @@@@@@@ \
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@       \
        .ASCII \   @@@@@@@@ \
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@     @@\
        .ASCII \   @@@@@@@@@\
        .ASCII \    @@@@@@@ \

CHR_7:  .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\
        .ASCII \        @@@ \
        .ASCII \       @@@  \
        .ASCII \      @@@   \
        .ASCII \     @@@    \
        .ASCII \    @@@     \
        .ASCII \   @@@      \

CHR_8:  .ASCII \     @@@@@  \
        .ASCII \    @@@@@@@ \
        .ASCII \    @@   @@ \
        .ASCII \     @@@@@  \
        .ASCII \    @@   @@ \
        .ASCII \   @@@   @@@\
        .ASCII \    @@@@@@@ \
        .ASCII \     @@@@@  \

CHR_9:  .ASCII \     @@@@@  \
        .ASCII \    @@@@@@@ \
        .ASCII \   @@     @@\
        .ASCII \   @@@@@@@@@\
        .ASCII \    @@@@@@@@\
        .ASCII \          @@\
        .ASCII \         @@ \
        .ASCII \       @@@  \

CHR_A:  .ASCII \     @@@@@  \
        .ASCII \    @@@@@@@ \
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\

CHR_B:  .ASCII \   @@@@@@   \
        .ASCII \   @@@@@@@@ \
        .ASCII \   @@     @@\
        .ASCII \   @@@@@@@@ \
        .ASCII \   @@    @@ \
        .ASCII \   @@     @@\
        .ASCII \   @@@@@@@@ \
        .ASCII \   @@@@@@@  \

CHR_C:  .ASCII \     @@@@@@ \
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@       \
        .ASCII \   @@       \
        .ASCII \   @@       \
        .ASCII \   @@       \
        .ASCII \   @@@@@@@@@\
        .ASCII \     @@@@@@ \

CHR_D:  .ASCII \   @@@@@@   \
        .ASCII \   @@@@@@@@ \
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@@@@@@@ \
        .ASCII \   @@@@@@@  \

CHR_E:  .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@       \
        .ASCII \   @@@@@@   \
        .ASCII \   @@@@@@   \
        .ASCII \   @@       \
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\

CHR_F:  .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@       \
        .ASCII \   @@@@@@   \
        .ASCII \   @@@@@@   \
        .ASCII \   @@       \
        .ASCII \   @@       \
        .ASCII \   @@       \

CHR_G:  .ASCII \     @@@@@@ \
        .ASCII \    @@@@@@@@\
        .ASCII \   @@       \
        .ASCII \   @@       \
        .ASCII \   @@    @@@\
        .ASCII \   @@     @@\
        .ASCII \    @@@@@@@@\
        .ASCII \     @@@@@@ \

CHR_H:  .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\

CHR_I:  .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\
        .ASCII \      @@@   \
        .ASCII \      @@@   \
        .ASCII \      @@@   \
        .ASCII \      @@@   \
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\

CHR_J:  .ASCII \        @@@@\
        .ASCII \        @@@@\
        .ASCII \         @@ \
        .ASCII \         @@ \
        .ASCII \         @@ \
        .ASCII \   @@    @@ \
        .ASCII \   @@@@@@@@ \
        .ASCII \    @@@@@@  \

CHR_K:  .ASCII \   @@     @@\
        .ASCII \   @@    @@ \
        .ASCII \   @@   @@  \
        .ASCII \   @@@@@@   \
        .ASCII \   @@@@@@   \
        .ASCII \   @@   @@  \
        .ASCII \   @@    @@ \
        .ASCII \   @@     @@\

CHR_L:  .ASCII \   @@       \
        .ASCII \   @@       \
        .ASCII \   @@       \
        .ASCII \   @@       \
        .ASCII \   @@       \
        .ASCII \   @@       \
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\

CHR_M:  .ASCII \   @@     @@\
        .ASCII \   @@@   @@@\
        .ASCII \   @@ @@@ @@\
        .ASCII \   @@ @@@ @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\

CHR_N:  .ASCII \   @@     @@\
        .ASCII \   @@@    @@\
        .ASCII \   @@@@   @@\
        .ASCII \   @@ @@  @@\
        .ASCII \   @@  @@ @@\
        .ASCII \   @@   @@@@\
        .ASCII \   @@    @@@\
        .ASCII \   @@     @@\

CHR_O:  .ASCII \     @@@@@  \
        .ASCII \    @@@@@@@ \
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \    @@@@@@@ \
        .ASCII \     @@@@@  \

CHR_P:  .ASCII \   @@@@@@@  \
        .ASCII \   @@@@@@@@ \
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@@@@@@@ \
        .ASCII \   @@       \
        .ASCII \   @@       \
        .ASCII \   @@       \

CHR_Q:  .ASCII \     @@@@@  \
        .ASCII \    @@@@@@@ \
        .ASCII \   @@     @@\
        .ASCII \   @@ @@  @@\
        .ASCII \   @@  @@ @@\
        .ASCII \   @@   @@@@\
        .ASCII \    @@@@@@@ \
        .ASCII \     @@@@@ @\

CHR_R:  .ASCII \   @@@@@@@@ \
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@@@@@@@ \
        .ASCII \   @@   @@  \
        .ASCII \   @@    @@ \
        .ASCII \   @@     @@\

CHR_S:  .ASCII \     @@@@@  \
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@       \
        .ASCII \    @@@@@@  \
        .ASCII \     @@@@@@ \
        .ASCII \          @@\
        .ASCII \   @@@@@@@@@\
        .ASCII \     @@@@@  \

CHR_T:  .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\
        .ASCII \      @@@   \
        .ASCII \      @@@   \
        .ASCII \      @@@   \
        .ASCII \      @@@   \
        .ASCII \      @@@   \
        .ASCII \      @@@   \

CHR_U:  .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\

CHR_V:  .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \    @@   @@ \
        .ASCII \     @@ @@  \
        .ASCII \      @@@   \

CHR_W:  .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \   @@  @  @@\
        .ASCII \   @@ @@@ @@\
        .ASCII \   @@@@ @@@@\
        .ASCII \    @@   @@ \

CHR_X:  .ASCII \   @@     @@\
        .ASCII \    @@   @@ \
        .ASCII \     @@ @@  \
        .ASCII \      @@@   \
        .ASCII \      @@@   \
        .ASCII \     @@ @@  \
        .ASCII \    @@   @@ \
        .ASCII \   @@     @@\

CHR_Y:  .ASCII \   @@     @@\
        .ASCII \   @@     @@\
        .ASCII \    @@   @@ \
        .ASCII \     @@ @@  \
        .ASCII \      @@@   \
        .ASCII \      @@@   \
        .ASCII \      @@@   \
        .ASCII \      @@@   \

CHR_Z:  .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\
        .ASCII \        @@@ \
        .ASCII \       @@@  \
        .ASCII \     @@@    \
        .ASCII \    @@@     \
        .ASCII \   @@@@@@@@@\
        .ASCII \   @@@@@@@@@\

CHR_ :  .ASCII \            \
        .ASCII \            \
        .ASCII \            \
        .ASCII \            \
        .ASCII \            \
        .ASCII \            \
        .ASCII \            \
        .ASCII \            \

        .END
Not sure what do do... AS I said I knoe dilly about macro (;
--
Chris


hb
Valued Contributor
Posts: 81
Joined: Mon May 01, 2023 12:11 pm
Reputation: 0
Status: Offline

Re: X86 Macro compiler/LLVM error

Post by hb » Mon Apr 01, 2024 6:56 pm

Change either the BIG_CHARS in the .ENTRY or in the .PSECT.

I would change the PSECT name, to something like THE_BIG_CHARS. I would check if there are other PSECTs named BIG_CHARS and rename them also to THE_BIG_CHARS - the shown PSECT has OVR attribute.


jreagan
VSI Expert
Master
Posts: 146
Joined: Tue Dec 01, 2020 8:40 am
Reputation: 0
Status: Offline

Re: X86 Macro compiler/LLVM error

Post by jreagan » Tue Apr 02, 2024 7:55 am

We will be fixing XMACRO in the future to workaround the LLVM restriction. [This is one of my hot buttons. Don't get me started on their stupid restriction.]

User avatar

Topic author
cct
Master
Posts: 135
Joined: Sat Aug 15, 2020 9:00 am
Reputation: 0
Location: Cambridge, UK
Status: Offline

Re: X86 Macro compiler/LLVM error

Post by cct » Tue Apr 02, 2024 8:03 am

jreagan wrote:
Tue Apr 02, 2024 7:55 am
We will be fixing XMACRO in the future to workaround the LLVM restriction. [This is one of my hot buttons. Don't get me started on their stupid restriction.]
Thanks
--
Chris

User avatar

arne_v
Master
Posts: 377
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Online
Contact:

Re: X86 Macro compiler/LLVM error

Post by arne_v » Tue Apr 02, 2024 7:13 pm

I would fix it anyway if it was me.

Same name in different namespaces are confusing. Better to avoid.
Arne
arne@vajhoej.dk
VMS user since 1986

User avatar

Topic author
cct
Master
Posts: 135
Joined: Sat Aug 15, 2020 9:00 am
Reputation: 0
Location: Cambridge, UK
Status: Offline

Re: X86 Macro compiler/LLVM error

Post by cct » Tue Apr 02, 2024 8:13 pm

I intend to, but I neeed to see how it is used. I imagine it is only referencing the psect, so I just change the .entry as you see
--
Chris

User avatar

arne_v
Master
Posts: 377
Joined: Fri Apr 17, 2020 7:31 pm
Reputation: 0
Location: Rhode Island, USA
Status: Online
Contact:

Re: X86 Macro compiler/LLVM error

Post by arne_v » Tue Apr 02, 2024 8:48 pm

Some languages are pretty forgiving in this regard.

The following is valid C#:

Code: Select all

using System;

namespace dynamic
{
	public class X 
	{
		public static dynamic dynamic = 123;
	}
}

namespace NS
{
	public class Program
	{
		public static void Main(string[] args)
		{
			Console.WriteLine(dynamic.X.dynamic);
			Console.ReadKey();
		}
	}
}
Namespace names, context dependent keywords and member names does not conflict. But it is definitely WTF code.
Arne
arne@vajhoej.dk
VMS user since 1986


hb
Valued Contributor
Posts: 81
Joined: Mon May 01, 2023 12:11 pm
Reputation: 0
Status: Offline

Re: X86 Macro compiler/LLVM error

Post by hb » Wed Apr 03, 2024 4:46 am

cct wrote:
Tue Apr 02, 2024 8:13 pm
I intend to, but I neeed to see how it is used. I imagine it is only referencing the psect, so I just change the .entry as you see
This may affect linking the application. The entry generates a symbol, which can be referenced (but may not be actually used) in another source module. The linker sees the reference and tries to resolve it. If the MACRO32 object module is in an object library, it usually will automatically be included by the linker. If that's the case and if you change the entry name, you need to manually include the object module. If you change the PSECT name (or names), it has no effect on linking the application.

Post Reply