From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48503 invoked by alias); 21 Jul 2015 04:12:03 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 48494 invoked by uid 89); 21 Jul 2015 04:12:02 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-pd0-f202.google.com Received: from mail-pd0-f202.google.com (HELO mail-pd0-f202.google.com) (209.85.192.202) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 21 Jul 2015 04:12:01 +0000 Received: by pdav4 with SMTP id v4so16900370pda.0 for ; Mon, 20 Jul 2015 21:11:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:message-id:date:subject:from:to :content-type; bh=66tL+GLl9vX6sWBJzjabg0fiTTySEYgVylYZ0jVGRps=; b=FJF4MVFw+jfivuuEFZemspD173R+cOOSPrRenYmd7PJm3d8mRhiJRdaRodN9RkLinb p0pnZzaYX/JcQFSpT9zWPPVM4pmAhEqXoqunyX4oetbwGU7TNoygFPWcFbYe+NtKteWX Ixvl3kEtbm7BjFEzpCQPJUt5muVKXLsFUkN359l7L5Jj7wWTcuV7WtE998/IPff85WG8 kffkXEg8E6IetF+5ILtGkCG3DLqHVHjdW+ykraQNwLu2ZphU+neqPaMRDUHy/jkxoHyf Wa0b+AIGqIHlJYesl0aHMEao1YPvap2ZiymLQnsf3ros4vj/52j3mzbphRGAYsD/fgFa /xWA== X-Gm-Message-State: ALoCoQnatJkAWDdnjZpmefOVZqx6FVAi+aJVa3+6mkgshXnNFjKTnZlkwySWwvnxfb78zxUjTf8VU6lfF9z5Oau2wgd3hQV5OG4W21/xoTWPqUE6obWRG1yGbIDHInDNT4THIL84AFktdxcqO6PJglnwj4+pgqZAnAKNs+6MHHrChTzrnL7RF/0= MIME-Version: 1.0 X-Received: by 10.67.6.196 with SMTP id cw4mr36696957pad.46.1437451919867; Mon, 20 Jul 2015 21:11:59 -0700 (PDT) Message-ID: <001a113814301105f6051b5adb36@google.com> Date: Tue, 21 Jul 2015 04:12:00 -0000 Subject: [PATCH 3/8] gen-perf-test: debian --as-needed From: Doug Evans To: gdb-patches@sourceware.org Content-Type: text/plain; charset=UTF-8; format=flowed; delsp=yes X-IsSubscribed: yes X-SW-Source: 2015-07/txt/msg00583.txt.bz2 Hi. The problem being solved here is that debian changed the default handling of --as-needed. This patch makes things work the same regardless of distro. Alternatively, I can just check in the early_flags support, and leave debian-specific fixes to a board file or some such. 2015-07-20 Doug Evans * lib/future.exp (gdb_default_target_compile): New option "early_flags". * lib/gdb.exp (gdb_compile): Undo debian's change in default of --as-needed. diff --git a/gdb/testsuite/lib/future.exp b/gdb/testsuite/lib/future.exp index a27e120..994843e 100644 --- a/gdb/testsuite/lib/future.exp +++ b/gdb/testsuite/lib/future.exp @@ -135,14 +135,15 @@ proc gdb_default_target_compile {source destfile type options} { error "Must supply an output filename for the compile to default_target_compile" } + set early_flags "" set add_flags "" set libs "" set compiler_type "c" set compiler "" set linker "" # linker_opts_order is one of "sources-then-flags", "flags-then-sources". - # The order shouldn't matter. It's done this way to preserve - # existing behavior. + # The order matters for things like -Wl,--as-needed. The default is to + # preserve existing behavior. set linker_opts_order "sources-then-flags" set ldflags "" set dest [target_info name] @@ -240,6 +241,10 @@ proc gdb_default_target_compile {source destfile type options} { regsub "^compiler=" $i "" tmp set compiler $tmp } + if {[regexp "^early_flags=" $i]} { + regsub "^early_flags=" $i "" tmp + append early_flags " $tmp" + } if {[regexp "^additional_flags=" $i]} { regsub "^additional_flags=" $i "" tmp append add_flags " $tmp" @@ -473,15 +478,15 @@ proc gdb_default_target_compile {source destfile type options} { # become confused about the name of the actual source file. switch $type { "object" { - set opts "$add_flags $sources" + set opts "$early_flags $add_flags $sources" } "executable" { switch $linker_opts_order { "flags-then-sources" { - set opts "$add_flags $sources" + set opts "$early_flags $add_flags $sources" } "sources-then-flags" { - set opts "$sources $add_flags" + set opts "$early_flags $sources $add_flags" } default { error "Invalid value for board_info linker_opts_order" @@ -489,7 +494,7 @@ proc gdb_default_target_compile {source destfile type options} { } } default { - set opts "$sources $add_flags" + set opts "$early_flags $sources $add_flags" } } diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp index 0805de9..ffc63a5 100644 --- a/gdb/testsuite/lib/gdb.exp +++ b/gdb/testsuite/lib/gdb.exp @@ -3026,6 +3026,13 @@ proc gdb_compile {source dest type options} { || [istarget *-*-cygwin*]) } { lappend new_options "additional_flags=-Wl,--enable-auto-import" } + if { [test_compiler_info "gcc-*"] || [test_compiler_info "clang-*"] } { + # Undo debian's change in the default. + # Put it at the front to not override any user-provided + # value, and to make sure it appears in front of all the + # shlibs! + lappend new_options "early_flags=-Wl,--no-as-needed" + } } } elseif { $opt == "shlib_load" } { set shlib_load 1