delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2000/12/29/06:55:33

Message-Id: <5.0.2.1.0.20001229065313.00a50220@pop5.banet.net>
X-Sender: usbanet DOT farley3 AT pop5 DOT banet DOT net
X-Mailer: QUALCOMM Windows Eudora Version 5.0.2
Date: Fri, 29 Dec 2000 06:56:55 -0500
To: djgpp-workers AT delorie DOT com
From: "Peter J. Farley III" <pjfarley AT banet DOT net>
Subject: fcntl locking changes #3: ljmp/lcall patches for gcc 2.952
Mime-Version: 1.0
Reply-To: djgpp-workers AT delorie DOT com

--=====================_12360990==_
Content-Type: text/plain; charset="us-ascii"; format=flowed

Here are the fixes to src/makefile.inc and three source files to fix 
complaints about indirect ljmp/lcall statements by gcc 2.952.

--=====================_12360990==_
Content-Type: text/plain; charset="us-ascii"

diff -ruN djgpp-cvs/src/debug/common/dbgcom.c djgpp/src/debug/common/dbgcom.c
--- djgpp-cvs/src/debug/common/dbgcom.c	Mon Oct 11 07:34:18 1999
+++ djgpp/src/debug/common/dbgcom.c	Mon Dec 11 21:56:58 2000
@@ -458,9 +458,16 @@
 _get_exception_handler:                                                 \n\
         pushl   %eax                                                    \n\
 	pushf								\n\
-	.byte	0x2e							\n\
-	lcall	_old_i31						\n\
-        popl   %eax                                                     \n\
+	.byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	popl   %eax                                                     \n\
 	jc	Lc31_set_flags_and_iret					\n\
         pushl   %eax                                                    \n\
         push    %es                                                     \n\
@@ -487,9 +494,16 @@
         pop   %ds                                                       \n\
         pop   %es                                                       \n\
         popl  %eax                                                      \n\
-        .byte 0x2e                                                      \n\
-        ljmp _old_i31                                                   \n\
-        ret                                                             \n"
+        .byte 0x2e                                                      \n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	ljmp	_old_i31						\n\
+"
+#else
+"	ljmp	*_old_i31						\n\
+"
+#endif
+"	ret                                                             \n"
 ); 
 
 /* Change a handle in the list: EAX is the old handle, EDX is the new */
@@ -562,9 +576,16 @@
 	pushl	%eax							\n\
 	movw	$0x0003,%ax						\n\
 	pushf								\n\
-	.byte	0x2e							\n\
-	lcall	_old_i31						\n\
-	movw	%ax,%bx							\n\
+	.byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	movw	%ax,%bx							\n\
 	popl	%eax							\n\
 	pushl	%eax							\n\
 	movw	%ax,%dx							\n\
@@ -691,9 +712,16 @@
 	cmpw	$0x0503,%ax						\n\
 	je	Lc31_resize_mem						\n\
 L_jmp_to_old_i31:                                                       \n\
-        .byte	0x2e							\n\
-	ljmp	_old_i31						\n\
-Lc31_set_flags_and_iret:                                                \n\
+        .byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	ljmp	_old_i31						\n\
+"
+#else
+"	ljmp	*_old_i31						\n\
+"
+#endif
+"Lc31_set_flags_and_iret:                                                \n\
         pushl	%eax				                        \n\
 	pushf								\n\
 	popl	%eax		/* store the right flags for iret */	\n\
@@ -732,9 +760,16 @@
 	cmpw	_app_ds,%bx					        \n\
 	jne	L_jmp_to_old_i31					\n\
 	pushf								\n\
-	.byte	0x2e							\n\
-	lcall	_old_i31						\n\
-	call	___djgpp_save_interrupt_regs				\n\
+	.byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	call	___djgpp_save_interrupt_regs				\n\
 	call	__clear_break_DPMI					\n\
 	call	__set_break_DPMI					\n\
 	movl	___djgpp_exception_state_ptr,%eax			\n\
@@ -753,9 +788,16 @@
 	jmp	L_jmp_to_old_i31					\n\
 Lc31_alloc_mem:								\n\
 	pushf								\n\
-	.byte	0x2e							\n\
-	lcall	_old_i31						\n\
-	jc	Lc31_set_flags_and_iret					\n\
+	.byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	jc	Lc31_set_flags_and_iret					\n\
 	pushf								\n\
 	pushl	%edx							\n\
 	pushw	%si							\n\
@@ -771,9 +813,16 @@
 	pushw	%si							\n\
 	pushw	%di							\n\
 	pushf								\n\
-	.byte	0x2e							\n\
-	lcall	_old_i31						\n\
-	jc	Lc31_resize_mem_error					\n\
+	.byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	jc	Lc31_resize_mem_error					\n\
 	popl	%eax							\n\
 	push	%edx							\n\
 	xorl	%edx,%edx						\n\
@@ -785,9 +834,16 @@
 	pushw	%si							\n\
 	pushw	%di							\n\
 	pushf								\n\
-	.byte	0x2e							\n\
-	lcall	_old_i31						\n\
-	jnc	Lc31_resize_mem_ok					\n\
+	.byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	jnc	Lc31_resize_mem_ok					\n\
 Lc31_resize_mem_error:							\n\
 	addl	$4,%esp							\n\
 	stc								\n\
@@ -803,9 +859,16 @@
 Lc31_alloc_descriptors:							\n\
 	pushl	%ecx							\n\
 	pushf								\n\
-	.byte	0x2e							\n\
-	lcall	_old_i31						\n\
-	popl	%ecx							\n\
+	.byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	popl	%ecx							\n\
 	jc	Lc31_set_flags_and_iret					\n\
 	call	_add_descriptors					\n\
 	clc								\n\
@@ -813,9 +876,16 @@
 Lc31_free_descriptor:							\n\
 	pushl	%ebx							\n\
 	pushf								\n\
-	.byte	0x2e							\n\
-	lcall	_old_i31						\n\
-	popl	%eax							\n\
+	.byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	popl	%eax							\n\
 	jc	Lc31_set_flags_and_iret					\n\
 	push	%edx							\n\
 	xorw	%dx,%dx							\n\
@@ -825,9 +895,16 @@
 	jmp	Lc31_set_flags_and_iret					\n\
 Lc31_create_alias_descriptor:						\n\
 	pushf								\n\
-	.byte	0x2e							\n\
-	lcall	_old_i31						\n\
-	jc	Lc31_set_flags_and_iret					\n\
+	.byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	jc	Lc31_set_flags_and_iret					\n\
 	pushl	%eax							\n\
 	push	%edx							\n\
 	movw	%ax,%dx							\n\
@@ -839,9 +916,16 @@
 	jmp	Lc31_set_flags_and_iret					\n\
 Lc31_allocate_dos_memory:						\n\
 	pushf								\n\
-	.byte	0x2e							\n\
-	lcall	_old_i31						\n\
-	jc	Lc31_set_flags_and_iret					\n\
+	.byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	jc	Lc31_set_flags_and_iret					\n\
 	pushl	%eax							\n\
 	xorl	%eax,%eax						\n\
 	call	_change_dos_descriptor					\n\
@@ -851,9 +935,16 @@
 Lc31_free_dos_memory:							\n\
 	pushl	%edx							\n\
 	pushf								\n\
-	.byte	0x2e							\n\
-	lcall	_old_i31						\n\
-	popl	%eax							\n\
+	.byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	popl	%eax							\n\
 	jc	Lc31_set_flags_and_iret					\n\
 	xorw	%dx,%dx							\n\
 	call	_change_dos_descriptor					\n\
@@ -865,18 +956,32 @@
         pushl  %ecx                                                     \n\
         pushl  %edx                                                     \n\
         pushf                                                           \n\
-        .byte  0x2e                                                     \n\
-        lcall   _old_i31                                                \n\
-        popl   %edx                                                     \n\
+        .byte  0x2e                                                     \n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	popl   %edx                                                     \n\
         popl   %ecx                                                     \n\
         popl   %ebx                                                     \n\
         popl   %eax                                                     \n\
         jc   Lc31_set_flags_and_iret                                    \n\
         call   _change_exception_handler                                \n\
         pushf                                                           \n\
-        .byte  0x2e                                                     \n\
-        lcall   _old_i31                                                \n\
-        jmp Lc31_set_flags_and_iret                                     \n\
+        .byte  0x2e                                                     \n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	lcall	_old_i31						\n\
+"
+#else
+"	lcall	*_old_i31						\n\
+"
+#endif
+"	jmp Lc31_set_flags_and_iret                                     \n\
 	.balign  16,,7							\n\
         .globl  _dbgcom_hook_i21                                        \n\
 _dbgcom_hook_i21:                                                       \n\
@@ -884,9 +989,16 @@
 	cmpb	$0x4c,%ah						\n\
 	je	Lc21							\n\
 Lc21_jmp_to_old:                                                        \n\
-        .byte	0x2e							\n\
-	ljmp	_old_i21						\n\
-Lc21:	push	%eax							\n\
+        .byte	0x2e							\n"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	ljmp	_old_i21						\n\
+"
+#else
+"	ljmp	*_old_i21						\n\
+"
+#endif
+"Lc21:	push	%eax							\n\
 	movl	8(%esp),%eax						\n\
 	cs								\n\
 	cmpw	_app_exit_cs,%ax					\n\
@@ -1002,9 +1114,14 @@
 /* do not set limit of ds selector two times */
 asm (".text
         .global ___dbgcom_kbd_hdlr
-___dbgcom_kbd_hdlr:
-        ljmp    %cs:___djgpp_old_kbd");
-        
+___dbgcom_kbd_hdlr:"
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
+"	ljmp    %cs:___djgpp_old_kbd");
+#else
+"	ljmp    *%cs:___djgpp_old_kbd");
+#endif
+
     
     
 static void unhook_dpmi(void)
diff -ruN djgpp-cvs/src/libc/crt0/crt0.S djgpp/src/libc/crt0/crt0.S
--- djgpp-cvs/src/libc/crt0/crt0.S	Tue May 30 14:09:12 2000
+++ djgpp/src/libc/crt0/crt0.S	Mon Dec 11 21:56:58 2000
@@ -366,7 +366,12 @@
 	movw	%cs, %bx
 /* Call exit procedure with BX=32-bit CS; SI+DI=32-bit handle; DL=exit status */
 	.byte 0x2e
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
 	ljmp	sbrk16_api_ofs
+#else
+	ljmp	*sbrk16_api_ofs
+#endif
 
 /*-----------------------------------------------------------------------------*/
 
@@ -455,7 +460,12 @@
 	int	$0x31
 	pushl	%eax
 
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
 	lcall	sbrk16_api_ofs
+#else
+	lcall	*sbrk16_api_ofs
+#endif
 	setc	%dl						/* Save carry */
 
 	popl	%eax					/* restore interrupts */
diff -ruN djgpp-cvs/src/libc/go32/exceptn.S djgpp/src/libc/go32/exceptn.S
--- djgpp-cvs/src/libc/go32/exceptn.S	Tue May 30 14:14:08 2000
+++ djgpp/src/libc/go32/exceptn.S	Fri Dec 29 04:07:04 2000
@@ -348,7 +348,12 @@
 	popl	%ds
 	popl	%ebx
 	popl	%eax
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
 	ljmp	%cs:___djgpp_old_kbd
+#else
+	ljmp	*%cs:___djgpp_old_kbd
+#endif
 
 	.balign 16,,7
 	.global	___djgpp_kbd_hdlr_pc98
@@ -400,7 +405,12 @@
    	.byte	0x2e				/* CS: */
 	testb	$4, ___djgpp_hwint_flags	/* IRET or chain? */
 	jne	2f
+#if    (GAS_MAJOR == 2) \
+    && ((GAS_MINOR < 9) || ((GAS_MINOR == 9) && (GAS_MINORMINOR < 5)))
 	ljmp	%cs:___djgpp_old_timer
+#else
+	ljmp	*%cs:___djgpp_old_timer
+#endif
 2:
 	pushl	%eax
 	movb	$0x20,%al			/* EOI the interrupt */
diff -ruN djgpp-cvs/src/makefile.inc djgpp/src/makefile.inc
--- djgpp-cvs/src/makefile.inc	Mon Sep  7 14:12:10 1998
+++ djgpp/src/makefile.inc	Mon Dec 11 21:56:58 2000
@@ -1,3 +1,4 @@
+# Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details
 # Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details
 # -*- makefile -*-
 
@@ -7,12 +8,58 @@
 
 .SUFFIXES: .o .i .c .cc .s
 
+# Set $(GCC{L}_OPT) here so they are defined before first use
+#
+ifeq ($(CROSS_BUILD),1)
+GCC_OPT := $(shell cat $(TOP)/../gcc.opt)
+GCCL_OPT := $(shell cat $(TOP)/../gcc-l.opt)
+endif
+
+# Set $(AS) before first use
+#
+AS := $(shell $(CROSS_GCC) $(GCC_OPT) -print-prog-name=as)
+AS := $(subst \,/,$(AS))
+
+# These were suggested by Tim Van Holder <tim DOT van DOT holder AT pandora DOT be>
+# but since $(CROSS_LD) is set in makefile.def and $(LD) is not used
+# anywhere, they seem not very useful at this time.
+#
+#LD := $(shell $(CROSS_GCC) $(GCC_OPT) -print-prog-name=ld)
+#LD := $(subst \,/,$(LD))
+
+# Figure out GAS version for use in *.S and inline asm compile flags
+#
+GAS_VERSION    := $(subst ., ,$(shell $(AS) --version))
+GAS_MAJOR      := $(word 3,$(GAS_VERSION))
+GAS_MINOR      := $(word 4,$(GAS_VERSION))
+GAS_MINORMINOR := $(word 5,$(GAS_VERSION))
+
+# Defaults for GAS version numbers
+ifeq ($(GAS_MAJOR),)
+GAS_MAJOR := 0
+endif
+ifeq ($(GAS_MINOR),)
+GAS_MINOR := 0
+endif
+ifeq ($(GAS_MINORMINOR),)
+GAS_MINORMINOR := 0
+endif
+
+# Pass defines as compiler/assembler switches
+CFLAGS += -DGAS_MAJOR=$(GAS_MAJOR)
+CFLAGS += -DGAS_MINOR=$(GAS_MINOR)
+CFLAGS += -DGAS_MINORMINOR=$(GAS_MINORMINOR)
+
+ASFLAGS += -DGAS_MAJOR=$(GAS_MAJOR)
+ASFLAGS += -DGAS_MINOR=$(GAS_MINOR)
+ASFLAGS += -DGAS_MINORMINOR=$(GAS_MINORMINOR)
+
+# Moved setting of $(GCC{L}_OPT) to top of file
+#
 ifneq ($(CROSS_BUILD),1)
 XGCC = $(CROSS_GCC) @$(TOP)/../gcc.opt -I. -I- -I$(TOP)/../../include $(CFLAGS)
 XLGCC = $(CROSS_GCC) -s @$(TOP)/../gcc-l.opt -I. -I- -I$(TOP)/../../include $(CFLAGS)
 else
-GCC_OPT := $(shell cat $(TOP)/../gcc.opt)
-GCCL_OPT := $(shell cat $(TOP)/../gcc-l.opt)
 XGCC = $(CROSS_GCC) $(GCC_OPT) -I. -I- -I$(TOP)/../../include $(CFLAGS)
 XLGCC = $(CROSS_GCC) $(GCCL_OPT) -I. -I- -I$(TOP)/../../include $(CFLAGS)
 endif
@@ -59,13 +106,13 @@
 L = $(LIB)/libc.a
 
 ifeq ($(LIBGCCA),)
-LIBGCCA := $(shell $(CROSS_GCC) -print-file-name=libgcc.a)
+LIBGCCA := $(shell $(CROSS_GCC) $(GCC_OPT) -print-file-name=libgcc.a)
 LIBGCCA := $(subst \,/,$(LIBGCCA))
 export LIBGCCA
 endif
 
 ifeq ($(DJGPP_DJL),)
-DJGPP_DJL := $(shell $(CROSS_GCC) -print-file-name=djgpp.djl)
+DJGPP_DJL := $(shell $(CROSS_GCC) $(GCC_OPT) -print-file-name=djgpp.djl)
 DJGPP_DJL := $(subst \,/,$(DJGPP_DJL))
 export DJGPP_DJL
 endif

--=====================_12360990==_
Content-Type: text/plain; charset="us-ascii"; format=flowed

---------------------------------------------------------
Peter J. Farley III (pjfarley AT dorsai DOT org OR
                      pjfarley AT banet DOT net)
--=====================_12360990==_--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019