From owner-freebsd-ports-bugs@FreeBSD.ORG Wed Nov 7 16:00:01 2012 Return-Path: Delivered-To: freebsd-ports-bugs@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 4D294577 for ; Wed, 7 Nov 2012 16:00:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id 22E7F8FC0C for ; Wed, 7 Nov 2012 16:00:01 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.5/8.14.5) with ESMTP id qA7G01oa052335 for ; Wed, 7 Nov 2012 16:00:01 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.5/8.14.5/Submit) id qA7G01mV052334; Wed, 7 Nov 2012 16:00:01 GMT (envelope-from gnats) Resent-Date: Wed, 7 Nov 2012 16:00:01 GMT Resent-Message-Id: <201211071600.qA7G01mV052334@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-ports-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Imre Vadasz Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F154549A for ; Wed, 7 Nov 2012 15:59:30 +0000 (UTC) (envelope-from nobody@FreeBSD.org) Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22]) by mx1.freebsd.org (Postfix) with ESMTP id AB43C8FC0A for ; Wed, 7 Nov 2012 15:59:30 +0000 (UTC) Received: from red.freebsd.org (localhost [127.0.0.1]) by red.freebsd.org (8.14.5/8.14.5) with ESMTP id qA7FxUX9097929 for ; Wed, 7 Nov 2012 15:59:30 GMT (envelope-from nobody@red.freebsd.org) Received: (from nobody@localhost) by red.freebsd.org (8.14.5/8.14.5/Submit) id qA7FxU48097928; Wed, 7 Nov 2012 15:59:30 GMT (envelope-from nobody) Message-Id: <201211071559.qA7FxU48097928@red.freebsd.org> Date: Wed, 7 Nov 2012 15:59:30 GMT From: Imre Vadasz To: freebsd-gnats-submit@FreeBSD.org X-Send-Pr-Version: www-3.1 Subject: ports/173446: lang/polyml: segfaults on startup on amd64 X-BeenThere: freebsd-ports-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Ports bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Nov 2012 16:00:01 -0000 >Number: 173446 >Category: ports >Synopsis: lang/polyml: segfaults on startup on amd64 >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Wed Nov 07 16:00:00 UTC 2012 >Closed-Date: >Last-Modified: >Originator: Imre Vadasz >Release: 9.0-Release >Organization: >Environment: FreeBSD Wega.fritz.box 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan 3 07:46:30 UTC 2012 root@farrell.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC amd64 >Description: The /usr/local/bin/poly executable from lang/polyml-5.4.1 immediately crashes with a SIGSEGV under FreeBSD-9.0 amd64. >How-To-Repeat: Build/Install polyml-5.4.1 on FreeBSD-9.0 amd64 (not tested on other releases of FreeBSD). The /usr/local/bin/poly crashes with a SIGSEGV whe trying to run it. >Fix: The problem is caused by a difference in the ELF64_R_INFO macro between FreeBSD and Linux. Linux explicitly casts the first parameter to Elf64_Xword, whereas FreeBSD does not. The macro is used in libpolyml/elfexport{.h,.cpp}, expecting the Linux behaviour. libpolyml/elfexport.cpp calls the ELF64_R_INFO macro, using an "unsigned" as the first parameter. Since ELF64_R_INFO shifts this parameter to the left by 32bits, this results in wrong code under FreeBSD. The easiest fix is to add a cast to "Elf64_Xword" in the wrapper macro declared in libpolyml/elfexport.h It should be decied whether /usr/include/sys/elf64.h should be fixed in FreeBSD or whether upstream has to use those macros in a portable way. Patch attached with submission follows: --- libpolyml/elfexport.h 2007-09-11 16:27:04.000000000 +0200 +++ libpolyml/elfexport.h 2012-11-07 16:20:22.475426587 +0100 @@ -37,7 +37,7 @@ #define ElfXX_Sym Elf64_Sym #define ElfXX_Ehdr Elf64_Ehdr #define ElfXX_Shdr Elf64_Shdr -#define ELFXX_R_INFO(_y, _z) ELF64_R_INFO(_y, _z) +#define ELFXX_R_INFO(_y, _z) ELF64_R_INFO((Elf64_Xword)(_y), _z) #define ELFXX_ST_INFO(_y, _z) ELF64_ST_INFO(_y, _z) #define ELFCLASSXX ELFCLASS64 #else >Release-Note: >Audit-Trail: >Unformatted: