From owner-freebsd-arm@FreeBSD.ORG Wed Feb 25 22:10:37 2015 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 392F27BC for ; Wed, 25 Feb 2015 22:10:37 +0000 (UTC) Received: from phabric-backend.isc.freebsd.org (phabric-backend.isc.freebsd.org [IPv6:2001:4f8:3:ffe0:406a:0:50:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F2DAFD4 for ; Wed, 25 Feb 2015 22:10:36 +0000 (UTC) Received: from phabric-backend.isc.freebsd.org (phabric-backend.isc.freebsd.org [127.0.1.5]) by phabric-backend.isc.freebsd.org (8.14.9/8.14.9) with ESMTP id t1PMAaB9075281 for ; Wed, 25 Feb 2015 22:10:36 GMT (envelope-from root@phabric-backend.isc.freebsd.org) Received: (from root@localhost) by phabric-backend.isc.freebsd.org (8.14.9/8.14.9/Submit) id t1PMAa0X075280; Wed, 25 Feb 2015 22:10:36 GMT (envelope-from root) Date: Wed, 25 Feb 2015 22:10:36 +0000 To: freebsd-arm@freebsd.org From: "dim (Dimitry Andric)" Subject: [Differential] [Request, 122 lines] D1967: Attempt to make libcxxrt's dwarf_eh work with strict alignment Message-ID: X-Priority: 3 Thread-Topic: D1967: Attempt to make libcxxrt's dwarf_eh work with strict alignment X-Herald-Rules: none X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-To: X-Phabricator-Cc: Thread-Index: OWI2ZDlhM2EzZjk0NzYzNDhlNmU2YmYxZmFm X-Phabricator-Sent-This-Message: Yes X-Mail-Transport-Agent: MetaMTA X-Auto-Response-Suppress: All X-Phabricator-Mail-Tags: , , , MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: "Porting FreeBSD to ARM processors." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Feb 2015 22:10:37 -0000 dim created this revision. dim added reviewers: andrew, bapt, ian, theraven. dim added a subscriber: freebsd-arm. REVISION SUMMARY In the thread starting here: https://lists.freebsd.org/pipermail/freebsd-arm/2015-January/009998.html Daisuke Aoyama describes how libcxxrt does not properly handle parsing an exception table on an RPi (e.g. arm). This is because parts of dwarf_eh.h read 16 bit, 32 bit and 64 bit values directly from possibly unaligned addresses. He posted a workaround patch here: https://lists.freebsd.org/pipermail/freebsd-arm/2015-January/010014.html but it is incomplete, as it does not handle the 16 and 64 bit cases, nor does it work for other architectures with strict alignment. Here is another attempt, where I put the reading of different sized objects into their own static inline functions, and try to handle alignment and endianness properly. This seems to work on i386 and amd64, but I can't test arm and/or mips myself. Also, I now assume the __NO_STRICT_ALIGNMENT and __LITTLE_ENDIAN__ macros are available, and works as expected. That shoudl probably be refined before we send this upstream. Unfortunately these are both non-standard, and there seems to be no reliable way of determining them portably. TEST PLAN Build and install on various arches, with and without strict alignment, and with little and big endian ordering. BRANCH /head REVISION DETAIL https://reviews.freebsd.org/D1967 AFFECTED FILES contrib/libcxxrt/dwarf_eh.h To: dim, andrew, bapt, ian, theraven Cc: freebsd-arm