Re: Bootstrap problems for asm

2002-06-25 Thread Alexander Kabaev

I just copied the relevant example from IBM developerWorks site. I guess
they have a thing or two to learn on the topic they were trying to teach
:) 

On Mon, 24 Jun 2002 15:30:51 -0700 (PDT)
John Polstra [EMAIL PROTECTED] wrote:
 
 Your patch isn't quite right.  It's true that matching constraints
 are allowed only for registers.  But read-modify-write operands can
 still be specified in other ways, specifically using the +
 modifier.  Here's the patch which I'm testing at the moment.  I'll
 commit it later today unless I find something wrong with it.
 
 John
 


-- 
Alexander Kabaev

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Bootstrap problems for asm

2002-06-24 Thread Robert Watson


I'm attempting to build a modern world on a box from about a month ago
(specifically, the head of the trustedbsd_mac branch, which I'd like to
integ), and keep bumping into problems associated with the compiler
upgrade.  What's odd is that it seems to me that at the point where the
build breaks, it seems to me I should actually be using the compiler that
was built as part of the tree (i.e., post build-tools).

Anyone got any suggestions?  Boot-strapping forward on -CURRENT is
actually a useful thing to be able to do :-).

Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
[EMAIL PROTECTED]  Network Associates Laboratories


=== libexec/smrsh
cc -pipe
-I/cboss/freebsd/commit/src/libexec/smrsh/../../contrib/sendmail/src
-I/cboss/freebsd/commit/src/libexec/smrsh/../../contrib/sendmail/include
-I.-Wformat=2 -Wno-format-extra-args  -c
/cboss/freebsd/commit/src/contrib/sendmail/smrsh/smrsh.c
cc -pipe
-I/cboss/freebsd/commit/src/libexec/smrsh/../../contrib/sendmail/src
-I/cboss/freebsd/commit/src/libexec/smrsh/../../contrib/sendmail/include
-I.-Wformat=2 -Wno-format-extra-args-o smrsh smrsh.o
/cboss/devel/obj/freebsd/commit/src/libexec/smrsh/../../lib/libsm/libsm.a 
gzip -cn
/cboss/freebsd/commit/src/libexec/smrsh/../../contrib/sendmail/smrsh/smrsh.8
 smrsh.8.gz
 === libexec/rtld-elf cc -pipe
-Wall -DFREEBSD_ELF -I/cboss/freebsd/commit/src/libexec/rtld-elf/i386
-I/cboss/freebsd/commit/src/libexec/rtld-elf -elf -fpic -DPIC   -Wformat=2
-Wno-format-extra-args  -c
/cboss/freebsd/commit/src/libexec/rtld-elf/i386/rtld_start.S
cc -pipe  -Wall -DFREEBSD_ELF
-I/cboss/freebsd/commit/src/libexec/rtld-elf/i386
-I/cboss/freebsd/commit/src/libexec/rtld-elf -elf -fpic -DPIC   -Wformat=2
-Wno-format-extra-args  -c
/cboss/freebsd/commit/src/libexec/rtld-elf/rtld.c
/cboss/freebsd/commit/src/libexec/rtld-elf/rtld.c: In function
`atomic_decr_int':
/cboss/freebsd/commit/src/libexec/rtld-elf/i386/rtld_machdep.h:58:
inconsistent operand constraints in an `asm'
*** Error code 1

Stop in /cboss/freebsd/commit/src/libexec/rtld-elf.
*** Error code 1

Stop in /cboss/freebsd/commit/src/libexec.
*** Error code 1

Stop in /cboss/freebsd/commit/src.
*** Error code 1

Stop in /cboss/freebsd/commit/src.
*** Error code 1

Stop in /cboss/freebsd/commit/src.



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Bootstrap problems for asm

2002-06-24 Thread John Polstra

In article [EMAIL PROTECTED],
Robert Watson  [EMAIL PROTECTED] wrote:
 
 I'm attempting to build a modern world on a box from about a month ago
 (specifically, the head of the trustedbsd_mac branch, which I'd like to
 integ), and keep bumping into problems associated with the compiler
 upgrade.  What's odd is that it seems to me that at the point where the
 build breaks, it seems to me I should actually be using the compiler that
 was built as part of the tree (i.e., post build-tools).
 
 Anyone got any suggestions?  Boot-strapping forward on -CURRENT is
 actually a useful thing to be able to do :-).
[...]
  === libexec/rtld-elf cc -pipe
 -Wall -DFREEBSD_ELF -I/cboss/freebsd/commit/src/libexec/rtld-elf/i386
 -I/cboss/freebsd/commit/src/libexec/rtld-elf -elf -fpic -DPIC   -Wformat=2
 -Wno-format-extra-args  -c
 /cboss/freebsd/commit/src/libexec/rtld-elf/i386/rtld_start.S
 cc -pipe  -Wall -DFREEBSD_ELF
 -I/cboss/freebsd/commit/src/libexec/rtld-elf/i386
 -I/cboss/freebsd/commit/src/libexec/rtld-elf -elf -fpic -DPIC   -Wformat=2
 -Wno-format-extra-args  -c
 /cboss/freebsd/commit/src/libexec/rtld-elf/rtld.c
 /cboss/freebsd/commit/src/libexec/rtld-elf/rtld.c: In function
 `atomic_decr_int':
 /cboss/freebsd/commit/src/libexec/rtld-elf/i386/rtld_machdep.h:58:
 inconsistent operand constraints in an `asm'
 *** Error code 1

There is a problem at the moment in compiling that file without -O.
Is your /etc/make.conf standard, or did you specifically ask for no
optimization?

John
-- 
  John Polstra
  John D. Polstra  Co., Inc.Seattle, Washington USA
  Disappointment is a good sign of basic intelligence.  -- Chögyam Trungpa


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Bootstrap problems for asm

2002-06-24 Thread Robert Watson


On Mon, 24 Jun 2002, John Polstra wrote:

  /cboss/freebsd/commit/src/libexec/rtld-elf/rtld.c: In function
  `atomic_decr_int':
  /cboss/freebsd/commit/src/libexec/rtld-elf/i386/rtld_machdep.h:58:
  inconsistent operand constraints in an `asm'
  *** Error code 1
 
 There is a problem at the moment in compiling that file without -O.  Is
 your /etc/make.conf standard, or did you specifically ask for no
 optimization? 

I haven't made any explicit changes to the optimization level; on the
other hand, perhaps that should be CFLAGS+=?

Here's my make.conf:

CFLAGS=-pipe
NOPROFILE=  yes
NO_WERROR=yes
NO_PERL=yes

Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
[EMAIL PROTECTED]  Network Associates Laboratories


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Bootstrap problems for asm

2002-06-24 Thread John Polstra

In article [EMAIL PROTECTED],
Robert Watson  [EMAIL PROTECTED] wrote:
 
 On Mon, 24 Jun 2002, John Polstra wrote:
 
   /cboss/freebsd/commit/src/libexec/rtld-elf/rtld.c: In function
   `atomic_decr_int':
   /cboss/freebsd/commit/src/libexec/rtld-elf/i386/rtld_machdep.h:58:
   inconsistent operand constraints in an `asm'
   *** Error code 1
  
  There is a problem at the moment in compiling that file without -O.  Is
  your /etc/make.conf standard, or did you specifically ask for no
  optimization? 
 
 I haven't made any explicit changes to the optimization level; on the
 other hand, perhaps that should be CFLAGS+=?
 
 Here's my make.conf:
 
 CFLAGS=-pipe
 NOPROFILE=  yes
 NO_WERROR=yes
 NO_PERL=yes

That's the problem.  The default CFLAGS setting in
/etc/defaults/make.conf is -O -pipe.  You have eliminated the -O.

John
-- 
  John Polstra
  John D. Polstra  Co., Inc.Seattle, Washington USA
  Disappointment is a good sign of basic intelligence.  -- Chögyam Trungpa


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Bootstrap problems for asm

2002-06-24 Thread Robert Watson


On Mon, 24 Jun 2002, John Polstra wrote:

   There is a problem at the moment in compiling that file without -O.  Is
   your /etc/make.conf standard, or did you specifically ask for no
   optimization? 
  
  I haven't made any explicit changes to the optimization level; on the
  other hand, perhaps that should be CFLAGS+=?
  
  Here's my make.conf:
  
  CFLAGS=-pipe
  NOPROFILE=  yes
  NO_WERROR=yes
  NO_PERL=yes
 
 That's the problem.  The default CFLAGS setting in
 /etc/defaults/make.conf is -O -pipe.  You have eliminated the -O. 

Do you mind if I add an entry to UPDATING:

  20020624:
Building the real time loader (rtld) currently requires optimization
to be enabled for the build.  If you override CFLAGS in make.conf,
make sure that -O is included in in your definition of the variable,
or you may get assembler errors compiling rtld.

?

Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
[EMAIL PROTECTED]  Network Associates Laboratories



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Bootstrap problems for asm

2002-06-24 Thread Robert Watson

s/real-time/run-time/
s/rwatson/rmoron/

:-)

(Thanks to Scott Long for pointing this out)

Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
[EMAIL PROTECTED]  Network Associates Laboratories

On Mon, 24 Jun 2002, Robert Watson wrote:

 
 On Mon, 24 Jun 2002, John Polstra wrote:
 
There is a problem at the moment in compiling that file without -O.  Is
your /etc/make.conf standard, or did you specifically ask for no
optimization? 
   
   I haven't made any explicit changes to the optimization level; on the
   other hand, perhaps that should be CFLAGS+=?
   
   Here's my make.conf:
   
   CFLAGS=-pipe
   NOPROFILE=  yes
   NO_WERROR=yes
   NO_PERL=yes
  
  That's the problem.  The default CFLAGS setting in
  /etc/defaults/make.conf is -O -pipe.  You have eliminated the -O. 
 
 Do you mind if I add an entry to UPDATING:
 
   20020624:
 Building the real time loader (rtld) currently requires optimization
 to be enabled for the build.  If you override CFLAGS in make.conf,
 make sure that -O is included in in your definition of the variable,
 or you may get assembler errors compiling rtld.
 
 ?
 
 Robert N M Watson FreeBSD Core Team, TrustedBSD Projects
 [EMAIL PROTECTED]  Network Associates Laboratories
 
 
 
 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-current in the body of the message
 


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Bootstrap problems for asm

2002-06-24 Thread John Polstra

In article [EMAIL PROTECTED],
Robert Watson  [EMAIL PROTECTED] wrote:
 
 Do you mind if I add an entry to UPDATING:
 
   20020624:
 Building the real time loader (rtld) currently requires optimization
 to be enabled for the build.  If you override CFLAGS in make.conf,
 make sure that -O is included in in your definition of the variable,
 or you may get assembler errors compiling rtld.
 
 ?

No, I don't mind.  But I'll try to commit a fix later today, so it
might be worth waiting 24 hours before changing UPDATING.  Not many
people use -O0.

John
-- 
  John Polstra
  John D. Polstra  Co., Inc.Seattle, Washington USA
  Disappointment is a good sign of basic intelligence.  -- Chögyam Trungpa


To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Bootstrap problems for asm

2002-06-24 Thread David O'Brien

On Mon, Jun 24, 2002 at 08:24:06AM -0700, John Polstra wrote:
  /cboss/freebsd/commit/src/libexec/rtld-elf/i386/rtld_machdep.h:58:
  inconsistent operand constraints in an `asm'
  *** Error code 1
 
 There is a problem at the moment in compiling that file without -O.
 Is your /etc/make.conf standard, or did you specifically ask for no
 optimization?

Don't supose you are bored enough to tweak the asm statements to make
things happy? :-)

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Bootstrap problems for asm

2002-06-24 Thread John Polstra

In article [EMAIL PROTECTED],
Alexander Kabaev  [EMAIL PROTECTED] wrote:
 I am not an inline assembler guru, but here is the patch I think get the
 job done. If I understannd things correcly, GCC accepts matching
 constraints only for parameters for which registers are allowed.  
 
 Any constructive critique is appreciated.

Your patch isn't quite right.  It's true that matching constraints
are allowed only for registers.  But read-modify-write operands can
still be specified in other ways, specifically using the +
modifier.  Here's the patch which I'm testing at the moment.  I'll
commit it later today unless I find something wrong with it.

John

Index: i386/lockdflt.c
===
RCS file: /home/ncvs/src/libexec/rtld-elf/i386/lockdflt.c,v
retrieving revision 1.6
diff -u -r1.6 lockdflt.c
--- i386/lockdflt.c 17 Jul 2000 17:18:13 -  1.6
+++ i386/lockdflt.c 24 Jun 2002 20:46:05 -
@@ -80,8 +80,8 @@
int result;
 
__asm __volatile (lock; cmpxchgl %2, %0
-   : =m(*m), =a(result)
-   : r(new), 0(*m), 1(old)
+   : +m(*m), =a(result)
+   : r(new), 1(old)
: cc);
 
return result;
@@ -93,8 +93,8 @@
int result;
 
__asm __volatile (xchgl %0, %1
-   : =r(result), =m(*m)
-   : 0(v), 1(*m));
+   : =r(result), +m(*m)
+   : 0(v));
 
return result;
 }
Index: i386/rtld_machdep.h
===
RCS file: /home/ncvs/src/libexec/rtld-elf/i386/rtld_machdep.h,v
retrieving revision 1.6
diff -u -r1.6 rtld_machdep.h
--- i386/rtld_machdep.h 29 Oct 2001 10:10:10 -  1.6
+++ i386/rtld_machdep.h 24 Jun 2002 20:44:30 -
@@ -55,21 +55,21 @@
 static inline void
 atomic_decr_int(volatile int *p)
 {
-__asm __volatile (lock; decl %0 : =m(*p) : 0(*p) : cc);
+__asm __volatile (lock; decl %0 : +m(*p) : : cc);
 }
 
 static inline void
 atomic_incr_int(volatile int *p)
 {
-__asm __volatile (lock; incl %0 : =m(*p) : 0(*p) : cc);
+__asm __volatile (lock; incl %0 : +m(*p) : : cc);
 }
 
 static inline void
 atomic_add_int(volatile int *p, int val)
 {
 __asm __volatile (lock; addl %1, %0
-   : =m(*p)
-   : ri(val), 0(*p)
+   : +m(*p)
+   : ri(val)
: cc);
 }
 

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message



Re: Bootstrap problems for asm

2002-06-24 Thread Alexander Kabaev

I am not an inline assembler guru, but here is the patch I think get the
job done. If I understannd things correcly, GCC accepts matching
constraints only for parameters for which registers are allowed.  

Any constructive critique is appreciated.

 Don't supose you are bored enough to tweak the asm statements to make
 things happy? :-)

-- 
Alexander Kabaev

Index: i386/lockdflt.c
===
RCS file: /usr/ncvs/src/libexec/rtld-elf/i386/lockdflt.c,v
retrieving revision 1.6
diff -u -r1.6 lockdflt.c
--- i386/lockdflt.c 17 Jul 2000 17:18:13 -  1.6
+++ i386/lockdflt.c 24 Jun 2002 21:35:35 -
@@ -81,7 +81,7 @@
 
__asm __volatile (lock; cmpxchgl %2, %0
: =m(*m), =a(result)
-   : r(new), 0(*m), 1(old)
+   : r(new), m(*m), 1(old)
: cc);
 
return result;
@@ -94,7 +94,7 @@
 
__asm __volatile (xchgl %0, %1
: =r(result), =m(*m)
-   : 0(v), 1(*m));
+   : 0(v), m(*m));
 
return result;
 }
Index: i386/rtld_machdep.h
===
RCS file: /usr/ncvs/src/libexec/rtld-elf/i386/rtld_machdep.h,v
retrieving revision 1.6
diff -u -r1.6 rtld_machdep.h
--- i386/rtld_machdep.h 29 Oct 2001 10:10:10 -  1.6
+++ i386/rtld_machdep.h 24 Jun 2002 19:24:04 -
@@ -55,13 +55,13 @@
 static inline void
 atomic_decr_int(volatile int *p)
 {
-__asm __volatile (lock; decl %0 : =m(*p) : 0(*p) : cc);
+__asm __volatile (lock; decl %0 : =m(*p) : m(*p) : cc);
 }
 
 static inline void
 atomic_incr_int(volatile int *p)
 {
-__asm __volatile (lock; incl %0 : =m(*p) : 0(*p) : cc);
+__asm __volatile (lock; incl %0 : =m(*p) : m(*p) : cc);
 }
 
 static inline void
@@ -69,7 +69,7 @@
 {
 __asm __volatile (lock; addl %1, %0
: =m(*p)
-   : ri(val), 0(*p)
+   : ri(val), m(*p)
: cc);
 }
 

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-current in the body of the message