From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8762 invoked by alias); 14 Feb 2011 05:10:45 -0000 Received: (qmail 8753 invoked by uid 22791); 14 Feb 2011 05:10:44 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_20,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 14 Feb 2011 05:10:39 +0000 Received: from kpbe19.cbf.corp.google.com (kpbe19.cbf.corp.google.com [172.25.105.83]) by smtp-out.google.com with ESMTP id p1E5AZQN032759 for ; Sun, 13 Feb 2011 21:10:36 -0800 Received: from gyf1 (gyf1.prod.google.com [10.243.50.65]) by kpbe19.cbf.corp.google.com with ESMTP id p1E5AXQt005531 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Sun, 13 Feb 2011 21:10:34 -0800 Received: by gyf1 with SMTP id 1so2584658gyf.7 for ; Sun, 13 Feb 2011 21:10:33 -0800 (PST) Received: by 10.150.190.5 with SMTP id n5mr3882118ybf.194.1297660233537; Sun, 13 Feb 2011 21:10:33 -0800 (PST) Received: from coign.google.com (adsl-71-133-8-30.dsl.pltn13.pacbell.net [71.133.8.30]) by mx.google.com with ESMTPS id q4sm1441019yba.2.2011.02.13.21.10.32 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 13 Feb 2011 21:10:33 -0800 (PST) From: Ian Lance Taylor To: John Marino Cc: gcc-help Subject: Re: dl_iterate_phdr support References: <4D56F3A4.7010808@marino.st> Date: Mon, 14 Feb 2011 08:11:00 -0000 In-Reply-To: <4D56F3A4.7010808@marino.st> (John Marino's message of "Sat, 12 Feb 2011 21:55:00 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2011-02/txt/msg00202.txt.bz2 John Marino writes: > FreeBSD and openBSD have had dl_iterate_phdr support in their runtime > linker since 2007. NetBSD-current added it in late 2010 and I just > patched Dragonfly's RTLD to support it as well, which means the > feature is fully supported by *BSD. > > I was a bit surprised when I checked the gcc configure log and saw the > check for dl_iterate_phdr came back "unknown" so I checked the > gcc/configure script. > > Basically the logic in the configure script is this: > If target <> solaris2 then gcc_cv_target_dl_iterate_phdr=unknown > > Basically that means this feature is only possibly used by gcc when > Solaris is the target. > > Is this intentional? > Why are not Linux and BSD targets being tested? > > Is the problem only a deficient configure script, or is there missing > support within gcc itself? I was told on the gcc-help mail list that > using dl_iterate_phdr was a more efficient method of propagating > exceptions and I'd like GNAT to take advantage of that. The test in gcc/configure.ac is unfortunately rather misleading. That result of that test is currently only used on Solaris. The relevant code can be found in two places: gcc/unwind-dw2-fde-glibc.c and gcc/crtstuff.c. In unwind-dw2-fde-glibc.c it looks like this: #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \ || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG))) # define USE_PT_GNU_EH_FRAME #endif #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ && defined(__FreeBSD__) && __FreeBSD__ >= 7 # define ElfW __ElfN # define USE_PT_GNU_EH_FRAME #endif #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ && defined(TARGET_DL_ITERATE_PHDR) \ && defined(__sun__) && defined(__svr4__) # define USE_PT_GNU_EH_FRAME #endif The idea is that USE_PT_GNU_EH_FRAME should be defined on any system for which the linker supports --eh-frame-hdr and the library supports dl_iterate_phdr. As you can see, the test is being done based on the library version. It is done this way because when gcc is being used to build the C library, particularly when building a cross-compiler, there is no way to test the features that the C library supports. Ian