public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
@ 1999-05-28  8:33 Nick Clifton
  1999-05-28  9:11 ` Ovidiu Predescu
  1999-05-31 21:36 ` Nick Clifton
  0 siblings, 2 replies; 24+ messages in thread
From: Nick Clifton @ 1999-05-28  8:33 UTC (permalink / raw)
  To: ovidiu; +Cc: pb, egcs

Hi Ovidiu,

: How is the value for arm_structure_size_bound computed? Could you point me to
: the code please?

In the file gcc/config/arm/arm.c there is a function called
arm_override_options and in this function there is  this piece of
code:

  if (structure_size_string != NULL)
    {
      int size = strtol (structure_size_string, NULL, 0);
      
      if (size == 8 || size == 32)
	arm_structure_size_boundary = size;
      else
	warning ("Structure size boundary can only be set to 8 or 32");
    }
  

Cheers
	Nick

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  8:33 Objective C and STRUCTURE_SIZE_BOUNDARY Nick Clifton
@ 1999-05-28  9:11 ` Ovidiu Predescu
  1999-05-28  9:47   ` Philip Blundell
  1999-05-31 21:36   ` Ovidiu Predescu
  1999-05-31 21:36 ` Nick Clifton
  1 sibling, 2 replies; 24+ messages in thread
From: Ovidiu Predescu @ 1999-05-28  9:11 UTC (permalink / raw)
  To: Nick Clifton; +Cc: pb, egcs

Hi Nick,

Hm, so basically the structure boundary is passed as a compile time option.
Does this mean that on ARM all the files linked in a program should be compiled
with the same structure boundary size? How this works? Is there a way to find
out at runtime what was the option passed to the compiler at the build time?

Greetings,
Ovidiu

On Fri, 28 May 1999 08:30:07 -0700, Nick Clifton <nickc@cygnus.com> wrote:

> Hi Ovidiu,
> 
> : How is the value for arm_structure_size_bound computed? Could you point me to
> : the code please?
> 
> In the file gcc/config/arm/arm.c there is a function called
> arm_override_options and in this function there is  this piece of
> code:
> 
>   if (structure_size_string != NULL)
>     {
>       int size = strtol (structure_size_string, NULL, 0);
>       
>       if (size == 8 || size == 32)
> 	arm_structure_size_boundary = size;
>       else
> 	warning ("Structure size boundary can only be set to 8 or 32");
>     }
>   
> 
> Cheers
> 	Nick
> 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  9:11 ` Ovidiu Predescu
@ 1999-05-28  9:47   ` Philip Blundell
  1999-05-28 10:04     ` Ovidiu Predescu
  1999-05-31 21:36     ` Philip Blundell
  1999-05-31 21:36   ` Ovidiu Predescu
  1 sibling, 2 replies; 24+ messages in thread
From: Philip Blundell @ 1999-05-28  9:47 UTC (permalink / raw)
  To: Ovidiu Predescu; +Cc: Nick Clifton, egcs

>with the same structure boundary size? How this works? Is there a way to find
>out at runtime what was the option passed to the compiler at the build time?

No.  What I was thinking we could do to fix this was introduce a new constant, 
call it MAX_STRUCTURE_SIZE_BOUNDARY, that is set to the upper bound you can 
have on STRUCTURE_SIZE_BOUNDARY.  I think this should cause Objective C to 
always use the more cautious alignment (ie align to 32-bit boundaries) which 
will work regardless of what user code is doing.

p.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  9:47   ` Philip Blundell
@ 1999-05-28 10:04     ` Ovidiu Predescu
  1999-05-31 21:36       ` Ovidiu Predescu
  1999-05-31 21:36     ` Philip Blundell
  1 sibling, 1 reply; 24+ messages in thread
From: Ovidiu Predescu @ 1999-05-28 10:04 UTC (permalink / raw)
  To: Philip Blundell; +Cc: Nick Clifton, egcs

On Fri, 28 May 1999 17:45:17 +0100, Philip Blundell <pb@nexus.co.uk> wrote:

> >with the same structure boundary size? How this works? Is there a way to find
> >out at runtime what was the option passed to the compiler at the build time?
> 
> No.  What I was thinking we could do to fix this was introduce a new constant, 
> call it MAX_STRUCTURE_SIZE_BOUNDARY, that is set to the upper bound you can 
> have on STRUCTURE_SIZE_BOUNDARY.  I think this should cause Objective C to 
> always use the more cautious alignment (ie align to 32-bit boundaries) which 
> will work regardless of what user code is doing.

I'm not sure I understand your statement. The Objective-C runtime library uses
that value to determine how to dynamically access structure members. If such a
structure is part of another structure then depending on the compiler option,
the ObjC runtime could try to access it aligned at either 8 or 32 bits. If we
use a 32-bit boundary, we could be wrong when the user code is compiled with a
8-bit boundary.

Ovidiu


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  9:11 ` Ovidiu Predescu
  1999-05-28  9:47   ` Philip Blundell
@ 1999-05-31 21:36   ` Ovidiu Predescu
  1 sibling, 0 replies; 24+ messages in thread
From: Ovidiu Predescu @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Nick Clifton; +Cc: pb, egcs

Hi Nick,

Hm, so basically the structure boundary is passed as a compile time option.
Does this mean that on ARM all the files linked in a program should be compiled
with the same structure boundary size? How this works? Is there a way to find
out at runtime what was the option passed to the compiler at the build time?

Greetings,
Ovidiu

On Fri, 28 May 1999 08:30:07 -0700, Nick Clifton <nickc@cygnus.com> wrote:

> Hi Ovidiu,
> 
> : How is the value for arm_structure_size_bound computed? Could you point me to
> : the code please?
> 
> In the file gcc/config/arm/arm.c there is a function called
> arm_override_options and in this function there is  this piece of
> code:
> 
>   if (structure_size_string != NULL)
>     {
>       int size = strtol (structure_size_string, NULL, 0);
>       
>       if (size == 8 || size == 32)
> 	arm_structure_size_boundary = size;
>       else
> 	warning ("Structure size boundary can only be set to 8 or 32");
>     }
>   
> 
> Cheers
> 	Nick
> 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  8:33 Objective C and STRUCTURE_SIZE_BOUNDARY Nick Clifton
  1999-05-28  9:11 ` Ovidiu Predescu
@ 1999-05-31 21:36 ` Nick Clifton
  1 sibling, 0 replies; 24+ messages in thread
From: Nick Clifton @ 1999-05-31 21:36 UTC (permalink / raw)
  To: ovidiu; +Cc: pb, egcs

Hi Ovidiu,

: How is the value for arm_structure_size_bound computed? Could you point me to
: the code please?

In the file gcc/config/arm/arm.c there is a function called
arm_override_options and in this function there is  this piece of
code:

  if (structure_size_string != NULL)
    {
      int size = strtol (structure_size_string, NULL, 0);
      
      if (size == 8 || size == 32)
	arm_structure_size_boundary = size;
      else
	warning ("Structure size boundary can only be set to 8 or 32");
    }
  

Cheers
	Nick

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  9:47   ` Philip Blundell
  1999-05-28 10:04     ` Ovidiu Predescu
@ 1999-05-31 21:36     ` Philip Blundell
  1 sibling, 0 replies; 24+ messages in thread
From: Philip Blundell @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Ovidiu Predescu; +Cc: Nick Clifton, egcs

>with the same structure boundary size? How this works? Is there a way to find
>out at runtime what was the option passed to the compiler at the build time?

No.  What I was thinking we could do to fix this was introduce a new constant, 
call it MAX_STRUCTURE_SIZE_BOUNDARY, that is set to the upper bound you can 
have on STRUCTURE_SIZE_BOUNDARY.  I think this should cause Objective C to 
always use the more cautious alignment (ie align to 32-bit boundaries) which 
will work regardless of what user code is doing.

p.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28 10:04     ` Ovidiu Predescu
@ 1999-05-31 21:36       ` Ovidiu Predescu
  0 siblings, 0 replies; 24+ messages in thread
From: Ovidiu Predescu @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Philip Blundell; +Cc: Nick Clifton, egcs

On Fri, 28 May 1999 17:45:17 +0100, Philip Blundell <pb@nexus.co.uk> wrote:

> >with the same structure boundary size? How this works? Is there a way to find
> >out at runtime what was the option passed to the compiler at the build time?
> 
> No.  What I was thinking we could do to fix this was introduce a new constant, 
> call it MAX_STRUCTURE_SIZE_BOUNDARY, that is set to the upper bound you can 
> have on STRUCTURE_SIZE_BOUNDARY.  I think this should cause Objective C to 
> always use the more cautious alignment (ie align to 32-bit boundaries) which 
> will work regardless of what user code is doing.

I'm not sure I understand your statement. The Objective-C runtime library uses
that value to determine how to dynamically access structure members. If such a
structure is part of another structure then depending on the compiler option,
the ObjC runtime could try to access it aligned at either 8 or 32 bits. If we
use a 32-bit boundary, we could be wrong when the user code is compiled with a
8-bit boundary.

Ovidiu


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  9:59   ` Ovidiu Predescu
  1999-05-28 10:17     ` Joern Rennecke
  1999-05-28 10:49     ` Richard Earnshaw
@ 1999-05-31 21:36     ` Ovidiu Predescu
  2 siblings, 0 replies; 24+ messages in thread
From: Ovidiu Predescu @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Joern Rennecke; +Cc: Nick Clifton, pb, egcs

That's a good idea, but what we actually need is a way to have the value
assigned to a variable inside the ObjC runtime library. Since the library is
compiled once, when you build EGCS, we need a way to change that variable in
the library depending on how the user program is compiled.

Ovidiu

On Fri, 28 May 1999 17:37:56 +0100 (BST), Joern Rennecke <amylaar@cygnus.co.uk>
 wrote:

> > : Is there a way to find out at runtime what was the option passed to
> > : the compiler at the build time?
> > 
> > Sadly no.  This feature was never really intended for widespread use.
> > Some people have found that changing the default boundary (from 32 to
> > 8) produces better code *under certain circumstances*.  The best way
> > to use this feature is to use the default value whenever possible, and
> > to only use the non-default value when speed is critical and access to
> > the affected structures can be localised to user controlled source
> > files.
> 
> Assuming you only support -mstructure_size_boundary=8 to set it to
> eight (i.e. no whitespace, zeroes, other number bases or trailing junk),
> you can do:
> #define STRUCTURE_SIZE_BOUNDARY __ARM_STRUCTURE_SIZE_BOUNDARY__
> 
> #undef __ARM_STRUCTURE_SIZE_BOUNDARY__ /* Just in caers we build a native... */
> #define __ARM_STRUCTURE_SIZE_BOUNDARY__ arm_structure_size_boundary
> 
> and in CPP_SPECS:
> 
> %{structure_size_boundary=8:!-D__ARM_STRUCTURE_SIZE_BOUNDARY__=8} \
> %{!structure_size_boundary=8:!-D__ARM_STRUCTURE_SIZE_BOUNDARY__=32} \
> 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  8:25 ` Ovidiu Predescu
@ 1999-05-31 21:36   ` Ovidiu Predescu
  0 siblings, 0 replies; 24+ messages in thread
From: Ovidiu Predescu @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Philip Blundell; +Cc: egcs

How is the value for arm_structure_size_bound computed? Could you point me to
the code please?

Thanks,
Ovidiu

On Fri, 28 May 1999 13:58:25 +0100, Philip Blundell <pb@nexus.co.uk> wrote:

> The function objc_layout_structure (in libobjc/encoding.c) uses 
> STRUCTURE_SIZE_BOUNDARY when deciding what the alignment of an object should 
> be.  Unfortunately on the ARM port, under some circumstances 
> STRUCTURE_SIZE_BOUNDARY is actually a variable rather than a constant.  This 
> causes any Objective C program to fail to build with errors like:
> 
> Executing on host: /localhome/build/gcc-2.95/gcc/xgcc -B/localhome/build/gcc-2.95/gcc/ /home/pb/c
> ygnus/gcc-2.95/gcc/testsuite/objc/execute/bf-1.m  -w  -O  -I/home/pb/cygnus/gcc-2.95/gcc/testsuit
> e/../../libobjc -L/localhome/build/gcc-2.95/armv4l-unknown-linux-gnu/libobjc -lobjc  -lm   -o /lo
> calhome/build/gcc-2.95/gcc/testsuite/bf-1.x
> compiler exited with status 1
> output is:
> /localhome/build/gcc-2.95/armv4l-unknown-linux-gnu/libobjc/libobjc.a(encoding.o): In function `ob
> jc_layout_structure':
> /home/pb/cygnus/gcc-2.95/libobjc/encoding.c:730: undefined reference to `arm_structure_size_bound
> ary'
> 
> I'm not sure what the right solution to this is.  Any suggestions?
> 
> p.
> 
> 
> 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28 10:49     ` Richard Earnshaw
  1999-05-28 11:25       ` Jeffrey A Law
@ 1999-05-31 21:36       ` Richard Earnshaw
  1 sibling, 0 replies; 24+ messages in thread
From: Richard Earnshaw @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Ovidiu Predescu; +Cc: richard.earnshaw

ovidiu@cup.hp.com said:
> That's a good idea, but what we actually need is a way to have the
> value assigned to a variable inside the ObjC runtime library. Since
> the library is compiled once, when you build EGCS, we need a way to
> change that variable in the library depending on how the user program
> is compiled.


Strictly speaking this should be "multilibbed".  Yuck, another one.

I'm of the opinion that ABIs should pick a value and stick to it.  Playing 
with this dynamically is like playing with fire; you will get burnt 
eventually.

Richard.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  9:20 Nick Clifton
  1999-05-28  9:38 ` Joern Rennecke
@ 1999-05-31 21:36 ` Nick Clifton
  1 sibling, 0 replies; 24+ messages in thread
From: Nick Clifton @ 1999-05-31 21:36 UTC (permalink / raw)
  To: ovidiu; +Cc: pb, egcs

Hi Ovidiu,

: Hm, so basically the structure boundary is passed as a compile time
: option.  Does this mean that on ARM all the files linked in a
: program should be compiled with the same structure boundary size?

Yes and no.  Stricly speaking yes, all files and libraries ought to be
compiled with the same structure boundary.  Practically speaking it
only makes a difference if a file accesses a structure which is not
local to that file, and whoes packing would be altered by this compile
time option.

: Is there a way to find out at runtime what was the option passed to
: the compiler at the build time?

Sadly no.  This feature was never really intended for widespread use.
Some people have found that changing the default boundary (from 32 to
8) produces better code *under certain circumstances*.  The best way
to use this feature is to use the default value whenever possible, and
to only use the non-default value when speed is critical and access to
the affected structures can be localised to user controlled source
files.

Cheers
	Nick

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28 10:17     ` Joern Rennecke
@ 1999-05-31 21:36       ` Joern Rennecke
  0 siblings, 0 replies; 24+ messages in thread
From: Joern Rennecke @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Ovidiu Predescu; +Cc: amylaar, nickc, pb, egcs

> That's a good idea, but what we actually need is a way to have the value
> assigned to a variable inside the ObjC runtime library. Since the library is
> compiled once, when you build EGCS, we need a way to change that variable in
> the library depending on how the user program is compiled.

As Nick said, only small pieces of the program are supposd to be compiled
with this option, and they shouldn't be using any library functions or
other parts of the program that use structures with differing layout
in their interface.

If you really want to compile the entire program with a structure size
boundary of 8, you should build all libraries first to match the user code.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  6:00 Philip Blundell
  1999-05-28  8:25 ` Ovidiu Predescu
@ 1999-05-31 21:36 ` Philip Blundell
  1 sibling, 0 replies; 24+ messages in thread
From: Philip Blundell @ 1999-05-31 21:36 UTC (permalink / raw)
  To: egcs

The function objc_layout_structure (in libobjc/encoding.c) uses 
STRUCTURE_SIZE_BOUNDARY when deciding what the alignment of an object should 
be.  Unfortunately on the ARM port, under some circumstances 
STRUCTURE_SIZE_BOUNDARY is actually a variable rather than a constant.  This 
causes any Objective C program to fail to build with errors like:

Executing on host: /localhome/build/gcc-2.95/gcc/xgcc -B/localhome/build/gcc-2.95/gcc/ /home/pb/cygnus/gcc-2.95/gcc/testsuite/objc/execute/bf-1.m  -w  -O  -I/home/pb/cygnus/gcc-2.95/gcc/testsuite/../../libobjc -L/localhome/build/gcc-2.95/armv4l-unknown-linux-gnu/libobjc -lobjc  -lm   -o /localhome/build/gcc-2.95/gcc/testsuite/bf-1.x
compiler exited with status 1
output is:
/localhome/build/gcc-2.95/armv4l-unknown-linux-gnu/libobjc/libobjc.a(encoding.o): In function `objc_layout_structure':
/home/pb/cygnus/gcc-2.95/libobjc/encoding.c:730: undefined reference to `arm_structure_size_boundary'

I'm not sure what the right solution to this is.  Any suggestions?

p.


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28 11:25       ` Jeffrey A Law
@ 1999-05-31 21:36         ` Jeffrey A Law
  0 siblings, 0 replies; 24+ messages in thread
From: Jeffrey A Law @ 1999-05-31 21:36 UTC (permalink / raw)
  To: richard.earnshaw; +Cc: Ovidiu Predescu, Joern Rennecke, Nick Clifton, pb, egcs

  > I'm of the opinion that ABIs should pick a value and stick to it.  Playing 
  > with this dynamically is like playing with fire; you will get burnt 
  > eventually.
I couldn't agree more. 

jeff

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  9:38 ` Joern Rennecke
  1999-05-28  9:59   ` Ovidiu Predescu
@ 1999-05-31 21:36   ` Joern Rennecke
  1 sibling, 0 replies; 24+ messages in thread
From: Joern Rennecke @ 1999-05-31 21:36 UTC (permalink / raw)
  To: Nick Clifton; +Cc: ovidiu, pb, egcs

> : Is there a way to find out at runtime what was the option passed to
> : the compiler at the build time?
> 
> Sadly no.  This feature was never really intended for widespread use.
> Some people have found that changing the default boundary (from 32 to
> 8) produces better code *under certain circumstances*.  The best way
> to use this feature is to use the default value whenever possible, and
> to only use the non-default value when speed is critical and access to
> the affected structures can be localised to user controlled source
> files.

Assuming you only support -mstructure_size_boundary=8 to set it to
eight (i.e. no whitespace, zeroes, other number bases or trailing junk),
you can do:
#define STRUCTURE_SIZE_BOUNDARY __ARM_STRUCTURE_SIZE_BOUNDARY__

#undef __ARM_STRUCTURE_SIZE_BOUNDARY__ /* Just in caers we build a native... */
#define __ARM_STRUCTURE_SIZE_BOUNDARY__ arm_structure_size_boundary

and in CPP_SPECS:

%{structure_size_boundary=8:!-D__ARM_STRUCTURE_SIZE_BOUNDARY__=8} \
%{!structure_size_boundary=8:!-D__ARM_STRUCTURE_SIZE_BOUNDARY__=32} \

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28 10:49     ` Richard Earnshaw
@ 1999-05-28 11:25       ` Jeffrey A Law
  1999-05-31 21:36         ` Jeffrey A Law
  1999-05-31 21:36       ` Richard Earnshaw
  1 sibling, 1 reply; 24+ messages in thread
From: Jeffrey A Law @ 1999-05-28 11:25 UTC (permalink / raw)
  To: richard.earnshaw; +Cc: Ovidiu Predescu, Joern Rennecke, Nick Clifton, pb, egcs

  > I'm of the opinion that ABIs should pick a value and stick to it.  Playing 
  > with this dynamically is like playing with fire; you will get burnt 
  > eventually.
I couldn't agree more. 

jeff

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  9:59   ` Ovidiu Predescu
  1999-05-28 10:17     ` Joern Rennecke
@ 1999-05-28 10:49     ` Richard Earnshaw
  1999-05-28 11:25       ` Jeffrey A Law
  1999-05-31 21:36       ` Richard Earnshaw
  1999-05-31 21:36     ` Ovidiu Predescu
  2 siblings, 2 replies; 24+ messages in thread
From: Richard Earnshaw @ 1999-05-28 10:49 UTC (permalink / raw)
  To: Ovidiu Predescu; +Cc: richard.earnshaw

ovidiu@cup.hp.com said:
> That's a good idea, but what we actually need is a way to have the
> value assigned to a variable inside the ObjC runtime library. Since
> the library is compiled once, when you build EGCS, we need a way to
> change that variable in the library depending on how the user program
> is compiled.


Strictly speaking this should be "multilibbed".  Yuck, another one.

I'm of the opinion that ABIs should pick a value and stick to it.  Playing 
with this dynamically is like playing with fire; you will get burnt 
eventually.

Richard.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  9:59   ` Ovidiu Predescu
@ 1999-05-28 10:17     ` Joern Rennecke
  1999-05-31 21:36       ` Joern Rennecke
  1999-05-28 10:49     ` Richard Earnshaw
  1999-05-31 21:36     ` Ovidiu Predescu
  2 siblings, 1 reply; 24+ messages in thread
From: Joern Rennecke @ 1999-05-28 10:17 UTC (permalink / raw)
  To: Ovidiu Predescu; +Cc: amylaar, nickc, pb, egcs

> That's a good idea, but what we actually need is a way to have the value
> assigned to a variable inside the ObjC runtime library. Since the library is
> compiled once, when you build EGCS, we need a way to change that variable in
> the library depending on how the user program is compiled.

As Nick said, only small pieces of the program are supposd to be compiled
with this option, and they shouldn't be using any library functions or
other parts of the program that use structures with differing layout
in their interface.

If you really want to compile the entire program with a structure size
boundary of 8, you should build all libraries first to match the user code.

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  9:38 ` Joern Rennecke
@ 1999-05-28  9:59   ` Ovidiu Predescu
  1999-05-28 10:17     ` Joern Rennecke
                       ` (2 more replies)
  1999-05-31 21:36   ` Joern Rennecke
  1 sibling, 3 replies; 24+ messages in thread
From: Ovidiu Predescu @ 1999-05-28  9:59 UTC (permalink / raw)
  To: Joern Rennecke; +Cc: Nick Clifton, pb, egcs

That's a good idea, but what we actually need is a way to have the value
assigned to a variable inside the ObjC runtime library. Since the library is
compiled once, when you build EGCS, we need a way to change that variable in
the library depending on how the user program is compiled.

Ovidiu

On Fri, 28 May 1999 17:37:56 +0100 (BST), Joern Rennecke <amylaar@cygnus.co.uk>
 wrote:

> > : Is there a way to find out at runtime what was the option passed to
> > : the compiler at the build time?
> > 
> > Sadly no.  This feature was never really intended for widespread use.
> > Some people have found that changing the default boundary (from 32 to
> > 8) produces better code *under certain circumstances*.  The best way
> > to use this feature is to use the default value whenever possible, and
> > to only use the non-default value when speed is critical and access to
> > the affected structures can be localised to user controlled source
> > files.
> 
> Assuming you only support -mstructure_size_boundary=8 to set it to
> eight (i.e. no whitespace, zeroes, other number bases or trailing junk),
> you can do:
> #define STRUCTURE_SIZE_BOUNDARY __ARM_STRUCTURE_SIZE_BOUNDARY__
> 
> #undef __ARM_STRUCTURE_SIZE_BOUNDARY__ /* Just in caers we build a native... */
> #define __ARM_STRUCTURE_SIZE_BOUNDARY__ arm_structure_size_boundary
> 
> and in CPP_SPECS:
> 
> %{structure_size_boundary=8:!-D__ARM_STRUCTURE_SIZE_BOUNDARY__=8} \
> %{!structure_size_boundary=8:!-D__ARM_STRUCTURE_SIZE_BOUNDARY__=32} \
> 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  9:20 Nick Clifton
@ 1999-05-28  9:38 ` Joern Rennecke
  1999-05-28  9:59   ` Ovidiu Predescu
  1999-05-31 21:36   ` Joern Rennecke
  1999-05-31 21:36 ` Nick Clifton
  1 sibling, 2 replies; 24+ messages in thread
From: Joern Rennecke @ 1999-05-28  9:38 UTC (permalink / raw)
  To: Nick Clifton; +Cc: ovidiu, pb, egcs

> : Is there a way to find out at runtime what was the option passed to
> : the compiler at the build time?
> 
> Sadly no.  This feature was never really intended for widespread use.
> Some people have found that changing the default boundary (from 32 to
> 8) produces better code *under certain circumstances*.  The best way
> to use this feature is to use the default value whenever possible, and
> to only use the non-default value when speed is critical and access to
> the affected structures can be localised to user controlled source
> files.

Assuming you only support -mstructure_size_boundary=8 to set it to
eight (i.e. no whitespace, zeroes, other number bases or trailing junk),
you can do:
#define STRUCTURE_SIZE_BOUNDARY __ARM_STRUCTURE_SIZE_BOUNDARY__

#undef __ARM_STRUCTURE_SIZE_BOUNDARY__ /* Just in caers we build a native... */
#define __ARM_STRUCTURE_SIZE_BOUNDARY__ arm_structure_size_boundary

and in CPP_SPECS:

%{structure_size_boundary=8:!-D__ARM_STRUCTURE_SIZE_BOUNDARY__=8} \
%{!structure_size_boundary=8:!-D__ARM_STRUCTURE_SIZE_BOUNDARY__=32} \

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
@ 1999-05-28  9:20 Nick Clifton
  1999-05-28  9:38 ` Joern Rennecke
  1999-05-31 21:36 ` Nick Clifton
  0 siblings, 2 replies; 24+ messages in thread
From: Nick Clifton @ 1999-05-28  9:20 UTC (permalink / raw)
  To: ovidiu; +Cc: pb, egcs

Hi Ovidiu,

: Hm, so basically the structure boundary is passed as a compile time
: option.  Does this mean that on ARM all the files linked in a
: program should be compiled with the same structure boundary size?

Yes and no.  Stricly speaking yes, all files and libraries ought to be
compiled with the same structure boundary.  Practically speaking it
only makes a difference if a file accesses a structure which is not
local to that file, and whoes packing would be altered by this compile
time option.

: Is there a way to find out at runtime what was the option passed to
: the compiler at the build time?

Sadly no.  This feature was never really intended for widespread use.
Some people have found that changing the default boundary (from 32 to
8) produces better code *under certain circumstances*.  The best way
to use this feature is to use the default value whenever possible, and
to only use the non-default value when speed is critical and access to
the affected structures can be localised to user controlled source
files.

Cheers
	Nick

^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: Objective C and STRUCTURE_SIZE_BOUNDARY
  1999-05-28  6:00 Philip Blundell
@ 1999-05-28  8:25 ` Ovidiu Predescu
  1999-05-31 21:36   ` Ovidiu Predescu
  1999-05-31 21:36 ` Philip Blundell
  1 sibling, 1 reply; 24+ messages in thread
From: Ovidiu Predescu @ 1999-05-28  8:25 UTC (permalink / raw)
  To: Philip Blundell; +Cc: egcs

How is the value for arm_structure_size_bound computed? Could you point me to
the code please?

Thanks,
Ovidiu

On Fri, 28 May 1999 13:58:25 +0100, Philip Blundell <pb@nexus.co.uk> wrote:

> The function objc_layout_structure (in libobjc/encoding.c) uses 
> STRUCTURE_SIZE_BOUNDARY when deciding what the alignment of an object should 
> be.  Unfortunately on the ARM port, under some circumstances 
> STRUCTURE_SIZE_BOUNDARY is actually a variable rather than a constant.  This 
> causes any Objective C program to fail to build with errors like:
> 
> Executing on host: /localhome/build/gcc-2.95/gcc/xgcc -B/localhome/build/gcc-2.95/gcc/ /home/pb/c
> ygnus/gcc-2.95/gcc/testsuite/objc/execute/bf-1.m  -w  -O  -I/home/pb/cygnus/gcc-2.95/gcc/testsuit
> e/../../libobjc -L/localhome/build/gcc-2.95/armv4l-unknown-linux-gnu/libobjc -lobjc  -lm   -o /lo
> calhome/build/gcc-2.95/gcc/testsuite/bf-1.x
> compiler exited with status 1
> output is:
> /localhome/build/gcc-2.95/armv4l-unknown-linux-gnu/libobjc/libobjc.a(encoding.o): In function `ob
> jc_layout_structure':
> /home/pb/cygnus/gcc-2.95/libobjc/encoding.c:730: undefined reference to `arm_structure_size_bound
> ary'
> 
> I'm not sure what the right solution to this is.  Any suggestions?
> 
> p.
> 
> 
> 


^ permalink raw reply	[flat|nested] 24+ messages in thread

* Objective C and STRUCTURE_SIZE_BOUNDARY
@ 1999-05-28  6:00 Philip Blundell
  1999-05-28  8:25 ` Ovidiu Predescu
  1999-05-31 21:36 ` Philip Blundell
  0 siblings, 2 replies; 24+ messages in thread
From: Philip Blundell @ 1999-05-28  6:00 UTC (permalink / raw)
  To: egcs

The function objc_layout_structure (in libobjc/encoding.c) uses 
STRUCTURE_SIZE_BOUNDARY when deciding what the alignment of an object should 
be.  Unfortunately on the ARM port, under some circumstances 
STRUCTURE_SIZE_BOUNDARY is actually a variable rather than a constant.  This 
causes any Objective C program to fail to build with errors like:

Executing on host: /localhome/build/gcc-2.95/gcc/xgcc -B/localhome/build/gcc-2.95/gcc/ /home/pb/cygnus/gcc-2.95/gcc/testsuite/objc/execute/bf-1.m  -w  -O  -I/home/pb/cygnus/gcc-2.95/gcc/testsuite/../../libobjc -L/localhome/build/gcc-2.95/armv4l-unknown-linux-gnu/libobjc -lobjc  -lm   -o /localhome/build/gcc-2.95/gcc/testsuite/bf-1.x
compiler exited with status 1
output is:
/localhome/build/gcc-2.95/armv4l-unknown-linux-gnu/libobjc/libobjc.a(encoding.o): In function `objc_layout_structure':
/home/pb/cygnus/gcc-2.95/libobjc/encoding.c:730: undefined reference to `arm_structure_size_boundary'

I'm not sure what the right solution to this is.  Any suggestions?

p.


^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~1999-05-31 21:36 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-05-28  8:33 Objective C and STRUCTURE_SIZE_BOUNDARY Nick Clifton
1999-05-28  9:11 ` Ovidiu Predescu
1999-05-28  9:47   ` Philip Blundell
1999-05-28 10:04     ` Ovidiu Predescu
1999-05-31 21:36       ` Ovidiu Predescu
1999-05-31 21:36     ` Philip Blundell
1999-05-31 21:36   ` Ovidiu Predescu
1999-05-31 21:36 ` Nick Clifton
  -- strict thread matches above, loose matches on Subject: below --
1999-05-28  9:20 Nick Clifton
1999-05-28  9:38 ` Joern Rennecke
1999-05-28  9:59   ` Ovidiu Predescu
1999-05-28 10:17     ` Joern Rennecke
1999-05-31 21:36       ` Joern Rennecke
1999-05-28 10:49     ` Richard Earnshaw
1999-05-28 11:25       ` Jeffrey A Law
1999-05-31 21:36         ` Jeffrey A Law
1999-05-31 21:36       ` Richard Earnshaw
1999-05-31 21:36     ` Ovidiu Predescu
1999-05-31 21:36   ` Joern Rennecke
1999-05-31 21:36 ` Nick Clifton
1999-05-28  6:00 Philip Blundell
1999-05-28  8:25 ` Ovidiu Predescu
1999-05-31 21:36   ` Ovidiu Predescu
1999-05-31 21:36 ` Philip Blundell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).