Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Apr 1999 13:15:49 -0700 (PDT)
From:      lennox@cs.columbia.edu
To:        freebsd-gnats-submit@freebsd.org
Subject:   ports/11265: Shared libraries don't work when built with egcs port
Message-ID:  <19990421201549.064121589C@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         11265
>Category:       ports
>Synopsis:       Shared libraries don't work when built with egcs port
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Apr 21 13:20:01 PDT 1999
>Closed-Date:
>Last-Modified:
>Originator:     Jonathan Lennox
>Release:        3.1-STABLE
>Organization:
Columbia University
>Environment:
FreeBSD conrail.cs.columbia.edu 3.1-STABLE FreeBSD 3.1-STABLE #1: Wed Mar  3 23:45:27 EST 1999     lennox@conrail.cs.columbia.edu:/usr/cvsrc/RELENG_3/src/sys/compile/CONRAIL  i386
>Description:
I pulled down the egcs-1.1.2 port in late March.  When I build a shared
library with it, the resulting .so has undefined symbols in it that
aren't pulled in from anyplace.  This isn't a problem when I link, but
when I try to run an executable linked with the .so, I get errors from
/usr/libexec/ld-elf.so of the form
/usr/libexec/ld-elf.so.1: ./libbaz.so: Undefined symbol "__deregister_frame_info"

This only seems to happen if both the shared library and the executable
use only C code; if anything uses C++ the missing symbols seem to get
pulled in from somewhere.

This symbol seems to be coming in from the two files
/usr/local/lib/gcc-lib/i386-portbld-freebsd3.1/egcs-2.91.66/crtbeginS.o
/usr/local/lib/gcc-lib/i386-portbld-freebsd3.1/egcs-2.91.66/crtendS.o
>How-To-Repeat:
bash-2.02$ cat bar.c
extern void baz(void);

int main()
{
  baz();
  exit(0);
}
bash-2.02$ cat baz.c
#include <stdio.h>

void baz(void)
{
  printf("baz: hello world!\n");
}
bash-2.02$ egcc -Wall -c -fPIC baz.c
bash-2.02$ egcc -shared -Wl,-h -Wl,libbaz.so -o libbaz.so baz.o
bash-2.02$ egcc -Wall -c bar.c
bash-2.02$ egcc -o bar -L. bar.o -lbaz
bash-2.02$ LD_LIBRARY_PATH=. ./bar
/usr/libexec/ld-elf.so.1: ./libbaz.so: Undefined symbol "__deregister_frame_info"
bash-2.02$ egcc -v
Reading specs from /usr/local/lib/gcc-lib/i386-portbld-freebsd3.1/egcs-2.91.66/specs
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)

(Note: this is a (very) simplified version of a part of the Mozilla
build system, which is where I noticed the problem.)
>Fix:


>Release-Note:
>Audit-Trail:
>Unformatted:


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990421201549.064121589C>