Hi Jules,

(Patch CC'd to -hackers.)

On 2014-01-05 15:45, J Altfas wrote:
> That message looked awfully familiar!  Sure enough, the issue had 
> been discussed in this list in Feb 2013.  At the time jcowan 
> suggested there was a bug in clang: it didn't handle the -R and -z 
> parameters in the same invocation.
> 
> Looking into it, in fact the bug is in CHICKEN.  Turns out the "-z" 
> flag is really a linker vs. compiler flag, so the "-z origin" 
> incantation needs to be passed to the linker.  Here's a patch that 
> fixes the problem:

Thanks for reporting this (again!). I was able to duplicate it, and it
seems "-z" should indeed be passed as a linker flag; attached is a `git
am`-formatted patch that fixes the issue (it actually implements Vitaly
Magerya's suggested fix from the original thread[1]). I don't see a
reason this shouldn't have been added after that first discussion, but I
think it's probably just because a patch never bubbled up up anywhere,
so thank you.

[1]: https://lists.gnu.org/archive/html/chicken-users/2013-02/msg00085.html

Cheers,

Evan
>From a45641a85c6ffed4a5ed975fc437c21113c1e6dc Mon Sep 17 00:00:00 2001
From: Evan Hanson <ev...@foldling.org>
Date: Fri, 17 Jan 2014 14:30:59 +1300
Subject: [PATCH] Pass "-z origin" as a linker option for deployed binaries on
 FreeBSD

Thanks to Jules Altfas and Vitaly Magerya for the report and suggested fix.
---
 NEWS    |    4 ++++
 csc.scm |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index 7592ce4..4e89a4e 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,10 @@
   - The procedure trace buffer has been made resizable.
   - C_zap_strings and ##sys#zap-strings (undocumented) have been deprecated.
 
+- Tools
+  - csc: "-z origin" is now passed as a linker option on FreeBSD when
+    compiling for deployment (thanks to Jules Altfas & Vitaly Magerya)
+
 - Core libraries
   - Unit extras now implicitly depends on ports.  ports no longer
      implicitly depends on extras.  This may break programs which don't
diff --git a/csc.scm b/csc.scm
index 74d1d8b..935687f 100644
--- a/csc.scm
+++ b/csc.scm
@@ -277,7 +277,7 @@
         (else
          (list (conc "-L\"" library-dir "\""))))
    (if (and deployed (eq? (software-version) 'freebsd))
-       (list "-z origin")
+       (list "-Wl,-z,origin")
        '())
    (cond ((get-environment-variable "CHICKEN_C_LIBRARY_PATH") => 
          (lambda (path) 
-- 
1.7.10.4

_______________________________________________
Chicken-users mailing list
Chicken-users@nongnu.org
https://lists.nongnu.org/mailman/listinfo/chicken-users

Reply via email to