1

Can anyone point my in the right direction? This is proprietary code so I can't upload the makefiles.

But here's the output of nm on libA:

libA.a:someOfile.o:                 U _Z12funcABCPcPA80_cii
libA.a:overhead.o:                 U _Z12funcABCPcPA80_cii

And here is nm of libB, where the function of interest rendering undefined references from two other functions:

libB.a:funcABC.o:0000000000000000 T _Z12funcABCPcPA64_ci

There was a similar project done that matches _Z12FUNCABCPcPA64_ci. Im working porting the code base to support a new platform.

This nm output of the similar project:

libB.a:funcABC.o:0000000000000000 T _Z12funcABCPcPA64_c


libA.a:overhead.o:                 U _Z12funcABCPcPA64_c

Clarification: I only replaced the function name for the sake of posting on SO :)

Original function signature, on both projects:

#define LENGTH 64

bool funcABC( char* arg1, char arg2 [][LENGTH], int arg3)

Solution:

The library in question wasn't ported correctly. That is libB was an older version, that I didn't port. Thus it kept giving linking errors because of the comments below. libB should had the following declaration, and I should have been careful on reading the function definition.

bool funcABC(char*arg1, char arg2 [] [LENGTH_INHEADER], int arg3, int arg4)

In funcABC.cpp, the width of arg2 was based on LENGTH 64. In funcABC.h, the width was intended to be LENGTH_INHEADER 80.

1
  • 2
    It's not the same. One has a 64 and one has 80
    – user20574
    Commented Oct 13, 2022 at 17:08

1 Answer 1

2

I presume you replaced a proprietary name with funcABC. This breaks the mangling ABI. If the original name was 12 characters long, you should have replaced 12 with the new length.

  • _Z7funcABCPcPA80_cii demangles to funcABC(char*, char (*) [80], int, int)
  • _Z7funcABCPcPA64_ci demangles to funcABC(char*, char (*) [64], int)
  • _Z7funcABCPcPA64_c demangles to funcABC(char*, char (*) [64])

These are completely different functions.

2
  • Btw, how were you able to demange the symbols? I'd like to add this to my debugging knowledge base.
    – kroger9
    Commented Oct 13, 2022 at 17:35
  • 2
    @kroger9 There are tools like c++filt, llvm-cxxfilt, and demumble. Commented Oct 13, 2022 at 18:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.