[ccan] autodata problem

picca picca at synchrotron-soleil.fr
Mon Mar 18 19:11:03 EST 2013


Rusty Russell <rusty at rustcorp.com.au> writes:

so I can confirm that I need to add the -ggdb CFLAGS AND replace
autodata with xautodata to be able to compile my project.

picca at mordor:~/Projets/hkl/hkl/.libs$ readelf -a libhkl.so | grep autodata
  [25] xautodata_geometr PROGBITS        00044630 044630 000030 00  WA  0   0  4
   01     .init_array .fini_array .jcr .data.rel.ro .dynamic .got .got.plt .data xautodata_geometries .bss
00043508  00011f06 R_386_GLOB_DAT    00044660   __stop_xautodata_geome
0004354c  00006206 R_386_GLOB_DAT    00044630   __start_xautodata_geom
000437d0  0000d907 R_386_JUMP_SLOT   0002bc20   autodata_get_section
    98: 00044630     0 NOTYPE  GLOBAL DEFAULT  ABS __start_xautodata_geometr
   103: 0002bc3e     5 FUNC    GLOBAL DEFAULT   12 autodata_free
   217: 0002bc20    30 FUNC    GLOBAL DEFAULT   12 autodata_get_section
   287: 00044660     0 NOTYPE  GLOBAL DEFAULT  ABS __stop_xautodata_geometri
   116: 00044630     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_39
   118: 00044634     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_46
   120: 00044638     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_53
   122: 0004463c     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_61
   124: 00044640     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_68
   126: 00044644     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_75
   128: 00044648     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_82
   130: 0004464c     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_89
   132: 00044650     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_96
   134: 00044654     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_103
   136: 00044658     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_110
   138: 0004465c     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_117
  1464: 00000000     0 FILE    LOCAL  DEFAULT  ABS autodata.c
  1538: 00044660     0 NOTYPE  GLOBAL DEFAULT  ABS __stop_xautodata_geometri
  1705: 0002bc20    30 FUNC    GLOBAL DEFAULT   12 autodata_get_section
  1709: 00044630     0 NOTYPE  GLOBAL DEFAULT  ABS __start_xautodata_geometr
  1783: 0002bc3e     5 FUNC    GLOBAL DEFAULT   12 autodata_free

So the __start/__stop are DEFINED

Now I need to check if once stripped the autodata magic is still alive :).

picca at mordor:~/Projets/hkl/hkl/.libs$ readelf -a libhkl.so | grep autodata
  [25] xautodata_geometr PROGBITS        00044630 044630 000030 00  WA  0   0  4
   01     .init_array .fini_array .jcr .data.rel.ro .dynamic .got .got.plt .data xautodata_geometries .bss
00043508  00011f06 R_386_GLOB_DAT    00044660   __stop_xautodata_geome
0004354c  00006206 R_386_GLOB_DAT    00044630   __start_xautodata_geom
000437d0  0000d907 R_386_JUMP_SLOT   0002bc20   autodata_get_section
    98: 00044630     0 NOTYPE  GLOBAL DEFAULT  ABS __start_xautodata_geometr
   103: 0002bc3e     5 FUNC    GLOBAL DEFAULT   12 autodata_free
   217: 0002bc20    30 FUNC    GLOBAL DEFAULT   12 autodata_get_section
   287: 00044660     0 NOTYPE  GLOBAL DEFAULT  ABS __stop_xautodata_geometri

so it seems that is ok

Do you know if this -ggdb can be replace by another option less invasive
that -ggdb.  My program is so slow with this flags...  I usually use -O2
but I should try with -O0 to see what's going one.

with -O0

picca at mordor:~/Projets/hkl/hkl/.libs$ readelf -s libhkl.so | grep autodata
    98: 00044630     0 NOTYPE  GLOBAL DEFAULT  ABS __start_xautodata_geometr
   103: 0002bc3e     5 FUNC    GLOBAL DEFAULT   12 autodata_free
   217: 0002bc20    30 FUNC    GLOBAL DEFAULT   12 autodata_get_section
   287: 00044660     0 NOTYPE  GLOBAL DEFAULT  ABS __stop_xautodata_geometri
   109: 00044630     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_39
   111: 00044634     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_46
   113: 00044638     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_53
   115: 0004463c     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_61
   117: 00044640     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_68
   119: 00044644     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_75
   121: 00044648     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_82
   123: 0004464c     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_89
   125: 00044650     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_96
   127: 00044654     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_103
   129: 00044658     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_110
   131: 0004465c     4 OBJECT  LOCAL  DEFAULT   25 autodata_geometries_117
  1457: 00000000     0 FILE    LOCAL  DEFAULT  ABS autodata.c
  1531: 00044660     0 NOTYPE  GLOBAL DEFAULT  ABS __stop_xautodata_geometri
  1698: 0002bc20    30 FUNC    GLOBAL DEFAULT   12 autodata_get_section
  1702: 00044630     0 NOTYPE  GLOBAL DEFAULT  ABS __start_xautodata_geometr
  1776: 0002bc3e     5 FUNC    GLOBAL DEFAULT   12 autodata_free

with -O2

picca at mordor:~/Projets/hkl/hkl/.libs$ readelf -s libhkl.so | grep autodata
    17: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __stop_xautodata_geometri
    56: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __start_xautodata_geometr
   105: 000201f0     2 FUNC    GLOBAL DEFAULT   12 autodata_free
   219: 000201d0    20 FUNC    GLOBAL DEFAULT   12 autodata_get_section
   764: 00000000     0 FILE    LOCAL  DEFAULT  ABS autodata.c
   838: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __stop_xautodata_geometri
  1005: 000201d0    20 FUNC    GLOBAL DEFAULT   12 autodata_get_section
  1009: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND __start_xautodata_geometr
  1083: 000201f0     2 FUNC    GLOBAL DEFAULT   12 autodata_free

Now __start/__stop seems to be undefined...

So the optimisation pass of gcc remove the __start/__stop.

I investigate a bit more and found that I can add this flag
-fno-toplevel-reorder to avoid this problem.

Now do you think that this is a problem with gcc or with your
implementation of autodata. Should we add an attribute in autodata to
teach gcc to avoid this too agressive optimisation.


Cheers

Frederic

-- 
GPG public key 4096R/4696E015 2011-02-14
    fingerprint = E92E 7E6E 9E9D A6B1 AA31  39DC 5632 906F 4696 E015
uid  Picca Frédéric-Emmanuel <picca at synchrotron-soleil.fr>

GPG public key 1024D/A59B1171 2009-08-11
    fingerprint = 1688 A3D6 F0BD E4DF 2E6B  06AA B6A9 BA6A A59B 1171
uid  Picca Frédéric-Emmanuel <picca at debian.org>


More information about the ccan mailing list