CXX on X86 : corrupt .obj file created without any error messages.


Topic author
joukj
Master
Posts: 185
Joined: Thu Aug 27, 2020 5:50 am
Reputation: 0
Status: Offline

CXX on X86 : corrupt .obj file created without any error messages.

Post by joukj » Thu Sep 14, 2023 10:32 am

Hi I get the following:

Code: Select all

rumba-jj) cxx/vers
clang version 10.0.1 (git@bitbucket.org:vms_software/llvm-10.0.1.git 1944c289616
bb7073af92c05d3ba6e7fd5d7ed0e)
Build date: 09-01-2023
Target: x86_64-OpenVMS
Thread model: posix
InstalledDir: RUMBA$DKA100:[SYS0.SYSCOMMON.][SYSEXE]
rumba-jj) define diplib []
rumba-jj) define eigen [.eigen]
%DCL-I-SUPERSEDE, previous value of EIGEN has been superseded
rumba-jj) cxx/stan=gnu14 matrix.cpp
rumba-jj) lib/crea l.olb matrix  
%LIBRAR-F-INSERTERR, error inserting _ZN5Eigen15PlainObjectBaseINS_6MatrixINSt3_
_17complexIdEELin1ELin1ELi0ELin1ELin1EEEE10resizeLikeINS_14TriangularViewIKNS_5B
lockIKS5_Lin1ELin1ELb0EEELj2EEEEEvRKNS_9EigenBaseIT_EE in $DSTM:[JOUKJ.test.bugs
.cxx.corrupt_ob
-RMS-E-EOF, end of file detected



I attached the files whith which I created this "reproducer". Sorry that it is not "simple"

(removed attachment)
Last edited by joukj on Fri Sep 15, 2023 4:45 am, edited 3 times in total.

User avatar

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

Re: CXX on X86 : corrupt .obj file created without any error messages.

Post by arne_v » Sun Sep 17, 2023 7:16 pm

jreagan wrote:
Sun Sep 17, 2023 6:13 pm
You can use /NAMES=SHORTENED to get the old CRC-suffix behavior
Doesn't work for me:

Code: Select all

$ type zz.cxx
void cxx45678901234567890123456789012345678901234567890123456789012345678901234567890()
{
}

$ cxx zz
$ libr/obj/crea namlen
$ libr/obj/ins namlen zz
$ libr/obj/list/name namlen
Directory of ELF OBJECT library DKA0:[arne]namlen.OLB;2 on 17-SEP-2023 19:15:38
Creation date:  17-SEP-2023 19:15:38      Creator:  Librarian I01-47
Revision date:  17-SEP-2023 19:15:38      Library format:   6.0
Number of modules:      1                 Max. key length:  1024
Other entries:          1                 Preallocated index blocks:    213
Recoverable deleted blocks:        0      Total index blocks used:        2
Max. Number history records:      20      Library history records:        1

Module ZZ
_Z80cxx45678901234567890123456789012345678901234567890123456789012345678901234567890v

$ cxx/name=shorten zz
$ libr/obj/crea namlen
$ libr/obj/ins namlen zz
$ libr/obj/list/name namlen
Directory of ELF OBJECT library DKA0:[arne]namlen.OLB;3 on 17-SEP-2023 19:15:39
Creation date:  17-SEP-2023 19:15:39      Creator:  Librarian I01-47
Revision date:  17-SEP-2023 19:15:39      Library format:   6.0
Number of modules:      1                 Max. key length:  1024
Other entries:          1                 Preallocated index blocks:    213
Recoverable deleted blocks:        0      Total index blocks used:        2
Max. Number history records:      20      Library history records:        1

Module ZZ
_Z80cxx45678901234567890123456789012345678901234567890123456789012345678901234567890v

Arne
arne@vajhoej.dk
VMS user since 1986


Topic author
joukj
Master
Posts: 185
Joined: Thu Aug 27, 2020 5:50 am
Reputation: 0
Status: Offline

Re: CXX on X86 : corrupt .obj file created without any error messages.

Post by joukj » Mon Sep 18, 2023 1:32 am

If I add /name=(as_is,short) to the the CXX-command I get the same error in this example....


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

Re: CXX on X86 : corrupt .obj file created without any error messages.

Post by jreagan » Mon Sep 18, 2023 3:34 am

Sigh. I'll tell the team

Added in 7 hours 17 minutes 18 seconds:
There was a confusion about what the word "external" means in the definition of /NAMES=SHORTENED. Names inside of an

Code: Select all

extern C
statement vs any name visible to the linker. It is currently the extern C names.

So with longer than 1024 mangled names (which are currently not shortened), allocating a larger key length at OLB creation time should fix it. I might even suggest that we change the default of LIBR OLB from 1024 to 2048 or 4096 might be a good thing with all the C++ names it might encounter


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

Re: CXX on X86 : corrupt .obj file created without any error messages.

Post by hb » Mon Sep 18, 2023 1:56 pm

The problem originally reported was/is a bug in LIBRARIAN. It can be reproduced with 10 global symbols of an "appropriate" name length - significantly less than 1024. What that is is left as an exercise for the interested reader :-). Obviously, this wasn't caught when testing the IA64 LIBRARIAN. That's not really a surprise. As far as I know, none of the IA64 compilers created symbols with more than 31 characters. It was tested that single long symbols could be inserted into the global name table. This was done by patching the object files. Obviously this was not a comprehensive test.

The bug will be fixed in a future update.

User avatar

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

Re: CXX on X86 : corrupt .obj file created without any error messages.

Post by arne_v » Mon Sep 18, 2023 3:19 pm

So we will get an updated librarian in some VMS update that fixes the real problem.

John will consider whether /NAME=SHORTEN should behave more VMSish and apply to all external symbols not just extern "C" symbols.

If yes, then it will be in a C++ compiler update at some point in time.

If no, then we may get an updated librarian in some VMS update that allows us to define key size > 1024 to allow such C++ code to be inserted.

Added in 28 seconds:
Have I understood it correct?
Arne
arne@vajhoej.dk
VMS user since 1986


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

Re: CXX on X86 : corrupt .obj file created without any error messages.

Post by hb » Mon Sep 18, 2023 4:21 pm

arne_v wrote:
Mon Sep 18, 2023 3:20 pm
So we will get an updated librarian in some VMS update that fixes the real problem.
Yes.
John will consider whether /NAME=SHORTEN should behave more VMSish and apply to all external symbols not just extern "C" symbols.
That's also my understanding.
If yes, then it will be in a C++ compiler update at some point in time.
Yes.
If no, then we may get an updated librarian in some VMS update that allows us to define key size > 1024 to allow such C++ code to be inserted.
s/If no, then we/We/

FWIW, looking at the string table and selecting all the mangled names, the _ZN*, the longest symbol name I noticed in matrix.obj was 753 characters.


Topic author
joukj
Master
Posts: 185
Joined: Thu Aug 27, 2020 5:50 am
Reputation: 0
Status: Offline

Re: CXX on X86 : corrupt .obj file created without any error messages.

Post by joukj » Mon Oct 23, 2023 4:46 am

After the V9.2-1 Update V2.0 I cannot reproduce this error.
So it is solved.

Post Reply