From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12090 invoked by alias); 5 Dec 2011 23:52:45 -0000 Received: (qmail 12079 invoked by uid 22791); 5 Dec 2011 23:52:43 -0000 X-SWARE-Spam-Status: No, hits=-2.9 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail3.caviumnetworks.com (HELO mail3.caviumnetworks.com) (12.108.191.235) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 05 Dec 2011 23:52:28 +0000 Received: from caexch01.caveonetworks.com (Not Verified[192.168.16.9]) by mail3.caviumnetworks.com with MailMarshal (v6,7,2,8378) id ; Mon, 05 Dec 2011 15:53:56 -0800 Received: from caexch01.caveonetworks.com ([192.168.16.9]) by caexch01.caveonetworks.com with Microsoft SMTPSVC(6.0.3790.4675); Mon, 5 Dec 2011 15:52:27 -0800 Received: from dd1.caveonetworks.com ([64.2.3.195]) by caexch01.caveonetworks.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Mon, 5 Dec 2011 15:52:27 -0800 Message-ID: <4EDD593B.7090209@cavium.com> Date: Mon, 05 Dec 2011 23:52:00 -0000 From: David Daney User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Fedora/3.0.10-1.fc12 Thunderbird/3.0.10 MIME-Version: 1.0 To: binutils Subject: [Patch] ld testsuite: Fix some FAILs caused by missing -fpic. Content-Type: multipart/mixed; boundary="------------030303070800080607070707" Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2011-12/txt/msg00052.txt.bz2 This is a multi-part message in MIME format. --------------030303070800080607070707 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1063 Since the beginning of time (or at least CVS), there has been special code in the ld testsuite to omit -fpic from the flags used for building shared libraries on MIPS. This worked for very old versions of GCC where the generated code was always PIC by default. Since GCC-4.3, -fpic has been mandatory for creation of shared objects, and the testsuite's lack of this flag has caused many test cases to fail. I propose that we remove this special handling and pass -fpic, just as we do for almost all other targets. Doing this fixes about twenty FAILs. Tested on mips64-linux-gnu and x86_64-linux-gnu with no regressions. OK to commit? 2011-12-05 David Daney * ld-elfvers/vers.exp (picflag): Remove special handling for mips*-*-*. (pic): Set to "yes" for mips*-*-linux*. * ld-elfvsb/elfvsb.exp: Don't test non-PIC shared libraried on mips*-*-linux*. ( picflag): Remove special handling for mips*-*-*. * ld-elfweak/elfweak.exp (picflag): Remove special handling for mips*-*-*. * ld-shared/shared.exp (picflag): Same. --------------030303070800080607070707 Content-Type: text/plain; name="dd-1.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="dd-1.patch" Content-length: 7771 Index: ld/testsuite/ld-elfvers/vers.exp =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-elfvers/vers.exp,v retrieving revision 1.53 diff -u -p -r1.53 vers.exp --- ld/testsuite/ld-elfvers/vers.exp 15 Mar 2011 23:34:30 -0000 1.53 +++ ld/testsuite/ld-elfvers/vers.exp 5 Dec 2011 20:15:51 -0000 @@ -72,26 +72,22 @@ set SOBJDUMP_FLAGS --syms set shared "--shared --no-undefined-version" set script --version-script -if [istarget mips*-*-*] { - set picflag "" -} else { - # Unfortunately, the gcc argument is -fpic and the cc argument is - # -KPIC. We have to try both. - set picflag "-fpic" - send_log "$CC $picflag\n" - verbose "$CC $picflag" - catch "exec $CC $picflag" exec_output - send_log "$exec_output\n" - verbose "--" "$exec_output" - if { [string match "*illegal option*" $exec_output] - || [string match "*option ignored*" $exec_output] - || [string match "*unrecognized option*" $exec_output] - || [string match "*passed to ld*" $exec_output] } { - if [istarget *-*-sunos4*] { - set picflag "-pic" - } else { - set picflag "-KPIC" - } +# Unfortunately, the gcc argument is -fpic and the cc argument is +# -KPIC. We have to try both. +set picflag "-fpic" +send_log "$CC $picflag\n" +verbose "$CC $picflag" +catch "exec $CC $picflag" exec_output +send_log "$exec_output\n" +verbose "--" "$exec_output" +if { [string match "*illegal option*" $exec_output] + || [string match "*option ignored*" $exec_output] + || [string match "*unrecognized option*" $exec_output] + || [string match "*passed to ld*" $exec_output] } { + if [istarget *-*-sunos4*] { + set picflag "-pic" + } else { + set picflag "-KPIC" } } @@ -768,8 +764,8 @@ proc build_exec { test source execname f pass $test } -if [istarget x86_64-*-linux*] { - # x86_64 doesn't like non-pic shared libraries +if { [istarget x86_64-*-linux*] || [istarget mips*-*-linux*] } { + # x86_64 and MIPS don't like non-pic shared libraries set pic "yes" } else { set pic "no" Index: ld/testsuite/ld-elfvsb/elfvsb.exp =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-elfvsb/elfvsb.exp,v retrieving revision 1.36 diff -u -p -r1.36 elfvsb.exp --- ld/testsuite/ld-elfvsb/elfvsb.exp 19 Jun 2011 21:22:13 -0000 1.36 +++ ld/testsuite/ld-elfvsb/elfvsb.exp 5 Dec 2011 20:15:51 -0000 @@ -249,7 +249,7 @@ proc visibility_run {visibility} { set VSBCFLAG "" }}}}}}}}} - if { [istarget powerpc*-*-linux*] } { + if { [istarget powerpc*-*-linux*] || [istarget mips*-*-linux*] } { # Testing non-PIC libraries is a waste of effort on any target. # If you don't pass -fpic or -fPIC to gcc, gcc will assume quite # reasonably that you are not compiling for a shared library. @@ -453,26 +453,22 @@ proc visibility_run {visibility} { }} } -if [istarget mips*-*-*] { - set picflag "" -} else { - # Unfortunately, the gcc argument is -fpic and the cc argument is - # -KPIC. We have to try both. - set picflag "-fpic" - send_log "$CC $picflag\n" - verbose "$CC $picflag" - catch "exec $CC $picflag" exec_output - send_log "$exec_output\n" - verbose "--" "$exec_output" - if { [string match "*illegal option*" $exec_output] \ - || [string match "*option ignored*" $exec_output] \ - || [string match "*unrecognized option*" $exec_output] \ - || [string match "*passed to ld*" $exec_output] } { - if [istarget *-*-sunos4*] { - set picflag "-pic" - } else { - set picflag "-KPIC" - } +# Unfortunately, the gcc argument is -fpic and the cc argument is +# -KPIC. We have to try both. +set picflag "-fpic" +send_log "$CC $picflag\n" +verbose "$CC $picflag" +catch "exec $CC $picflag" exec_output +send_log "$exec_output\n" +verbose "--" "$exec_output" +if { [string match "*illegal option*" $exec_output] \ + || [string match "*option ignored*" $exec_output] \ + || [string match "*unrecognized option*" $exec_output] \ + || [string match "*passed to ld*" $exec_output] } { + if [istarget *-*-sunos4*] { + set picflag "-pic" + } else { + set picflag "-KPIC" } } verbose "Using $picflag to compile PIC code" Index: ld/testsuite/ld-elfweak/elfweak.exp =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-elfweak/elfweak.exp,v retrieving revision 1.18 diff -u -p -r1.18 elfweak.exp --- ld/testsuite/ld-elfweak/elfweak.exp 21 Dec 2010 11:00:48 -0000 1.18 +++ ld/testsuite/ld-elfweak/elfweak.exp 5 Dec 2011 20:15:51 -0000 @@ -370,26 +370,22 @@ proc build_exec { test execname objs fla pass $test } -if [istarget mips*-*-*] { - set picflag "" -} else { - # Unfortunately, the gcc argument is -fpic and the cc argument is - # -KPIC. We have to try both. - set picflag "-fpic" - send_log "$CC $picflag\n" - verbose "$CC $picflag" - catch "exec $CC $picflag" exec_output - send_log "$exec_output\n" - verbose "--" "$exec_output" - if { [string match "*illegal option*" $exec_output] - || [string match "*option ignored*" $exec_output] - || [string match "*unrecognized option*" $exec_output] - || [string match "*passed to ld*" $exec_output] } { - if [istarget *-*-sunos4*] { - set picflag "-pic" - } else { - set picflag "-KPIC" - } +# Unfortunately, the gcc argument is -fpic and the cc argument is +# -KPIC. We have to try both. +set picflag "-fpic" +send_log "$CC $picflag\n" +verbose "$CC $picflag" +catch "exec $CC $picflag" exec_output +send_log "$exec_output\n" +verbose "--" "$exec_output" +if { [string match "*illegal option*" $exec_output] + || [string match "*option ignored*" $exec_output] + || [string match "*unrecognized option*" $exec_output] + || [string match "*passed to ld*" $exec_output] } { + if [istarget *-*-sunos4*] { + set picflag "-pic" + } else { + set picflag "-KPIC" } } verbose "Using $picflag to compile PIC code" Index: ld/testsuite/ld-shared/shared.exp =================================================================== RCS file: /cvs/src/src/ld/testsuite/ld-shared/shared.exp,v retrieving revision 1.27 diff -u -p -r1.27 shared.exp --- ld/testsuite/ld-shared/shared.exp 19 Jun 2011 21:22:13 -0000 1.27 +++ ld/testsuite/ld-shared/shared.exp 5 Dec 2011 20:15:51 -0000 @@ -181,26 +181,22 @@ proc shared_test { progname testname mai pass "$testname" } -if [istarget mips*-*-*] { - set picflag "" -} else { - # Unfortunately, the gcc argument is -fpic and the cc argument is - # -KPIC. We have to try both. - set picflag "-fpic" - send_log "$CC $picflag\n" - verbose "$CC $picflag" - catch "exec $CC $picflag" exec_output - send_log "$exec_output\n" - verbose "--" "$exec_output" - if { [string match "*illegal option*" $exec_output] \ - || [string match "*option ignored*" $exec_output] \ - || [string match "*unrecognized option*" $exec_output] \ - || [string match "*passed to ld*" $exec_output] } { - if [istarget *-*-sunos4*] { - set picflag "-pic" - } else { - set picflag "-KPIC" - } +# Unfortunately, the gcc argument is -fpic and the cc argument is +# -KPIC. We have to try both. +set picflag "-fpic" +send_log "$CC $picflag\n" +verbose "$CC $picflag" +catch "exec $CC $picflag" exec_output +send_log "$exec_output\n" +verbose "--" "$exec_output" +if { [string match "*illegal option*" $exec_output] \ + || [string match "*option ignored*" $exec_output] \ + || [string match "*unrecognized option*" $exec_output] \ + || [string match "*passed to ld*" $exec_output] } { + if [istarget *-*-sunos4*] { + set picflag "-pic" + } else { + set picflag "-KPIC" } } verbose "Using $picflag to compile PIC code" --------------030303070800080607070707--