Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 159584 - app-editors/emacs-cvs (probably emacs too) requires a bit of love for FreeBSD support
Summary: app-editors/emacs-cvs (probably emacs too) requires a bit of love for FreeBSD...
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: FreeBSD (show other bugs)
Hardware: Sparc FreeBSD
: High normal
Assignee: Gentoo/BSD Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-12-31 10:14 UTC by Diego Elio Pettenò (RETIRED)
Modified: 2009-01-23 06:35 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
emacs-cvs-freebsd-sparc.patch (emacs-cvs-freebsd-sparc.patch,475 bytes, patch)
2006-12-31 10:15 UTC, Diego Elio Pettenò (RETIRED)
Details | Diff
patch-src-alloc.c (patch-src-alloc.c,507 bytes, patch)
2008-10-21 21:11 UTC, Ulrich Müller
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Diego Elio Pettenò (RETIRED) gentoo-dev 2006-12-31 10:14:09 UTC
As we stopped shipping csu in /usr/lib and only install it in GCC's libraries directory, emacs now fails to build on Gentoo/FreeBSD. To resolve, the following code is needed in src_unpack:

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

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
Comment 1 Diego Elio Pettenò (RETIRED) gentoo-dev 2006-12-31 10:15:27 UTC
Created attachment 105057 [details, diff]
emacs-cvs-freebsd-sparc.patch
Comment 2 Diego Elio Pettenò (RETIRED) gentoo-dev 2007-01-02 13:12:29 UTC
Committed in main portage, thanks Matthew.
Comment 3 Ulrich Müller gentoo-dev 2008-03-23 19:39:20 UTC
(In reply to comment #1)
> Created an attachment (id=105057) [edit]
> emacs-cvs-freebsd-sparc.patch

Diego, was this reported upstream?
Comment 4 Ulrich Müller gentoo-dev 2008-09-04 11:14:30 UTC
> > emacs-cvs-freebsd-sparc.patch
> Diego, was this reported upstream?

*bump*
Comment 5 Ulrich Müller gentoo-dev 2008-10-21 21:11:12 UTC
Created attachment 169350 [details, diff]
patch-src-alloc.c

I'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
Comment 6 Ulrich Müller gentoo-dev 2008-11-01 09:25:07 UTC
Reopening.
Comment 7 Friedrich Oslage (RETIRED) gentoo-dev 2008-12-16 21:51:08 UTC
sparc@g.o is only for linux/sparc, but I'll try to help anyway ;)

> emacs-cvs-freebsd-sparc.patch
That patch just ignores the flush window request. I don'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?

> 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't define __sparc64__ on FreeBSD and will still show the bug.
Comment 8 Ulrich Müller gentoo-dev 2008-12-17 07:53:16 UTC
(In reply to comment #7)
> sparc@g.o is only for linux/sparc, but I'll try to help anyway ;)

Thanks a lot.

So, I'll try to make a table, where "ta 3" and "flushw" are available:

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

Did I get this right?

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

The Emacs source tests for __arch64__ elsewhere, does this work for all compilers?
Comment 9 Friedrich Oslage (RETIRED) gentoo-dev 2008-12-17 08:30:01 UTC
Not complety, I'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't support them anymore, FreeBSD never supported them.

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

__arch64__ is only defined if it's actually 64bit code(most 64bit systems have this, except amd64). They probably use it to see if the have 64bit data types.
Comment 10 Friedrich Oslage (RETIRED) gentoo-dev 2008-12-17 08:35:20 UTC
> Ages ago there were also sparc32 (pure 32bit) cpus. We (linux) don't support
> them anymore, FreeBSD never supported them.
And they don't have flushw, they have to use "ta 3" on linux/solaris
Comment 11 Ulrich Müller gentoo-dev 2008-12-17 09:01:22 UTC
So the conclusion is to use patch-src-alloc.c (attachment 169350 [details, diff]) instead of the current solution? GCC 3 has no sparc-fbsd keyword anyway.
Comment 12 Friedrich Oslage (RETIRED) gentoo-dev 2008-12-17 09:02:34 UTC
right :)
Comment 13 Ulrich Müller gentoo-dev 2008-12-17 09:55:50 UTC
Fixed in CVS, thanks again.
Comment 14 Ulrich Müller gentoo-dev 2008-12-19 18:52:40 UTC
In fact this was submitted upstream long time ago, but got lost:
http://thread.gmane.org/gmane.emacs.devel/61722
Comment 15 Ulrich Müller gentoo-dev 2009-01-23 06:35:26 UTC
Patch was applied upstream: <http://cvs.savannah.gnu.org/viewvc/emacs/src/alloc.c?root=emacs&r1=1.445&r2=1.446>