This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/28746] gcc -g and shared objects



------- Comment #3 from jmbnyc at gmail dot com  2006-08-16 02:42 -------
Subject: Re:  gcc -g and shared objects

Very bizarre. I struggled with this all of last night and most of
today. It is very bizarre. I am running stock RH FC5 that I installed
about 4 weeks ago. I even tried -g -O and it seems that whenever gcc
is passed -g then the shared library contains no loadable segments.

Just for kicks, I did it again.

[jmb@localhost BUtil]$ gcc -g -fPIC t.cc -c
[jmb@localhost BUtil]$ gcc -shared -g -fPIC -o t.so.1 t.o
[jmb@localhost BUtil]$ eu-readelf -l t.so.1
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz  MemSiz   Flg Align
  NULL           0x000000 0x00000000 0x00000000 0x000000 0x000000     0x0
  NULL           0x000000 0x00000000 0x00000000 0x000000 0x000000     0x0
  NULL           0x000000 0x00000000 0x00000000 0x000000 0x000000     0x0
  NULL           0x000000 0x00000000 0x00000000 0x000000 0x000000     0x0
  NULL           0x000000 0x00000000 0x00000000 0x000000 0x000000     0x0

 Section to Segment mapping:
  Segment Sections...
   00
   01
   02
   03
   04
On 16 Aug 2006 02:25:57 -0000, pinskia at gcc dot gnu dot org
<gcc-bugzilla@gcc.gnu.org> wrote:
>
>
> ------- Comment #1 from pinskia at gcc dot gnu dot org  2006-08-16 02:25 -------
> This works for me with exactly your version of GCC:
> [pinskia@celery ~]$ vi t.cc
> [pinskia@celery ~]$ gcc -g -fPIC t.cc -c
> gt.cc: In destructor 'XYZ::~XYZ()':
> t.cc:11: error: expected `}' at end of input
> c[pinskia@celery ~]$vi t.cc
> [pinskia@celery ~]$ gcc -g -fPIC t.cc -c
> gcc[pinskia@celery ~]$ gcc -shared -g -fPIC -o t.so.1 t.o
> [pinskia@celery ~]$ readelf -l t.so.1
>
> Elf file type is DYN (Shared object file)
> Entry point 0x6c0
> There are 5 program headers, starting at offset 52
>
> Program Headers:
>   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
>   LOAD           0x000000 0x00000000 0x00000000 0x00ac4 0x00ac4 R E 0x1000
>   LOAD           0x000ac4 0x00001ac4 0x00001ac4 0x00124 0x0012c RW  0x1000
>   DYNAMIC        0x000ae0 0x00001ae0 0x00001ae0 0x000c0 0x000c0 RW  0x4
>   GNU_EH_FRAME   0x00099c 0x0000099c 0x0000099c 0x00044 0x00044 R   0x4
>   GNU_STACK      0x000000 0x00000000 0x00000000 0x00000 0x00000 RW  0x4
>
>  Section to Segment mapping:
>   Segment Sections...
>    00     .hash .dynsym .dynstr .gnu.version .gnu.version_r .rel.dyn .rel.plt
> .init .plt .text .fini .rodata .eh_frame_hdr .eh_frame
>    01     .ctors .dtors .jcr .data.rel.ro .dynamic .got .got.plt .data .bss
>    02     .dynamic
>    03     .eh_frame_hdr
>    04
> [pinskia@celery ~]$ gcc -v
> Using built-in specs.
> Target: i386-redhat-linux
> Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
> --infodir=/usr/share/info --enable-shared --enable-threads=posix
> --enable-checking=release --with-system-zlib --enable-__cxa_atexit
> --disable-libunwind-exceptions --enable-libgcj-multifile
> --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk
> --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre
> --with-cpu=generic --host=i386-redhat-linux
> Thread model: posix
> gcc version 4.1.1 20060525 (Red Hat 4.1.1-1)
>
>
> --
>
>
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28746
>
> ------- You are receiving this mail because: -------
> You are on the CC list for the bug, or are watching someone who is.
> You reported the bug, or are watching the reporter.
>


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28746


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]