diff mbox

Fix for PR bootstrap/58951

Message ID BF230D13CA30DD48930C31D4099330003A49AE24@FMSMSX101.amr.corp.intel.com
State New
Headers show

Commit Message

Iyer, Balaji V Nov. 5, 2013, 4:12 a.m. UTC
Hello Everyone,
	Attached, please find a patch to fix PR 58951. The usage of -ldl is not necessary. The patch is tested in x86_64 and x86. It is committed as obvious.

Thanks,

Balaji V. Iyer.

Comments

Gerald Pfeifer Nov. 5, 2013, 10:39 p.m. UTC | #1
Hi Balaji,

On Tue, 5 Nov 2013, Iyer, Balaji V wrote:
> Attached, please find a patch to fix PR 58951. The usage of -ldl is not 
> necessary. The patch is tested in x86_64 and x86. It is committed as 
> obvious.

thanks for looking into this.  Unfortunately, with SVN revision 204424
(that is, after this fix) bootstrap still fails for me with what looks
to be the same failure mode?

libtool: compile:  /scratch2/tmp/gerald/OBJ-1105-2159/./gcc/xgcc 
-B/scratch2/tmp/gerald/OBJ-1105-2159/./gcc/ 
-B/home/gerald/gcc-ref10-i386/i386-unknown-freebsd1 0.0/bin/ 
-B/home/gerald/gcc-ref10-i386/i386-unknown-freebsd10.0/lib/ -isystem 
/home/gerald/gcc-ref10-i386/i386-unknown-freebsd10.0/include -isystem 
/home/gerald/gcc-ref10-i386/i386-unknown-freebsd10.0/sys-include 
/scratch2/tmp/gerald/gcc-HEAD/libobjc/linking.m -c -I. 
-I/scratch2/tmp/gerald/gcc-HEAD/libobjc -g -O2 -W -Wall -Wwrite-strings 
-Wstrict-prototypes -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing 
-fexceptions -I/scratch2/tmp/gerald/gcc-HEAD/libobjc/../gcc 
-I/scratch2/tmp/gerald/gcc-HEAD/libobjc/../gcc/config -I../.././gcc 
-I/scratch2/tmp/gerald/gc c-HEAD/libobjc/../libgcc -I../libgcc 
-I/scratch2/tmp/gerald/gcc-HEAD/libobjc/../include -fgnu-runtime -fPIC 
-DPIC -o .libs/linking.o
/home/gerald/10-i386/bin/ld: cannot find -ldl
collect2: error: ld returned 1 exit status


Might this be due to

  # Hack for Cygwin
  libcilkrts_la_LDFLAGS = -version-info 5:0:0 -lpthread -ldl \
        $(am__append_1) $(am__append_2) -no-undefined

in Makefile.in?

Gerald
Gerald Pfeifer Nov. 11, 2013, 11:51 p.m. UTC | #2
Hi Balaji,

any chance to get this fixed?  Bootstrap on FreeBSD has now been
broken for some two weeks overall and I hope there aren't other
things hidden behind this one.

Gerald

On Tue, 5 Nov 2013, Gerald Pfeifer wrote:
> thanks for looking into this.  Unfortunately, with SVN revision 204424
> (that is, after this fix) bootstrap still fails for me with what looks
> to be the same failure mode?
> 
> libtool: compile:  /scratch2/tmp/gerald/OBJ-1105-2159/./gcc/xgcc 
> -B/scratch2/tmp/gerald/OBJ-1105-2159/./gcc/ 
> -B/home/gerald/gcc-ref10-i386/i386-unknown-freebsd1 0.0/bin/ 
> -B/home/gerald/gcc-ref10-i386/i386-unknown-freebsd10.0/lib/ -isystem 
> /home/gerald/gcc-ref10-i386/i386-unknown-freebsd10.0/include -isystem 
> /home/gerald/gcc-ref10-i386/i386-unknown-freebsd10.0/sys-include 
> /scratch2/tmp/gerald/gcc-HEAD/libobjc/linking.m -c -I. 
> -I/scratch2/tmp/gerald/gcc-HEAD/libobjc -g -O2 -W -Wall -Wwrite-strings 
> -Wstrict-prototypes -DIN_GCC -DIN_TARGET_LIBS -fno-strict-aliasing 
> -fexceptions -I/scratch2/tmp/gerald/gcc-HEAD/libobjc/../gcc 
> -I/scratch2/tmp/gerald/gcc-HEAD/libobjc/../gcc/config -I../.././gcc 
> -I/scratch2/tmp/gerald/gc c-HEAD/libobjc/../libgcc -I../libgcc 
> -I/scratch2/tmp/gerald/gcc-HEAD/libobjc/../include -fgnu-runtime -fPIC 
> -DPIC -o .libs/linking.o
> /home/gerald/10-i386/bin/ld: cannot find -ldl
> collect2: error: ld returned 1 exit status
> 
> 
> Might this be due to
> 
>   # Hack for Cygwin
>   libcilkrts_la_LDFLAGS = -version-info 5:0:0 -lpthread -ldl \
>         $(am__append_1) $(am__append_2) -no-undefined
> 
> in Makefile.in?
> 
> Gerald
Iyer, Balaji V Nov. 12, 2013, 4:30 a.m. UTC | #3
> -----Original Message-----
> From: Gerald Pfeifer [mailto:gerald@pfeifer.com]
> Sent: Monday, November 11, 2013 6:52 PM
> To: Iyer, Balaji V
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH] Fix for PR bootstrap/58951
> 
> Hi Balaji,
> 
> any chance to get this fixed?  Bootstrap on FreeBSD has now been broken for
> some two weeks overall and I hope there aren't other things hidden behind
> this one.
> 

Hi Gerald,
	I tried to remove the -ldl flag, but it is giving me errors like this:

/b-trunk-gcc/x86_64-unknown-linux-gnu/./libcilkrts/.libs/libcilkrts.so: undefined reference to `dladdr'
/b-trunk-gcc/x86_64-unknown-linux-gnu/./libcilkrts/.libs/libcilkrts.so: undefined reference to `dlopen'
/b-trunk-gcc/x86_64-unknown-linux-gnu/./libcilkrts/.libs/libcilkrts.so: undefined reference to `dlclose'

	Do you have any suggestions about how to fix them?

Thanks,

Balaji V. Iyer.

> Gerald
> 
> On Tue, 5 Nov 2013, Gerald Pfeifer wrote:
> > thanks for looking into this.  Unfortunately, with SVN revision 204424
> > (that is, after this fix) bootstrap still fails for me with what looks
> > to be the same failure mode?
> >
> > libtool: compile:  /scratch2/tmp/gerald/OBJ-1105-2159/./gcc/xgcc
> > -B/scratch2/tmp/gerald/OBJ-1105-2159/./gcc/
> > -B/home/gerald/gcc-ref10-i386/i386-unknown-freebsd1 0.0/bin/
> > -B/home/gerald/gcc-ref10-i386/i386-unknown-freebsd10.0/lib/ -isystem
> > /home/gerald/gcc-ref10-i386/i386-unknown-freebsd10.0/include -isystem
> > /home/gerald/gcc-ref10-i386/i386-unknown-freebsd10.0/sys-include
> > /scratch2/tmp/gerald/gcc-HEAD/libobjc/linking.m -c -I.
> > -I/scratch2/tmp/gerald/gcc-HEAD/libobjc -g -O2 -W -Wall
> > -Wwrite-strings -Wstrict-prototypes -DIN_GCC -DIN_TARGET_LIBS
> > -fno-strict-aliasing -fexceptions
> > -I/scratch2/tmp/gerald/gcc-HEAD/libobjc/../gcc
> > -I/scratch2/tmp/gerald/gcc-HEAD/libobjc/../gcc/config -I../.././gcc
> > -I/scratch2/tmp/gerald/gc c-HEAD/libobjc/../libgcc -I../libgcc
> > -I/scratch2/tmp/gerald/gcc-HEAD/libobjc/../include -fgnu-runtime -fPIC
> > -DPIC -o .libs/linking.o
> > /home/gerald/10-i386/bin/ld: cannot find -ldl
> > collect2: error: ld returned 1 exit status
> >
> >
> > Might this be due to
> >
> >   # Hack for Cygwin
> >   libcilkrts_la_LDFLAGS = -version-info 5:0:0 -lpthread -ldl \
> >         $(am__append_1) $(am__append_2) -no-undefined
> >
> > in Makefile.in?
> >
> > Gerald
Jeff Law Nov. 12, 2013, 4:40 a.m. UTC | #4
On 11/11/13 21:30, Iyer, Balaji V wrote:
>
>
>> -----Original Message-----
>> From: Gerald Pfeifer [mailto:gerald@pfeifer.com]
>> Sent: Monday, November 11, 2013 6:52 PM
>> To: Iyer, Balaji V
>> Cc: gcc-patches@gcc.gnu.org
>> Subject: Re: [PATCH] Fix for PR bootstrap/58951
>>
>> Hi Balaji,
>>
>> any chance to get this fixed?  Bootstrap on FreeBSD has now been broken for
>> some two weeks overall and I hope there aren't other things hidden behind
>> this one.
>>
>
> Hi Gerald,
> 	I tried to remove the -ldl flag, but it is giving me errors like this:
>
> /b-trunk-gcc/x86_64-unknown-linux-gnu/./libcilkrts/.libs/libcilkrts.so: undefined reference to `dladdr'
> /b-trunk-gcc/x86_64-unknown-linux-gnu/./libcilkrts/.libs/libcilkrts.so: undefined reference to `dlopen'
> /b-trunk-gcc/x86_64-unknown-linux-gnu/./libcilkrts/.libs/libcilkrts.so: undefined reference to `dlclose'
>
> 	Do you have any suggestions about how to fix them?
Are you linking with -nostdlib or something similar?  IIRC those 
routines are provided by libc on *bsd*.  On other systems you may need 
to link in libdl via -ldl.


I'm sure there's autoconf bits to test whether or not -ldl should be 
used for any given system.



jeff
Iyer, Balaji V Nov. 12, 2013, 4:44 a.m. UTC | #5
> -----Original Message-----
> From: gcc-patches-owner@gcc.gnu.org [mailto:gcc-patches-
> owner@gcc.gnu.org] On Behalf Of Jeff Law
> Sent: Monday, November 11, 2013 11:40 PM
> To: Iyer, Balaji V; Gerald Pfeifer
> Cc: gcc-patches@gcc.gnu.org
> Subject: Re: [PATCH] Fix for PR bootstrap/58951
> 
> On 11/11/13 21:30, Iyer, Balaji V wrote:
> >
> >
> >> -----Original Message-----
> >> From: Gerald Pfeifer [mailto:gerald@pfeifer.com]
> >> Sent: Monday, November 11, 2013 6:52 PM
> >> To: Iyer, Balaji V
> >> Cc: gcc-patches@gcc.gnu.org
> >> Subject: Re: [PATCH] Fix for PR bootstrap/58951
> >>
> >> Hi Balaji,
> >>
> >> any chance to get this fixed?  Bootstrap on FreeBSD has now been
> >> broken for some two weeks overall and I hope there aren't other
> >> things hidden behind this one.
> >>
> >
> > Hi Gerald,
> > 	I tried to remove the -ldl flag, but it is giving me errors like this:
> >
> > /b-trunk-gcc/x86_64-unknown-linux-gnu/./libcilkrts/.libs/libcilkrts.so:
> undefined reference to `dladdr'
> > /b-trunk-gcc/x86_64-unknown-linux-gnu/./libcilkrts/.libs/libcilkrts.so:
> undefined reference to `dlopen'
> > /b-trunk-gcc/x86_64-unknown-linux-gnu/./libcilkrts/.libs/libcilkrts.so:
> undefined reference to `dlclose'
> >
> > 	Do you have any suggestions about how to fix them?
> Are you linking with -nostdlib or something similar?  IIRC those routines are
> provided by libc on *bsd*.  On other systems you may need to link in libdl via
> -ldl.
> 

Yes, I am. In my system SUSE, I need to explicitly link it.

> 
> I'm sure there's autoconf bits to test whether or not -ldl should be used for
> any given system.
> 

Ah Ok. I will dig into it tomorrow. 

> 
> 
> jeff
Gerald Pfeifer Nov. 12, 2013, 3:16 p.m. UTC | #6
On Tue, 12 Nov 2013, Iyer, Balaji V wrote:
>> Are you linking with -nostdlib or something similar?  IIRC those 
>> routines are provided by libc on *bsd*.  On other systems you may need 
>> to link in libdl via -ldl.
> Yes, I am. In my system SUSE, I need to explicitly link it.
>> I'm sure there's autoconf bits to test whether or not -ldl should be 
>> used for any given system.
> Ah Ok. I will dig into it tomorrow. 

Thanks, appreciated!  As a most simple approach, if others prove
too complex, you could start by not linking in -ldl if it does not
exist.  I believe that'd be a strict improvement unbreaking several
non-GNU/Linux platforms by itself.

Gerald
diff mbox

Patch

Index: Makefile.in
===================================================================
--- Makefile.in	(revision 204380)
+++ Makefile.in	(working copy)
@@ -349,7 +349,7 @@ 
 	-D_Cilk_for=for -fcilkplus
 AM_CFLAGS = $(GENERAL_FLAGS) -std=c99
 AM_CPPFLAGS = $(GENERAL_FLAGS)
-AM_LDFLAGS = -lpthread -ldl
+AM_LDFLAGS = -lpthread 
 
 # May be used by toolexeclibdir.
 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 204380)
+++ ChangeLog	(working copy)
@@ -1,3 +1,9 @@ 
+2013-11-04  Balaji V. Iyer  <balaji.v.iyer@intel.com>
+
+	PR bootstrap/58951
+	* Makefile.am (AM_LDFLAGS): Removed -ldl flag.
+	* Makefile.in: Regenerate.
+
 2013-11-04  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
 
 	* runtime/os-unix.c [__sun__ && __svr4__]: Include <sched.h>.
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 204380)
+++ Makefile.am	(working copy)
@@ -45,7 +45,7 @@ 
 
 AM_CFLAGS = $(GENERAL_FLAGS) -std=c99
 AM_CPPFLAGS = $(GENERAL_FLAGS)
-AM_LDFLAGS = -lpthread -ldl
+AM_LDFLAGS = -lpthread 
 
 # May be used by toolexeclibdir.
 gcc_version := $(shell cat $(top_srcdir)/../gcc/BASE-VER)