Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2021-09

Undefined symbol during linking - any suggestions?

9 messages · 4 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Gennady Agranov

Hi,

I have rather large program that fails to link - "Undefined symbol: .Lj3016"

The only difference with previous cases when link was successful is that I added "indylaz" package - not sure if there is a connection...

What can I do or try to diagnose/resolve this issue?

(9022) Compiling resource lib\x86_64-win64\configserver.obj

(9015) Linking .\configserver.exe

Error: Undefined symbol: .Lj3016

Fatal: (10026) There were 1 errors compiling module, stopping

Fatal: (1018) Compilation aborted

Error: c:\lazarus\fpc\3.2.0\bin\x86_64-win64\ppcx64.exe returned an error exitcode

Thanks,

Gennady

Reply by email

Bart
to Gennady Agranov

On Sat, Sep 4, 2021 at 3:26 AM Gennady Agranov via fpc-devel wrote:

IIRC then there were som bugs regarding optimization in win64. You can try to compile with optimizations disabled: -O- (or use the Lazarus dialog to do so).

Bart

Reply by email

Gennady Agranov
to Bart

Thanks!

It did not help - both 3.0.2 and 3.2.2 when compile my code fail at the link phase

Target platform is Win64

Error: Undefined symbol: .Lj<4 digit number>

As I understand .Lj<4 digit number> is a label - not some external identifier

I guess I probably have too much code to link?

Are there some linker arguments I can add that would help?

Is it possible to specify some other linker?

Thanks,
Gennady

Bart wrote 7 lines
On Sat, Sep 4, 2021 at 3:26 AM Gennady Agranov via fpc-devel wrote: IIRC then there were som bugs regarding optimization in win64. You can try to compile with optimizations disabled: -O- (or use the Lazarus dialog to do so).

Reply by email

Gennady Agranov
to Bart: On Sat, Sep 4, 2021 at 3:26 AM Gennady Agranov via fpc-devel IIRC then there were som…

Hi,

linker complains about undefined symbol  .Lj3016

I checked *.s files and found that one file has no label .Lj3016 but has following line:

    leaq       .Lj3016(%rip),%rdx

Am I correct that that this *.s file should also have a label?

Thanks,
Gena

Bart wrote 7 lines
On Sat, Sep 4, 2021 at 3:26 AM Gennady Agranov via fpc-devel wrote: IIRC then there were som bugs regarding optimization in win64. You can try to compile with optimizations disabled: -O- (or use the Lazarus dialog to do so).

Reply by email

Sven Barth
to Gennady Agranov
Gennady Agranov wrote 10 lines
Hi, linker complains about undefined symbol  .Lj3016 I checked *.s files and found that one file has no label .Lj3016 but has following line:     leaq       .Lj3016(%rip),%rdx Am I correct that that this *.s file should also have a label?

Yes. Can you show more of what the surrounding code is doing (you should compile with -al so that the code lines are contained there as well if you haven't done so already) and what optimization options are you using for compilation?

Regards,
Sven

Reply by email

Gennady Agranov
to denisgolovan
denisgolovan wrote
>> Compiler builds release binaries fine.

What do you mean - it should work on "trunk"?

it is probably "generics" related, and i tried both official releases - 3.2.0 and 3.2.2 - the same sad result

I suspect inlining did it as my code does not raise exception - but obviously i can be mistaken

.Lj3219:
    leaq RESSTR_$GENERICS.STRINGS_$$_SDICTIONARYKEYDOESNOTEXIST+8(%rip),%r8     movq    $1,%rdx
    leaq    VMT_$CLASSES_$$_ELISTERROR(%rip),%rcx *   call SYSUTILS$_$EXCEPTION_$__$$_CREATERES$PANSISTRING$$EXCEPTION*     movq    %rax,%rcx
    leaq    .Lj3222(%rip),%rdx

How can one tell compiler to allow "inline" modifier, but ignore it?

Thanks,
Gena

Show quoted text 9 lines
I believe it's the same issue I have in https://gitlab.com/freepascal.org/fpc/source/-/issues/39140 Compiler builds release binaries fine. -- Regards, Denis Golovan _______________________________________________ fpc-devel maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email

denisgolovan
to Gennady Agranov
Show quoted text 8 lines
On 9/8/2021 2:25 PM, denisgolovan via fpc-devel wrote: >>> Compiler builds release binaries fine. What do you mean - it should work on "trunk"?

No. I mean it should work when -g and stuff like that is _omitted_. Thus compiler does not produce debug info.

it is probably "generics" related, and i tried both official releases - 3.2.0 and 3.2.2 - the same sad result

Yeap. My issue is about generics AFAIR.

I suspect inlining did it as my code does not raise exception - but obviously i can be mistaken

No idea really.

-- Regards,
Denis Golovan

Reply by email

Gennady Agranov
to Sven Barth: Yes. Can you show more of what the surrounding code is doing (you should compile with -al…

Hi,

Sorry for delay - my first email was rejected because i have attached "undefined_symbol.s" uncompressed

I am attaching zip archive with 2 files

undefined_symbol.pas
undefined_symbol.s

*(fpc -Mdelphi -al -Cn undefined_symbol.pas)*

There is line

    leaq    .Lj3222(%rip),%rdx

but I do not see  the label definition :(

Thanks,
Gena

Sven Barth wrote 22 lines
Am 08.09.2021 um 06:33 schrieb Gennady Agranov via fpc-devel: > Hi, > > linker complains about undefined symbol  .Lj3016 > > I checked *.s files and found that one file has no label .Lj3016 but > has following line: > >     leaq       .Lj3016(%rip),%rdx > > Am I correct that that this *.s file should also have a label? Yes. Can you show more of what the surrounding code is doing (you should compile with -al so that the code lines are contained there as well if you haven't done so already) and what optimization options are you using for compilation? Regards, Sven _______________________________________________ fpc-devel maillist  - https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply by email