TOC errors on AIX

2012-07-29 Thread Perry Smith
Hi,

This is an age old topic but I can't find how to solve it.  I've searched the 
past few days.

I'm trying to build passenger on AIX 6.1 TL07 SP03 using gcc 4.5.2 that I built 
myself.  I've used it for a number of months and have built many things.

The short question is how do I get rid of these warnings?

> ld: 0711-768 WARNING: Object 
> ext/apache2/module_libboost_oxt.a[system_calls.o], section 1, function 
> .accept:
> The branch at address 0x2ac0 is not followed by a recognized no-op
> or TOC-reload instruction. The unrecognized instruction is 0x7C601B78.

The link has many errors like this.  For whatever reason, passenger builds the 
same file two different ways and puts them in two different places.  Upon 
closer examination the file that the link is complaining about does in fact 
have bad code.

The bad compile line is:

> g++ -Iext -fPIC -fvisibility=hidden -DVISIBILITY_ATTRIBUTE_SUPPORTED 
> -U__STR__ -D_THREAD_SAFE -D_LARGEFILE64_SOURCE 
> -I/gsa/ausgsa/projects/r/ruby/apache2/include/apr-1 
> -I/gsa/ausgsa/projects/r/ruby/apache2/include/apr-1 
> -I/gsa/ausgsa/projects/r/ruby/apache2/include -D_REENTRANT 
> -I/usr/local/include -DHASH_NAMESPACE="__gnu_cxx" 
> -DHASH_NAMESPACE="__gnu_cxx" -DHASH_FUN_H="" 
> -DOXT_DISABLE_BACKTRACES -DHAS_ALLOCA_H -Wall -Wextra -Wno-unused-parameter 
> -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long 
> -Wno-missing-field-initializers -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS 
> -o ext/apache2/module_libboost_oxt/oxt/system_calls.o -c 
> ext/oxt/system_calls.cpp

and produces:

> ...
>lwz 5,128(31)
> bl .accept
> mr 0,3
> ...

There needs to be a nop after the bl so the linker / loader can stuff in an 
instruction to restore the toc.

There are many warnings for this compile as well about the visibility.  e.g.

> ext/oxt/system_calls.cpp: In function 'int oxt::syscalls::accept(int, 
> sockaddr*, socklen_t*)':
> ext/oxt/system_calls.cpp:209:1: warning: visibility attribute not supported 
> in this configuration; ignored


The compile line that is good is:

> g++ -Iext  -D_REENTRANT -I/usr/local/include -DHASH_NAMESPACE="__gnu_cxx" 
> -DHASH_NAMESPACE="__gnu_cxx" -DHASH_FUN_H="" 
> -DOXT_DISABLE_BACKTRACES -DHAS_ALLOCA_H -Wall -Wextra -Wno-unused-parameter 
> -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long 
> -Wno-missing-field-initializers -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS 
> -o ext/common/libboost_oxt/oxt/system_calls.o -c ext/oxt/system_calls.cpp

which produces good code:

> ...
> lwz 5,128(31)
> bl .accept
> nop
> mr 0,3
> ...

The good compile has no warnings.

I figure it is the -fvisibility that is getting me into trouble but I am not 
sure if it is safe to just get rid of it.  There are also macros in the boost 
*.hpp files that muck with the visibility setting.

The link line is (if needed):

> g++ -shared ext/apache2/Configuration.o ext/apache2/Bucket.o 
> ext/apache2/Hooks.o ext/apache2/mod_passenger.o -fPIC -o 
> ext/apache2/mod_passenger.so -fPIC -fvisibility=hidden 
> -DVISIBILITY_ATTRIBUTE_SUPPORTED -U__STR__ -D_THREAD_SAFE 
> -D_LARGEFILE64_SOURCE -I/gsa/ausgsa/projects/r/ruby/apache2/include/apr-1 
> -I/gsa/ausgsa/projects/r/ruby/apache2/include/apr-1 
> -I/gsa/ausgsa/projects/r/ruby/apache2/include -D_REENTRANT 
> -I/usr/local/include -DHASH_NAMESPACE="__gnu_cxx" 
> -DHASH_NAMESPACE="__gnu_cxx" -DHASH_FUN_H="" 
> -DOXT_DISABLE_BACKTRACES -DHAS_ALLOCA_H -Wall -Wextra -Wno-unused-parameter 
> -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-long-long 
> -Wno-missing-field-initializers -g -DPASSENGER_DEBUG -DBOOST_DISABLE_ASSERTS 
> ext/apache2/module_libpassenger_common.a ext/apache2/module_libboost_oxt.a 
> -fPIC -L/gsa/ausgsa/projects/r/ruby/apache2/lib -lapr-1 -Wl,-G -Wl,-brtl 
> -L/gsa/ausgsa/projects/r/ruby/apache2/lib -laprutil-1 -lpthread

Thank you for your help,
Perry



graphite loop optimizer - "C" examples?

2012-07-29 Thread Gary Funck

I have been experimenting with the graphite optimizer, based on GCC trunk, and
cloog-isl.  I started with the attached simple "C" program, which has this
basic structure.

#define N 2
int a[N][N], b[N], c[N];
[...]
  for (i = 0; i < N; i++)
{
  b[i] = i;
  c[i] = i + N;
}
  for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
  a[j][i] = b[i] + c[j];

(Attached, is the full test case.)

And compiled it with: -O3  -floop-block.

Couple of questions:
1) What option should I supply to confirm that the graphite optimizer ran and
determine (i) did it in fact perform any optimizations, and (ii) which
optimizations did it perform?
2) If -floop-block couldn't optimize this program, what is the likely reason?
3) Would you please offer pointers to example "C" programs that highlight
graphite-cloog-isl optimizations?

Thanks,
- Gary
#include 
#include 
#include 

#define N 2

int a[N][N], b[N], c[N];

static double
cpu_time ()
{
  struct timespec ts;
  double t;
  if (clock_gettime (CLOCK_MONOTONIC, &ts))
abort ();
  t = ts.tv_sec + (ts.tv_nsec * 1.0e-9);
  return t;
}

int
main (void)
{

  int i, j, k;
  double start, stop, elapsed;

  for (i = 0; i < N; i++)
{
  b[i] = i;
  c[i] = i + N;
}

  start = cpu_time ();
  for (i = 0; i < N; i++)
for (j = 0; j < N; j++)
  a[j][i] = b[i] + c[j];
  stop = cpu_time ();
  elapsed = stop - start;

  printf ("elapsed time = %0.2f secs.\n", elapsed);

  return 0;
}


gcc-4.8-20120729 is now available

2012-07-29 Thread gccadmin
Snapshot gcc-4.8-20120729 is now available on
  ftp://gcc.gnu.org/pub/gcc/snapshots/4.8-20120729/
and on various mirrors, see http://gcc.gnu.org/mirrors.html for details.

This snapshot has been generated from the GCC 4.8 SVN branch
with the following options: svn://gcc.gnu.org/svn/gcc/trunk revision 189947

You'll find:

 gcc-4.8-20120729.tar.bz2 Complete GCC

  MD5=3211aa8af0e4575ae671ff605d879893
  SHA1=70258d47ab5d9c16ff9702ed49deae262eb42804

Diffs from 4.8-20120722 are available in the diffs/ subdirectory.

When a particular snapshot is ready for public consumption the LATEST-4.8
link is updated and a message is sent to the gcc list.  Please do not use
a snapshot before it has been announced that way.