Hi,

Compiling the following simple program (from fpc prog manual http://www.freepascal.org/docs-html/prog/progsu46.html#x53-520001.2.46) yields a linking syntax error:

program Project1;
{$Linklib c}
Const P : PChar = 'This is fun !';
Function strlen (P: PChar): Longint; cdecl; external;
begin
  WriteLn ('Length of (',p,') : ',strlen(p))
end.

> ppc386 program1.pp
Free Pascal Compiler version 3.1.1 [2015/06/06] for i386
Copyright (c) 1993-2015 by Florian Klaempfl and others
Target OS: Linux for i386
Compiling program1.pp
Linking program1
/usr/bin/ld:link.res: file format not recognized; treating as linker script
/usr/bin/ld:link.res:121: syntax error
program1.pp(8,1) Error: Error while linking
program1.pp(8,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted

Using 'ppc386 -s program1.pp' instead, line 121 of link.res is '-l c' in the section:
INPUT(
-l c
)

and the linker invocation line in ppas.sh is:
/usr/bin/ld -b elf32-i386 -m elf_i386 --dynamic-linker=/lib/ld-linux.so.2 -s -L. -o program1 link.res

Is this a bug?

Thanks,
Stephano
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to