public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* 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
* 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  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

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  6:00 Objective C and STRUCTURE_SIZE_BOUNDARY Philip Blundell
1999-05-28  8:25 ` Ovidiu Predescu
1999-05-31 21:36   ` Ovidiu Predescu
1999-05-31 21:36 ` Philip Blundell
1999-05-28  8:33 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
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

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).