<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "http://bugs.gentoo.org/bugzilla.dtd">

<bugzilla version="2.22.7"
          urlbase="http://bugs.gentoo.org/"
          maintainer="bugzilla@gentoo.org"
>

    <bug>
          <bug_id>159584</bug_id>
          
          <creation_ts>2006-12-31 10:14 0000</creation_ts>
          <short_desc>app-editors/emacs-cvs (probably emacs too) requires a bit of love for FreeBSD support</short_desc>
          <delta_ts>2009-01-23 06:35:26 0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>Gentoo/Alt</product>
          <component>FreeBSD</component>
          <version>unspecified</version>
          <rep_platform>Sparc</rep_platform>
          <op_sys>FreeBSD</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>flameeyes@gentoo.org</reporter>
          <assigned_to>bsd@gentoo.org</assigned_to>
          <cc>bluebird@gentoo.org</cc>
    
    <cc>emacs@gentoo.org</cc>

      

      
          <long_desc isprivate="0">
            <who>flameeyes@gentoo.org</who>
            <bug_when>2006-12-31 10:14:09 0000</bug_when>
            <thetext>As we stopped shipping csu in /usr/lib and only install it in GCC&apos;s libraries directory, emacs now fails to build on Gentoo/FreeBSD. To resolve, the following code is needed in src_unpack:

        sed -i -e &quot;s:/usr/lib/crtbegin.o:$(`tc-getCC` -print-file-name=crtbegin.o):g&quot; \
                -e &quot;s:/usr/lib/crtend.o:$(`tc-getCC` -print-file-name=crtend.o):g&quot; \
                &quot;${S}&quot;/src/s/freebsd.h || die &quot;unable to sed freebsd.h settings&quot;

this way it will use the correct crtbegin.o and crtend.o files.

Also the attached patch is needed for emacs-cvs to work on Gentoo/FreeBSD/SPARC64, as the trap 3 (flush registers) is not implemented in FreeBSD (Emacs.app for instance disable that entirely).

HTH,
Diego</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>flameeyes@gentoo.org</who>
            <bug_when>2006-12-31 10:15:27 0000</bug_when>
            <thetext>Created an attachment (id=105057)
emacs-cvs-freebsd-sparc.patch

</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>flameeyes@gentoo.org</who>
            <bug_when>2007-01-02 13:12:29 0000</bug_when>
            <thetext>Committed in main portage, thanks Matthew.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2008-03-23 19:39:20 0000</bug_when>
            <thetext>(In reply to comment #1)
&gt; Created an attachment (id=105057) [edit]
&gt; emacs-cvs-freebsd-sparc.patch

Diego, was this reported upstream?
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2008-09-04 11:14:30 0000</bug_when>
            <thetext>&gt; &gt; emacs-cvs-freebsd-sparc.patch
&gt; Diego, was this reported upstream?

*bump*
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2008-10-21 21:11:12 0000</bug_when>
            <thetext>Created an attachment (id=169350)
patch-src-alloc.c

I&apos;m not going to (re?)submit our patch upstream, since there is also attached solution around, and I know too little about that system to decide which patch is better.

Attached patch is from http://hg.hellug.gr/keramida/ports/emacs-devel/file/66695abb3cec/files/patch-src-alloc.c
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2008-11-01 09:25:07 0000</bug_when>
            <thetext>Reopening.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bluebird@gentoo.org</who>
            <bug_when>2008-12-16 21:51:08 0000</bug_when>
            <thetext>sparc@g.o is only for linux/sparc, but I&apos;ll try to help anyway ;)

&gt; emacs-cvs-freebsd-sparc.patch
That patch just ignores the flush window request. I don&apos;t know the emacs source code but with this patch it might happen that registers emacs expects to be zero are not zero.
Did you notice any problems after applying this?

&gt; patch-src-alloc.c
This is the perfect solution, you want this ;)
Instead of using the not implemented software solution it uses the (much faster) hardware solution.
But it needs to be compiled with gcc-4. gcc-3 doesn&apos;t define __sparc64__ on FreeBSD and will still show the bug.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2008-12-17 07:53:16 0000</bug_when>
            <thetext>(In reply to comment #7)
&gt; sparc@g.o is only for linux/sparc, but I&apos;ll try to help anyway ;)

Thanks a lot.

So, I&apos;ll try to make a table, where &quot;ta 3&quot; and &quot;flushw&quot; are available:

   +--------+-------+-------+
   |        |32 bit |64 bit |
   +--------+-------+-------+
   |Linux   |ta 3   |ta 3   |
   |        |       |flushw |
   +--------+-------+-------+
   |FreeBSD |ta 3   |       |
   |        |       |flushw |
   +--------+-------+-------+

Did I get this right?

&gt; But it needs to be compiled with gcc-4. gcc-3 doesn&apos;t define __sparc64__ on
&gt; FreeBSD and will still show the bug.

The Emacs source tests for __arch64__ elsewhere, does this work for all compilers?
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bluebird@gentoo.org</who>
            <bug_when>2008-12-17 08:30:01 0000</bug_when>
            <thetext>Not complety, I&apos;ll try to be more verbose:

Sparc64 (aka sparc v9) are 64bit cpus but for linux we run a 32 bit userland + 64bit kernel on it. Afaik Freebsd runs 64bit userland + 64bit kernel.
flushw is available in both 32bit and 64bit.

Ages ago there were also sparc32 (pure 32bit) cpus. We (linux) don&apos;t support them anymore, FreeBSD never supported them.

Freebsd uses __sparc64__ to check if it&apos;s a sparc64 cpu(it&apos;s defined in both 32 and 64 bit). Linux has __sparc_v9__ defined if it&apos;s a sparc64 cpu.

__arch64__ is only defined if it&apos;s actually 64bit code(most 64bit systems have this, except amd64). They probably use it to see if the have 64bit data types.</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bluebird@gentoo.org</who>
            <bug_when>2008-12-17 08:35:20 0000</bug_when>
            <thetext>&gt; Ages ago there were also sparc32 (pure 32bit) cpus. We (linux) don&apos;t support
&gt; them anymore, FreeBSD never supported them.
And they don&apos;t have flushw, they have to use &quot;ta 3&quot; on linux/solaris</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2008-12-17 09:01:22 0000</bug_when>
            <thetext>So the conclusion is to use patch-src-alloc.c (attachment 169350) instead of the current solution? GCC 3 has no sparc-fbsd keyword anyway.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>bluebird@gentoo.org</who>
            <bug_when>2008-12-17 09:02:34 0000</bug_when>
            <thetext>right :)</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2008-12-17 09:55:50 0000</bug_when>
            <thetext>Fixed in CVS, thanks again.
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2008-12-19 18:52:40 0000</bug_when>
            <thetext>In fact this was submitted upstream long time ago, but got lost:
http://thread.gmane.org/gmane.emacs.devel/61722
</thetext>
          </long_desc>
          <long_desc isprivate="0">
            <who>ulm@gentoo.org</who>
            <bug_when>2009-01-23 06:35:26 0000</bug_when>
            <thetext>Patch was applied upstream: &lt;http://cvs.savannah.gnu.org/viewvc/emacs/src/alloc.c?root=emacs&amp;r1=1.445&amp;r2=1.446&gt;
</thetext>
          </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>105057</attachid>
            <date>2006-12-31 10:15 0000</date>
            <desc>emacs-cvs-freebsd-sparc.patch</desc>
            <filename>emacs-cvs-freebsd-sparc.patch</filename>
            <type>text/plain</type>
            <data encoding="base64">SW5kZXg6IGVtYWNzL3NyYy9hbGxvYy5jCj09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT0KLS0tIGVtYWNzLm9yaWcvc3JjL2Fs
bG9jLmMKKysrIGVtYWNzL3NyYy9hbGxvYy5jCkBAIC00NTIyLDcgKzQ1MjIsNyBAQCBtYXJrX3N0
YWNrICgpCiAgIC8qIEZpeG1lOiBDb2RlIGluIHRoZSBCb2VobSBHQyBzdWdnZXN0cyBmbHVzaGlu
ZyAod2l0aCBgZmx1c2hycycpIGlzCiAgICAgIG5lZWRlZCBvbiBpYTY0IHRvby4gIFNlZSBtYWNo
X2RlcC5jLCB3aGVyZSBpdCBhbHNvIHNheXMgaW5saW5lCiAgICAgIGFzc2VtYmxlciBkb2Vzbid0
IHdvcmsgd2l0aCByZWxldmFudCBwcm9wcmlldGFyeSBjb21waWxlcnMuICAqLwotI2lmZGVmIHNw
YXJjCisjaWYgZGVmaW5lZChzcGFyYykgJiYgIWRlZmluZWQoX19GcmVlQlNEX18pCiAgIGFzbSAo
InRhIDMiKTsKICNlbmRpZgogCg==
</data>        

          </attachment>
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>169350</attachid>
            <date>2008-10-21 21:11 0000</date>
            <desc>patch-src-alloc.c</desc>
            <filename>patch-src-alloc.c</filename>
            <type>text/plain</type>
            <data encoding="base64">LS0tIHNyYy9hbGxvYy5jLm9yaWcJMjAwOC0wMS0wMiAxNDo0NTo0OC4wMDAwMDAwMDAgKzAyMDAK
KysrIHNyYy9hbGxvYy5jCTIwMDgtMDEtMDIgMTQ6NDE6MjEuMDAwMDAwMDAwICswMjAwCkBAIC00
NTMyLDggKzQ1MzIsMTIgQEAKICAgICAgbmVlZGVkIG9uIGlhNjQgdG9vLiAgU2VlIG1hY2hfZGVw
LmMsIHdoZXJlIGl0IGFsc28gc2F5cyBpbmxpbmUKICAgICAgYXNzZW1ibGVyIGRvZXNuJ3Qgd29y
ayB3aXRoIHJlbGV2YW50IHByb3ByaWV0YXJ5IGNvbXBpbGVycy4gICovCiAjaWZkZWYgc3BhcmMK
KyNpZmRlZiBfX3NwYXJjNjRfXworICBhc20gKCJmbHVzaHciKTsKKyNlbHNlCiAgIGFzbSAoInRh
IDMiKTsKICNlbmRpZgorI2VuZGlmCiAKICAgLyogU2F2ZSByZWdpc3RlcnMgdGhhdCB3ZSBuZWVk
IHRvIHNlZSBvbiB0aGUgc3RhY2suICBXZSBuZWVkIHRvIHNlZQogICAgICByZWdpc3RlcnMgdXNl
ZCB0byBob2xkIHJlZ2lzdGVyIHZhcmlhYmxlcyBhbmQgcmVnaXN0ZXJzIHVzZWQgdG8K
</data>        

          </attachment>
    </bug>

</bugzilla>