ports/173446: lang/polyml: segfaults on startup on amd64
Imre Vadasz
imre at vdsz.com
Wed Nov 7 16:00:01 UTC 2012
>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 at 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:
More information about the freebsd-ports-bugs
mailing list