Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Marco van de Voort
In our previous episode, Alexander Klenin said:
 On Tue, Mar 1, 2011 at 03:07, Leonardo M. Ram? martinr...@yahoo.com wrote:
  Hi, I'm trying to compile the r17057 on FreeBSD x86_64 and I'm getting this 
  error:
 
  fpc/rtl/units/x86_64-freebsd/cpu.s:40: Error: no such instruction: 
  `cmpxchg16b (%r8)
 
  Any hint?
 
 It seems you should upgrade your assembler/binutils?

Binutils 2.15 is the lastest binutils under GPLv2. FreeBSD does not accept
GPLv3 code into the base system afaik.

It will have to be ifdefed or written out with db.

Can sb with a x86_64 linux objdump the generated file and post the relevant
fragment on the list? Thanks.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Jonas Maebe


On 02 Mar 2011, at 10:56, Marco van de Voort wrote:


Binutils 2.15 is the lastest binutils under GPLv2.


Binutils 2.17 was the last GPLv2 version of binutils, and it supports  
cmpxchg16b.



Jonas
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Marco van de Voort
In our previous episode, Jonas Maebe said:
  Binutils 2.15 is the lastest binutils under GPLv2.
 
 Binutils 2.17 was the last GPLv2 version of binutils, and it supports  
 cmpxchg16b.

Ok. Then I don't know why they are stuck at 2.15, I got that answer then (at
the Fosdem LLVM talk), but didn't check it further.  I'll ask around.

But anyway, 8.2 is days old, so migrating to 2.17 is for now not an option,
and the db solution will have to be implemented anyway.
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Leonardo M . Ramé
 From: Marco van de Voort mar...@stack.nl
   Binutils 2.15 is the lastest binutils under
 GPLv2.
  
  Binutils 2.17 was the last GPLv2 version of binutils,
 and it supports  
  cmpxchg16b.
 
 Ok. Then I don't know why they are stuck at 2.15, I got
 that answer then (at
 the Fosdem LLVM talk), but didn't check it further. 
 I'll ask around.
 
 But anyway, 8.2 is days old, so migrating to 2.17 is for
 now not an option,
 and the db solution will have to be implemented anyway.

I upgraded to the latest binutils from /usr/ports/devel/binutils (it's ver 
2.21), then compiled FPC 2.5.1, but I got the same error.

--
Leonardo M. Ramé
http://leonardorame.blogspot.com




___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Tomas Hajny
On Wed, March 2, 2011 11:13, Marco van de Voort wrote:
 In our previous episode, Jonas Maebe said:
  Binutils 2.15 is the lastest binutils under GPLv2.

 Binutils 2.17 was the last GPLv2 version of binutils, and it supports
 cmpxchg16b.

 Ok. Then I don't know why they are stuck at 2.15, I got that answer then
 (at
 the Fosdem LLVM talk), but didn't check it further.  I'll ask around.

 But anyway, 8.2 is days old, so migrating to 2.17 is for now not an
 option,
 and the db solution will have to be implemented anyway.

FWIW, I had to do something similar in i386/mmx.pp (femms instruction) in
the past due to AS version available for OS/2 at that time.

Tomas


___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Marco van de Voort
In our previous episode, Tomas Hajny said:
  Ok. Then I don't know why they are stuck at 2.15, I got that answer then
  (at
  the Fosdem LLVM talk), but didn't check it further.  I'll ask around.
 
  But anyway, 8.2 is days old, so migrating to 2.17 is for now not an
  option,
  and the db solution will have to be implemented anyway.
 
 FWIW, I had to do something similar in i386/mmx.pp (femms instruction) in
 the past due to AS version available for OS/2 at that time.

Yes. But that is about way older binutils. OpenBSD had some too before 3.4
(when they were a.out)

I asked around, and FreeBSD 9 will migrate to 2.17.50 (+patches). But they
usually don't change toolchains much within stable versions, and FreeBSD7 is
supported till 2013, so FreeBSD8 even longer probably, so we will have to
live with it. Luckily it is a freakish instruction with only one
occurance. x86_64 is FreebSD8 plus (I have no idea how it fares on -7, it
might be that it just works and that the porter did it)





___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Marco van de Voort
In our previous episode, Leonardo M. Ram? said:
 I upgraded to the latest binutils from /usr/ports/devel/binutils (it's ver 
 2.21), then compiled FPC 2.5.1, but I got the same error.

I assume that means they are installed into local? Did you make sure they
are actually used (e.g. by using -s) ? 

If you do, and they are not, try passing -FD/usr/local/lib ?

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Leonardo M . Ramé
 From: Marco van de Voort mar...@stack.nl
 Subject: Re: [fpc-devel] Error compiling trunk on FreeBSD
 To: FPC developers' list fpc-devel@lists.freepascal.org
 Date: Wednesday, March 2, 2011, 11:04 AM
 In our previous episode, Leonardo M.
 Ram? said:
  I upgraded to the latest binutils from
 /usr/ports/devel/binutils (it's ver 2.21), then compiled FPC
 2.5.1, but I got the same error.
 
 I assume that means they are installed into local? Did you
 make sure they
 are actually used (e.g. by using -s) ? 
 
 If you do, and they are not, try passing -FD/usr/local/lib
 ?

Thanks for pointing that out, I was using 2.15, and in /usr/local I have 2.21.

Leonardo M. Ramé
http://leonardorame.blogspot.com




___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Marco van de Voort
In our previous episode, Leonardo M. Ram? said:

Thanks for pointing that out, I was using 2.15, and in /usr/local I have 2.21.

If you can compile it now, please post the result of 

objdump -d cpu.o   (the InterlockedCompareExchange128 part).

Thanks. (this is also in fixes, and needs to be fixes asap because of 2.4.4)
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] TFieldDef.Size vs TField.Size

2011-03-02 Thread LacaK



One way is: TField.Size := (TFieldDef.Size div 2) if it's a WideString,
and div 4 if unicode is enabled. Or the TDataset descendant has to
correct the value for WideStrings when creating fields. (How?)

  

Very simple/primitive Idea No1:

add property DataSize: integer read GetDataSize write FDataSize; into 
TFieldDef class


add next parameter ADataSize to Constructor TFieldDef.Create(AOwner:
TFieldDefs; const AName: string;
 ADataType: TFieldType; ASize: Integer; ARequired: Boolean;
AFieldNo: Longint
 ADataSize: Integer=0);
which is used in every TSQLConnection descendant to create fielddefs

So connectors can supply ASize=character length and also 
ADataSize=byte length , which they require to write/read character 
data into local buffer (each connector should be aware of this 
information ... i.e. encoding of character data which exchanges with DB 
engine)

If not specified , then default =0 means use ASize+1 for ftString,
(ASize+1)*2 for ftWideString ... for backward compatibility,
 for most others datatypes ignore it (because they are internaly stored 
in fixed length data structures).


Each TSQLConnection has CharSet property and each DB engine supports 
limited number of connection charsets. So SQLConnection can read CharSet 
property and determine character width.

For example if CharSet='UTF-8' then char_width:=3 (or 4)
if CharSet='UCS-2' then char_width:=2
if CharSet='UTF-16' then char_width:=4;

So with conjuction with Column size (ASize) can easy compute buffer 
size (ADataSize)


or

Constructor TFieldDef.Create(AOwner:
TFieldDefs; const AName: string;
 ADataType: TFieldType; ASize: Integer; ARequired: Boolean; 
AFieldNo: Longint

 ACharEncoding: TCharEncoding);

TCharEncoding=(cheUnknown, cheAnsi, cheUTF8, cheUTF16);

and then

ADataSize can be computed inside TFieldDef.Create and stored into 
FDataSize for later usage.(as I wrote before TFieldDef.GetDataSize will 
replace TCustomBufDataset.GetFieldSize)


Laco.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Leonardo M . Ramé
 From: Marco van de Voort mar...@stack.nl
 Subject: Re: [fpc-devel] Error compiling trunk on FreeBSD
 To: FPC developers' list fpc-devel@lists.freepascal.org
 Date: Wednesday, March 2, 2011, 11:31 AM
 In our previous episode, Leonardo M.
 Ram? said:
 
 Thanks for pointing that out, I was using 2.15, and in
 /usr/local I have 2.21.
 
 If you can compile it now, please post the result of 
 
 objdump -d cpu.o   (the
 InterlockedCompareExchange128 part).
 
 Thanks. (this is also in fixes, and needs to be fixes asap
 because of 2.4.4)

I successfully compiled it with this command: gmake clean all 
OPT=-FD/usr/local/bin

Here's the dump:

cpu.o: file format elf64-x86-64

Disassembly of section .text:

 CPU_INTERLOCKEDCOMPAREEXCHANGE128SUPPORT$$BOOLEAN:
   0:   8a 04 25 00 00 00 00mov0x0,%al
   7:   c3  retq   

0008 
CPU_INTERLOCKEDCOMPAREEXCHANGE128$INT128REC$INT128REC$INT128REC$$INT128REC:
   8:   55  push   %rbp
   9:   48 89 e5mov%rsp,%rbp
   c:   48 83 ec 10 sub$0x10,%rsp
  10:   53  push   %rbx
  11:   51  push   %rcx
  12:   49 8b 18mov(%r8),%rbx
  15:   49 8b 48 08 mov0x8(%r8),%rcx
  19:   49 89 d0mov%rdx,%r8
  1c:   49 8b 01mov(%r9),%rax
  1f:   49 8b 51 08 mov0x8(%r9),%rdx
  23:   f0 49 0f c7 08  rex64Z lock cmpxchg8b (%r8)
  28:   59  pop%rcx
  29:   48 89 01mov%rax,(%rcx)
  2c:   48 89 51 08 mov%rdx,0x8(%rcx)
  30:   5b  pop%rbx
  31:   c9  leaveq 
  32:   c3  retq   
  33:   0f 1f   (bad)  
  35:   44 00 00add%r8b,(%rax)


Leonardo M. Ramé
http://leonardorame.blogspot.com





___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Marco van de Voort
In our previous episode, Leonardo M. Ram? said:

 objdump -d cpu.o???(the
 InterlockedCompareExchange128 part).
 
 Thanks. (this is also in fixes, and needs to be fixes asap
 because of 2.4.4)

Thanks, fixed.

___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel


Re: [fpc-devel] Error compiling trunk on FreeBSD

2011-03-02 Thread Florian Klaempfl
Am 02.03.2011 14:01, schrieb Marco van de Voort:
 In our previous episode, Tomas Hajny said:
 Ok. Then I don't know why they are stuck at 2.15, I got that answer then
 (at
 the Fosdem LLVM talk), but didn't check it further.  I'll ask around.

 But anyway, 8.2 is days old, so migrating to 2.17 is for now not an
 option,
 and the db solution will have to be implemented anyway.

 FWIW, I had to do something similar in i386/mmx.pp (femms instruction) in
 the past due to AS version available for OS/2 at that time.
 
 Yes. But that is about way older binutils. OpenBSD had some too before 3.4
 (when they were a.out)
 
 I asked around, and FreeBSD 9 will migrate to 2.17.50 (+patches). But they
 usually don't change toolchains much within stable versions, and FreeBSD7 is
 supported till 2013, so FreeBSD8 even longer probably, so we will have to
 live with it. Luckily it is a freakish instruction with only one
 occurance. x86_64 is FreebSD8 plus (I have no idea how it fares on -7, it
 might be that it just works and that the porter did it)

Good reason to fix the elf64 writer for FreeBSD :)?
___
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel