* RFC: Support for FreeBSD/amd64
@ 2005-10-26 23:52 Giorgos Keramidas
2005-10-27 3:58 ` Richard M. Stallman
` (2 more replies)
0 siblings, 3 replies; 17+ messages in thread
From: Giorgos Keramidas @ 2005-10-26 23:52 UTC (permalink / raw)
To bootstrap Emacs on my FreeBSD/amd64 snapshot I had to use the
following patch -- also available at:
http://people.freebsd.org/~keramida/emacs/22/freebsd-amd64.diff
Does this look like a reasonable way to add FreeBSD/amd64 support?
I'm not really sure the amdx86-64.h changes are ok.
%%%
--- emacs.orig/configure.in Tue Oct 25 04:09:39 2005
+++ emacs/configure.in Thu Oct 27 02:49:27 2005
@@ -238,6 +238,7 @@
case "${canonical}" in
alpha*-*-freebsd*) machine=alpha ;;
i[3456]86-*-freebsd*) machine=intel386 ;;
+ x86_64-*-freebsd*) machine=amdx86-64 ;;
esac
;;
--- emacs.orig/src/m/amdx86-64.h Sun Aug 7 12:52:27 2005
+++ emacs/src/m/amdx86-64.h Thu Oct 27 01:29:10 2005
@@ -100,11 +100,23 @@
/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
#undef DATA_SEG_BITS
+#ifdef __FreeBSD__
+
+#undef START_FILES
+#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
+
+#undef LIB_STANDARD
+#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
+
+#else /* !__FreeBSD__ */
+
#undef START_FILES
#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
#undef LIB_STANDARD
#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
+
+#endif /* __FreeBSD__ */
/* arch-tag: 8a5e001d-e12e-4692-a3a6-0b15ba271c6e
(do not change this comment) */
%%%
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-26 23:52 RFC: Support for FreeBSD/amd64 Giorgos Keramidas
@ 2005-10-27 3:58 ` Richard M. Stallman
2005-10-27 6:50 ` Frank Schmitt
2005-10-27 12:27 ` Dryice Liu
2 siblings, 0 replies; 17+ messages in thread
From: Richard M. Stallman @ 2005-10-27 3:58 UTC (permalink / raw)
Cc: emacs-devel
I don't see anything bad about it, so we may as well install it.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-26 23:52 RFC: Support for FreeBSD/amd64 Giorgos Keramidas
2005-10-27 3:58 ` Richard M. Stallman
@ 2005-10-27 6:50 ` Frank Schmitt
2005-10-27 11:50 ` Giorgos Keramidas
2005-10-27 19:08 ` Eli Zaretskii
2005-10-27 12:27 ` Dryice Liu
2 siblings, 2 replies; 17+ messages in thread
From: Frank Schmitt @ 2005-10-27 6:50 UTC (permalink / raw)
Giorgos Keramidas <keramida@ceid.upatras.gr> writes:
> To bootstrap Emacs on my FreeBSD/amd64 snapshot I had to use the
> following patch -- also available at:
> http://people.freebsd.org/~keramida/emacs/22/freebsd-amd64.diff
[...]
> +#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
[...]
Theres -lgcc two times in above line.
--
Did you ever realize how much text fits in eighty columns? If you now consider
that a signature usually consists of up to four lines, this gives you enough
space to spread a tremendous amount of information with your messages. So seize
this opportunity and don't waste your signature with bullshit nobody will read.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-27 6:50 ` Frank Schmitt
@ 2005-10-27 11:50 ` Giorgos Keramidas
2005-10-27 19:08 ` Eli Zaretskii
1 sibling, 0 replies; 17+ messages in thread
From: Giorgos Keramidas @ 2005-10-27 11:50 UTC (permalink / raw)
Cc: emacs-devel
On 2005-10-27 08:50, Frank Schmitt <ich@frank-schmitt.net> wrote:
> Giorgos Keramidas <keramida@ceid.upatras.gr> writes:
> > To bootstrap Emacs on my FreeBSD/amd64 snapshot I had to use the
> > following patch -- also available at:
> > http://people.freebsd.org/~keramida/emacs/22/freebsd-amd64.diff
> [...]
> > +#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
> [...]
>
> Theres -lgcc two times in above line.
True. There's -lgcc two times in the original amdx86-64.h too,
but it may be a chance to remove the duplicate, unless there's a
very good reason for it.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-27 6:50 ` Frank Schmitt
2005-10-27 11:50 ` Giorgos Keramidas
@ 2005-10-27 19:08 ` Eli Zaretskii
2005-10-27 20:13 ` Giorgos Keramidas
2005-10-27 20:56 ` Frank Schmitt
1 sibling, 2 replies; 17+ messages in thread
From: Eli Zaretskii @ 2005-10-27 19:08 UTC (permalink / raw)
Cc: emacs-devel
> From: Frank Schmitt <ich@frank-schmitt.net>
> Date: Thu, 27 Oct 2005 08:50:05 +0200
>
> Giorgos Keramidas <keramida@ceid.upatras.gr> writes:
>
> > To bootstrap Emacs on my FreeBSD/amd64 snapshot I had to use the
> > following patch -- also available at:
> > http://people.freebsd.org/~keramida/emacs/22/freebsd-amd64.diff
> [...]
> > +#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
> [...]
>
> Theres -lgcc two times in above line.
Yes, and they both are almost certainly needed. The reason is that
some functions in libgcc.a call functions from libc.a, and some libc.a
functions need functions from libgcc.a. Since most versions of ld are
one-pass linkers, you need to mention -lgcc twice, or else risk
getting unresolved externals.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-27 19:08 ` Eli Zaretskii
@ 2005-10-27 20:13 ` Giorgos Keramidas
2005-10-27 20:56 ` Frank Schmitt
1 sibling, 0 replies; 17+ messages in thread
From: Giorgos Keramidas @ 2005-10-27 20:13 UTC (permalink / raw)
Cc: Frank Schmitt, emacs-devel
On 2005-10-27 21:08, Eli Zaretskii <eliz@gnu.org> wrote:
>From: Frank Schmitt <ich@frank-schmitt.net>
>Date: Thu, 27 Oct 2005 08:50:05 +0200
>>
>> Giorgos Keramidas <keramida@ceid.upatras.gr> writes:
>>
>> > To bootstrap Emacs on my FreeBSD/amd64 snapshot I had to use the
>> > following patch -- also available at:
>> > http://people.freebsd.org/~keramida/emacs/22/freebsd-amd64.diff
>> [...]
>> > +#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
>> [...]
>>
>> Theres -lgcc two times in above line.
>
> Yes, and they both are almost certainly needed. The reason is that
> some functions in libgcc.a call functions from libc.a, and some libc.a
> functions need functions from libgcc.a. Since most versions of ld are
> one-pass linkers, you need to mention -lgcc twice, or else risk
> getting unresolved externals.
Thanks for the very informative followup. I guess this means it's ok to
commit the original diff then ;-)
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-27 19:08 ` Eli Zaretskii
2005-10-27 20:13 ` Giorgos Keramidas
@ 2005-10-27 20:56 ` Frank Schmitt
2005-10-28 18:09 ` Richard M. Stallman
1 sibling, 1 reply; 17+ messages in thread
From: Frank Schmitt @ 2005-10-27 20:56 UTC (permalink / raw)
Eli Zaretskii <eliz@gnu.org> writes:
>> > +#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
>> [...]
>>
>> Theres -lgcc two times in above line.
>
> Yes, and they both are almost certainly needed. The reason is that
> some functions in libgcc.a call functions from libc.a, and some libc.a
> functions need functions from libgcc.a. Since most versions of ld are
> one-pass linkers, you need to mention -lgcc twice, or else risk
> getting unresolved externals.
I see. Always nice to learn something new ;-)
--
Did you ever realize how much text fits in eighty columns? If you now consider
that a signature usually consists of up to four lines, this gives you enough
space to spread a tremendous amount of information with your messages. So seize
this opportunity and don't waste your signature with bullshit nobody will read.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-27 20:56 ` Frank Schmitt
@ 2005-10-28 18:09 ` Richard M. Stallman
2005-10-28 22:01 ` Giorgos Keramidas
2005-10-29 10:07 ` Eli Zaretskii
0 siblings, 2 replies; 17+ messages in thread
From: Richard M. Stallman @ 2005-10-28 18:09 UTC (permalink / raw)
Cc: emacs-devel
> Yes, and they both are almost certainly needed. The reason is that
> some functions in libgcc.a call functions from libc.a, and some libc.a
> functions need functions from libgcc.a. Since most versions of ld are
> one-pass linkers, you need to mention -lgcc twice, or else risk
> getting unresolved externals.
Someone should add a comment above that line
to explain this.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-28 18:09 ` Richard M. Stallman
@ 2005-10-28 22:01 ` Giorgos Keramidas
2005-10-29 5:12 ` Richard M. Stallman
2005-10-29 10:07 ` Eli Zaretskii
1 sibling, 1 reply; 17+ messages in thread
From: Giorgos Keramidas @ 2005-10-28 22:01 UTC (permalink / raw)
Cc: Frank Schmitt, emacs-devel
On 2005-10-28 14:09, "Richard M. Stallman" <rms@gnu.org> wrote:
> > Yes, and they both are almost certainly needed. The reason is that
> > some functions in libgcc.a call functions from libc.a, and some libc.a
> > functions need functions from libgcc.a. Since most versions of ld are
> > one-pass linkers, you need to mention -lgcc twice, or else risk
> > getting unresolved externals.
>
> Someone should add a comment above that line
> to explain this.
Something like this perhaps?
http://people.freebsd.org/~keramida/emacs/22/freebsd-amd64+libgcc.patch
I took the liberty of adding a comment to the __FreeBSD__ #ifdef for the
location of the 64-bit libraries.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-28 22:01 ` Giorgos Keramidas
@ 2005-10-29 5:12 ` Richard M. Stallman
2005-10-29 14:47 ` Giorgos Keramidas
0 siblings, 1 reply; 17+ messages in thread
From: Richard M. Stallman @ 2005-10-29 5:12 UTC (permalink / raw)
Cc: ich, emacs-devel
Something like this perhaps?
http://people.freebsd.org/~keramida/emacs/22/freebsd-amd64+libgcc.patch
I don't know what is in that page, so I am not sure what text you're
suggesting. Would you please show your suggestion here
rather than just giving a URL?
If your suggestion is that we put this URL in the comment,
that would not be reliable. We want the actual explanation
in the comment, not a URL.
\
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-29 5:12 ` Richard M. Stallman
@ 2005-10-29 14:47 ` Giorgos Keramidas
2005-10-30 3:36 ` Richard M. Stallman
0 siblings, 1 reply; 17+ messages in thread
From: Giorgos Keramidas @ 2005-10-29 14:47 UTC (permalink / raw)
Cc: ich, emacs-devel
On 2005-10-29 01:12, "Richard M. Stallman" <rms@gnu.org> wrote:
> Something like this perhaps?
>
> http://people.freebsd.org/~keramida/emacs/22/freebsd-amd64+libgcc.patch
>
> I don't know what is in that page, so I am not sure what text you're
> suggesting. Would you please show your suggestion here
> rather than just giving a URL?
Sure. I thought it would be ok to put it online instead of mailing the
diff to all list members. The diff was:
%%%
Index: configure.in
===================================================================
RCS file: /cvsroot/emacs/emacs/configure.in,v
retrieving revision 1.399
diff -u -r1.399 configure.in
--- configure.in 25 Oct 2005 01:09:39 -0000 1.399
+++ configure.in 28 Oct 2005 21:54:46 -0000
@@ -238,6 +238,7 @@
case "${canonical}" in
alpha*-*-freebsd*) machine=alpha ;;
i[3456]86-*-freebsd*) machine=intel386 ;;
+ amd64-*-freebsd*|x86_64-*-freebsd*) machine=amdx86-64 ;;
esac
;;
Index: src/m/amdx86-64.h
===================================================================
RCS file: /cvsroot/emacs/emacs/src/m/amdx86-64.h,v
retrieving revision 1.8
diff -u -r1.8 amdx86-64.h
--- src/m/amdx86-64.h 7 Aug 2005 09:52:27 -0000 1.8
+++ src/m/amdx86-64.h 28 Oct 2005 21:54:46 -0000
@@ -100,11 +100,38 @@
/* Define XPNTR to avoid or'ing with DATA_SEG_BITS */
#undef DATA_SEG_BITS
+#ifdef __FreeBSD__
+
+/* The libraries for binaries native to the build host's architecture are
+ installed under /usr/lib in FreeBSD, and the ones that need special paths
+ are 32-bit compatibility libraries (installed under /usr/lib32). To build
+ a native binary of Emacs on FreeBSD/amd64 we can just point to /usr/lib. */
+
+#undef START_FILES
+#define START_FILES pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
+
+/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD.
+ The reason is that some functions in libgcc.a call functions from libc.a,
+ and some libc.a functions need functions from libgcc.a. Since most
+ versions of ld are one-pass linkers, we need to mention -lgcc twice,
+ or else we risk getting unresolved externals. */
+#undef LIB_STANDARD
+#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib/crtn.o
+
+#else /* !__FreeBSD__ */
+
#undef START_FILES
#define START_FILES pre-crt0.o /usr/lib64/crt1.o /usr/lib64/crti.o
+/* The duplicate -lgcc is intentional in the definition of LIB_STANDARD.
+ The reason is that some functions in libgcc.a call functions from libc.a,
+ and some libc.a functions need functions from libgcc.a. Since most
+ versions of ld are one-pass linkers, we need to mention -lgcc twice,
+ or else we risk getting unresolved externals. */
#undef LIB_STANDARD
#define LIB_STANDARD -lgcc -lc -lgcc /usr/lib64/crtn.o
+
+#endif /* __FreeBSD__ */
/* arch-tag: 8a5e001d-e12e-4692-a3a6-0b15ba271c6e
(do not change this comment) */
%%%
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-28 18:09 ` Richard M. Stallman
2005-10-28 22:01 ` Giorgos Keramidas
@ 2005-10-29 10:07 ` Eli Zaretskii
2005-10-29 18:35 ` Giorgos Keramidas
2005-10-29 20:33 ` Richard M. Stallman
1 sibling, 2 replies; 17+ messages in thread
From: Eli Zaretskii @ 2005-10-29 10:07 UTC (permalink / raw)
Cc: ich, emacs-devel
> From: "Richard M. Stallman" <rms@gnu.org>
> Date: Fri, 28 Oct 2005 14:09:06 -0400
> Cc: emacs-devel@gnu.org
>
> > Yes, and they both are almost certainly needed. The reason is that
> > some functions in libgcc.a call functions from libc.a, and some libc.a
> > functions need functions from libgcc.a. Since most versions of ld are
> > one-pass linkers, you need to mention -lgcc twice, or else risk
> > getting unresolved externals.
>
> Someone should add a comment above that line
> to explain this.
I don't object to such a comment, of course, but I thought this was
common knowledge. E.g., anyone who has ever invoked GCC with the -v
option to build a C program already knows that GCC mentions -lgcc
twice on the linker's command line.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-29 10:07 ` Eli Zaretskii
@ 2005-10-29 18:35 ` Giorgos Keramidas
2005-10-29 20:33 ` Richard M. Stallman
1 sibling, 0 replies; 17+ messages in thread
From: Giorgos Keramidas @ 2005-10-29 18:35 UTC (permalink / raw)
Cc: emacs-devel, rms, ich
On 2005-10-29 12:07, Eli Zaretskii <eliz@gnu.org> wrote:
>Richard M. Stallman <rms@gnu.org> wrote:
>>> Yes, and they both are almost certainly needed. The reason is that
>>> some functions in libgcc.a call functions from libc.a, and some
>>> libc.a functions need functions from libgcc.a. Since most versions
>>> of ld are one-pass linkers, you need to mention -lgcc twice, or else
>>> risk getting unresolved externals.
>>
>> Someone should add a comment above that line
>> to explain this.
>
> I don't object to such a comment, of course, but I thought this
> was common knowledge. E.g., anyone who has ever invoked GCC
> with the -v option to build a C program already knows that GCC
> mentions -lgcc twice on the linker's command line.
The original suggestion for a comment was triggered from my own
comment that the duplicate -lgcc was probably intentional, but I
didn't know the reason. Now I know the answer, but it may still
be worth to document it near the relevant part of the source ;-)
- Giorgos
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-29 10:07 ` Eli Zaretskii
2005-10-29 18:35 ` Giorgos Keramidas
@ 2005-10-29 20:33 ` Richard M. Stallman
1 sibling, 0 replies; 17+ messages in thread
From: Richard M. Stallman @ 2005-10-29 20:33 UTC (permalink / raw)
Cc: ich, emacs-devel
> Someone should add a comment above that line
> to explain this.
I don't object to such a comment, of course, but I thought this was
common knowledge.
Hardly! It is rather obscure.
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-26 23:52 RFC: Support for FreeBSD/amd64 Giorgos Keramidas
2005-10-27 3:58 ` Richard M. Stallman
2005-10-27 6:50 ` Frank Schmitt
@ 2005-10-27 12:27 ` Dryice Liu
2005-10-27 14:57 ` Giorgos Keramidas
2 siblings, 1 reply; 17+ messages in thread
From: Dryice Liu @ 2005-10-27 12:27 UTC (permalink / raw)
[-- Attachment #1.1: Type: text/plain, Size: 666 bytes --]
Giorgos Keramidas <keramida@ceid.upatras.gr> wrote:
> To bootstrap Emacs on my FreeBSD/amd64 snapshot I had to use the
> following patch -- also available at:
> http://people.freebsd.org/~keramida/emacs/22/freebsd-amd64.diff
> + x86_64-*-freebsd*) machine=amdx86-64 ;;
Thanks for the patch! And on my FreeBSD-5.4 amd64 with the CVS today I
need to change this line to
+ amd64-*-freebsd*) machine=amdx86-64 ;;
to make it work. Maybe we could add both of these two lines.
--
Dryice @ http://dryice.3322.org
Please avoid sending me Word or PowerPoint attachments.
See http://www.gnu.org/philosophy/sylvester-response.html
[-- Attachment #1.2: Type: application/pgp-signature, Size: 186 bytes --]
[-- Attachment #2: Type: text/plain, Size: 142 bytes --]
_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel
^ permalink raw reply [flat|nested] 17+ messages in thread
* Re: RFC: Support for FreeBSD/amd64
2005-10-27 12:27 ` Dryice Liu
@ 2005-10-27 14:57 ` Giorgos Keramidas
0 siblings, 0 replies; 17+ messages in thread
From: Giorgos Keramidas @ 2005-10-27 14:57 UTC (permalink / raw)
Cc: emacs-devel
On 2005-10-27 20:27, Dryice Liu <dryiceliu@gmail.com> wrote:
>Giorgos Keramidas <keramida@ceid.upatras.gr> wrote:
>> To bootstrap Emacs on my FreeBSD/amd64 snapshot I had to use the
>> following patch -- also available at:
>> http://people.freebsd.org/~keramida/emacs/22/freebsd-amd64.diff
>> + x86_64-*-freebsd*) machine=amdx86-64 ;;
>
> Thanks for the patch! And on my FreeBSD-5.4 amd64 with the CVS today I
> need to change this line to
>
> + amd64-*-freebsd*) machine=amdx86-64 ;;
>
> to make it work. Maybe we could add both of these two lines.
No objection from me. Something like this would be fine, I guess:
+ x86_64-*-freebsd*|amd64-*-freebsd*)
+ machine=amdx86-64 ;;
^ permalink raw reply [flat|nested] 17+ messages in thread
end of thread, other threads:[~2005-10-30 3:36 UTC | newest]
Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-26 23:52 RFC: Support for FreeBSD/amd64 Giorgos Keramidas
2005-10-27 3:58 ` Richard M. Stallman
2005-10-27 6:50 ` Frank Schmitt
2005-10-27 11:50 ` Giorgos Keramidas
2005-10-27 19:08 ` Eli Zaretskii
2005-10-27 20:13 ` Giorgos Keramidas
2005-10-27 20:56 ` Frank Schmitt
2005-10-28 18:09 ` Richard M. Stallman
2005-10-28 22:01 ` Giorgos Keramidas
2005-10-29 5:12 ` Richard M. Stallman
2005-10-29 14:47 ` Giorgos Keramidas
2005-10-30 3:36 ` Richard M. Stallman
2005-10-29 10:07 ` Eli Zaretskii
2005-10-29 18:35 ` Giorgos Keramidas
2005-10-29 20:33 ` Richard M. Stallman
2005-10-27 12:27 ` Dryice Liu
2005-10-27 14:57 ` Giorgos Keramidas
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).