From patchwork Sat Sep 15 09:57:05 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Kettenis X-Patchwork-Id: 184075 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 9B2082C0089 for ; Sat, 15 Sep 2012 19:57:24 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1348307845; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Date:Message-Id:From:To:Subject:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=7f0GWEGdTRfUbUZWg1P9WSAropI=; b=NJuZQJPyTUfP0uA SmJR83dscsapQBTXJv+oIUFryEHhJI3sL+WLntVNRrjIm5m+SmR13eeR7oa1VR+K QrkSqBVDkdaknGn0+SStlwOKwpl6r1Zv96u5Qu1pQ6Rh30ITDlzWNnSzt2i1/nxp zaQAIPFc/MSl70kqxbLLZg8eFXto= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Date:Message-Id:From:To:Subject:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=IE8XxKHPYxIcfsfnahmVwoEHNrrPuAMkMDj/McjvWa0mtpyk92nCdFXGJt14vF 0v8nggbq+HrV7yHafgQ/K/aCXeCPOgSbamMZ2dYRvdTtKfQYVUmYOsUCmUcBHyxR MqysepjtrpBnfAxRRKyWB8jyx/kfwghpkbVb8d/kVTfbA=; Received: (qmail 24294 invoked by alias); 15 Sep 2012 09:57:22 -0000 Received: (qmail 24285 invoked by uid 22791); 15 Sep 2012 09:57:21 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from sibelius.xs4all.nl (HELO glazunov.sibelius.xs4all.nl) (83.163.83.176) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 15 Sep 2012 09:57:08 +0000 Received: from glazunov.sibelius.xs4all.nl (kettenis@localhost [127.0.0.1]) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3) with ESMTP id q8F9v6OV008148 for ; Sat, 15 Sep 2012 11:57:06 +0200 (CEST) Received: (from kettenis@localhost) by glazunov.sibelius.xs4all.nl (8.14.5/8.14.3/Submit) id q8F9v5Ob027803; Sat, 15 Sep 2012 11:57:05 +0200 (CEST) Date: Sat, 15 Sep 2012 11:57:05 +0200 (CEST) Message-Id: <201209150957.q8F9v5Ob027803@glazunov.sibelius.xs4all.nl> From: Mark Kettenis To: gcc-patches@gcc.gnu.org Subject: [PATCH] Use dl_iterate_phdr() on OpenBSD Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org Split out from . Makes exception handling in shared libraries actually work. OpenBSD doesn't have so this slightly inceases the #ifdef spaghetti. Tested on i386-*-openbsd5.2 and amd64-*-openbsd5.2. Turns quite a few exception handling FAILs into PASSes. 2012-09-02 Mark Kettenis * config.host (*-*-openbsd*): Add t-eh-dw2-dip to tmake_file. * unwind-dw2-fde-dip.c: Don't include on OpenBSD. (USE_PT_GNU_EH_FRAME): Define for OpenBSD. (ElfW): Likewise. Index: config.host =================================================================== --- config.host (revision 191120) +++ config.host (working copy) @@ -213,7 +213,7 @@ esac ;; *-*-openbsd*) - tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic" + tmake_file="$tmake_file t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip" case ${target_thread_file} in posix) tmake_file="$tmake_file t-openbsd-thread" Index: unwind-dw2-fde-dip.c =================================================================== --- unwind-dw2-fde-dip.c (revision 191120) +++ unwind-dw2-fde-dip.c (working copy) @@ -33,7 +33,7 @@ #include "tconfig.h" #include "tsystem.h" -#ifndef inhibit_libc +#if !defined(inhibit_libc) && !defined(__OpenBSD__) #include /* Get DT_CONFIG. */ #endif #include "coretypes.h" @@ -65,6 +65,12 @@ #endif #if !defined(inhibit_libc) && defined(HAVE_LD_EH_FRAME_HDR) \ + && defined(__OpenBSD__) +# define ElfW(type) Elf_##type +# 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