On Sat, Feb 05, 2000 at 01:48:20AM +0100, Jan Vroonhof wrote:
Zack Weinberg <zack(a)wolery.cumb.org> writes:
> A lot of the code in the lib-src directory needed to be worked over
> before it would compile. I can send the patch if anyone cares.
Please send the patch to xemacs-patches(a)xemacs.org anyway, if it isn't
much trouble. I am not sure whether it would be possible to apply it
all (at least some of the lib-src stuff is third part maintained). It
would be a waste to loose any work that you have already done.
I shall do so under separate cover.
Also, I recompiled with g++ in current CVS (roughly the 20000204
snapshot), and both temacs and the xemacs it dumps work correctly
(well, I didn't do anything with xemacs except start it up).
Given that Martin was running temacs under the debugger in batch
mode, I think the actual miscompilation was that message_internal was
calling echo_area_append when it should have been calling
write_string_to_stdio_stream.
Odds are that the bug was fixed by this patch:
2000-02-04 Richard Henderson <rth(a)cygnus.com>
* function.c (diddle_return_value): Rework to use a callback function.
Use current_function_return_rtx if it's been set up.
(do_clobber_return_reg, clobber_return_register): New.
(do_use_return_reg, use_return_register): New.
(expand_function_end): Use them.
* stmt.c (expand_null_return): Likewise.
* function.h: Declare them.
* flow.c (mark_regs_live_at_end): Use diddle_return_value.
(mark_reg): Change arguments as appropriate for callback.
* integrate.c (expand_inline_function): Revert 19 Jan change.
> The makefile attempts to link temacs by hand and gets it
horribly
> wrong, causing the built temacs to crash inside libc startup code.
>
> You're doing something like gcc -nostdlib pre-crt0.o /usr/lib/crt1.o
> /usr/lib/crti.o <objects> <X libraries> -ldl -lgcc /usr/lib/crtn.o
For me the link looks like (plain Redhat 6.0 with egcs 1.1.2)
gcc -nostdlib -L/usr/X11R6/lib -o temacs pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o
<objects> ../lwlib/liblw.a -lXaw3d -ltiff -lpng -ljpeg -lz -lcompface -lXpm -lXmu
-lXt -lXext -lX11 -lSM -lICE -ldl -ldb -lgpm -lncurses -L/usr/lib -lesd -laudiofile -lm
-lm -lgcc -lc -lgcc /usr/lib/crtn.o `gcc -print-libgcc-file-name`
Note the ugly "-lm -lm -lgcc -lc -lgcc" part. I am fairly sure the -lc
comes explicitly from
dnl Non-ordinary link usually requires -lc
test "$ordinary_link" = "no" -a -z "$libs_standard"
&& libs_standard="-lc"
Weird. Mine didn't do that, and it works if I do it that way. (The
key is the inclusion of /usr/lib/crtn.o.)
> First off, -nostdlib doesn't turn off automatic linking with
crt1 in
> all versions of gcc. You need -nostartfiles too.
Are you sure? I would call it a bug then. The phrase
`-nostdlib'
Do not use the standard system startup files or libraries when
linking. No startup files and only the libraries you specify will
be passed to the linker.
The versions I was thinking of are _ancient_. I only know about the
problem because of historical cruft in glibc's Makefiles. But a
little extra paranoia never hurt anyone.
Anyway. I hate that stuff too (because it makes it harder to enable
profiling). However it is there for a reason, so it must have been
necessary at least in the past on some platform.
Hrm. ORDINARY_LINK should be safe for LINUX_ELF, provided you define
DATA_START as well... My suggested patch follows.
zw
===================================================================
Index: src/s/linux.h
--- src/s/linux.h 1999/07/06 07:33:05 1.11.2.2
+++ src/s/linux.h 2000/02/05 02:42:06
@@ -84,20 +84,21 @@ Boston, MA 02111-1307, USA. */
#endif /* !_IO_STDIO_H */
#endif /* C_CODE */
-/* Ask GCC where to find libgcc.a. */
-#define LIB_GCC "`$(CC) $(C_SWITCH_X_SITE) -print-libgcc-file-name`"
+#ifdef LINUX_ELF
+
+#define UNEXEC "unexelf.o"
+#define UNEXEC_USE_MAP_PRIVATE
+#define DATA_START ({ extern int data_start; (char *) &data_start; })
+#define ORDINARY_LINK
-#ifndef LINUX_ELF
+#else
+
/* Linux has crt0.o in a non-standard place */
#define START_FILES "pre-crt0.o /usr/lib/crt0.o"
-#else
-/**/
-#if defined(__linux__) && defined(powerpc) /*Added by Fukui*/
-#define START_FILES /*Added by Fukui*/
-#else /*Added by Fukui*/
+#define LIB_STANDARD "-lc" /* avoid -lPW */
+#define LIB_GCC "-lgcc"
+#define LINKER "$(CC) -nostdlib"
-#define START_FILES "pre-crt0.o /usr/lib/crt1.o /usr/lib/crti.o"
-#endif /*Added by Fukui*/
#endif
/* This is needed for sysdep.c */
@@ -112,14 +113,6 @@ Boston, MA 02111-1307, USA. */
/* Best not to include -lg, unless it is last on the command line */
#define LIBS_DEBUG
#define LIBS_TERMCAP "-ltermcap -lcurses" /* save some space with shared
libs*/
-#ifndef LINUX_ELF
-#define LIB_STANDARD "-lc" /* avoid -lPW */
-#else
-/*#undef LIB_GCC
- #define LIB_GCC*/
-#define LIB_STANDARD "-lgcc -lc -lgcc /usr/lib/crtn.o"
-#define LINKER "$(CC) -nostdlib"
-#endif
#ifdef TERM
#define LIBS_SYSTEM "-lclient"
@@ -129,26 +122,6 @@ Boston, MA 02111-1307, USA. */
since libc-4.4.1. So -lipc was deleted. */
#define LIBS_SYSTEM
#endif
-
-#ifdef LINUX_ELF
-#define UNEXEC "unexelf.o"
-#define UNEXEC_USE_MAP_PRIVATE
-#if 0
-/* mrb - Ordinary link is simple and effective */
-/* slb - Not any more ... :-( */
-#define ORDINARY_LINK
-#endif /* 0 */
-
-/* I still think ORDINARY_LINK should be the default, but since slb
- insists, ORDINARY_LINK will stay on until we expunge the dump code.
- However, the user (i.e. me!) should be able to specify ORDINARY_LINK via
- configure --cppflags=-DORDINARY_LINK ... */
-#ifdef ORDINARY_LINK
-#undef LIB_STANDARD
-#undef START_FILES
-#undef LIB_GCC
-#endif
-#endif /* LINUX_ELF */
#ifdef LINUX_QMAGIC
===================================================================