public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: Add .type pseudo-op to 68K soft-float routines
@ 2007-07-29 21:06 Mark Mitchell
  2007-07-30 10:32 ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Mitchell @ 2007-07-29 21:06 UTC (permalink / raw)
  To: gcc-patches; +Cc: law, schwab


When building for soft-float GNU/Linux, we use the software
floating-point emulation routines in lb1sf68.asm.  The symbols for
these routines had ELF symbol type STT_NOTYPE because the .asm file
did not include any explicit .type pseudo-ops.  The linker complains
about that when linking with a shared libgcc.

This patch adds .type directives to the various entry points defined
in the file.  Because there are non-ELF 68K ports, we can't do this
unconditionally.  So, I used a preprocessor test on __ELF__ (as is
also done in the ARM port) to decide whether or not to issue the .type
directive.

I wasn't able to fully test this patch because I don't have soft-float
68K hardware.  However, I did test that small programs that didn't
link without the patch do link afterwards.  I also verified that there
are no longer any exported STT_NOTYPE symbols in libgcc_s.so.

If there are no objections from the 68K maintainers, I will commit
this in 48 hours.

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

2007-07-29  Mark Mitchell  <mark@codesourcery.com>

	gcc/
	* config/m68k/lb1sf68.asm (FUNC): New macro.
	(__mulsi3): Use it.
	(__udivsi3): Likewise.
	(__divsi3): Likewise.
	(__umodsi3): Likewise.
	(__modsi3): Likewise.
	(__subdf3): Likewise.
	(__adddf3): Likewise.
	(__muldf3): Likewise.
	(__divdf3): Likewise.
	(__negdf2): Likewise.
	(__cmpdf2): Likewise.
	(__subsf3): Likewise.
	(__addsf3): Likewise.
	(__mulsf3): Likewise.
	(__divsf3): Likewise.
	(__negsf2): Likewise.
	(__cmpsf2): Likewise.
	(__eqdf2): Likewise.
	(__nedf2): Likewise.
	(__gtdf2): Likewise.
	(__gedf2): Likewise.
	(__ltdf2): Likewise.
	(__ledf2): Likewise.
	(__eqsf2): Likewise.
	(__nesf2): Likewise.
	(__gtsf2): Likewise.
	(__gesf2): Likewise.
	(__ltsf2): Likewise.
	(__lesf2): Likewise.

# gcc diff
pushd /home/mitchell/scratch/cf-elf/src/gcc-4.2
svn diff
Index: gcc/config/m68k/lb1sf68.asm
===================================================================
--- gcc/config/m68k/lb1sf68.asm	(revision 177048)
+++ gcc/config/m68k/lb1sf68.asm	(working copy)
@@ -61,6 +61,17 @@ Boston, MA 02110-1301, USA.  */
 
 #define SYM(x) CONCAT1 (__USER_LABEL_PREFIX__, x)
 
+/* Note that X is a function.  */
+	
+#ifdef __ELF__
+#define FUNC(x) .type SYM(x),function
+#else
+/* The .proc pseudo-op is accepted, but ignored, by GAS.  We could just		  define this to the empty string for non-ELF systems, but defining it
+   to .proc means that the information is available to the assembler if
+   the need arises.  */
+#define FUNC(x) .proc
+#endif
+		
 /* Use the right prefix for registers.  */
 
 #define REG(x) CONCAT1 (__REGISTER_PREFIX__, x)
@@ -377,7 +388,7 @@ $_exception_handler:
 
 #ifdef  L_mulsi3
 	.text
-	.proc
+	FUNC(__mulsi3)
 	.globl	SYM (__mulsi3)
 SYM (__mulsi3):
 	movew	sp@(4), d0	/* x0 -> d0 */
@@ -400,7 +411,7 @@ SYM (__mulsi3):
 
 #ifdef  L_udivsi3
 	.text
-	.proc
+	FUNC(__udivsi3)
 	.globl	SYM (__udivsi3)
 SYM (__udivsi3):
 #ifndef __mcoldfire__
@@ -476,7 +487,7 @@ L2:	subql	IMM (1),d4
 
 #ifdef  L_divsi3
 	.text
-	.proc
+	FUNC(__divsi3)
 	.globl	SYM (__divsi3)
 SYM (__divsi3):
 	movel	d2, sp@-
@@ -514,7 +525,7 @@ L3:	movel	sp@+, d2
 
 #ifdef  L_umodsi3
 	.text
-	.proc
+	FUNC(__umodsi3)
 	.globl	SYM (__umodsi3)
 SYM (__umodsi3):
 	movel	sp@(8), d1	/* d1 = divisor */
@@ -540,7 +551,7 @@ SYM (__umodsi3):
 
 #ifdef  L_modsi3
 	.text
-	.proc
+	FUNC(__modsi3)
 	.globl	SYM (__modsi3)
 SYM (__modsi3):
 	movel	sp@(8), d1	/* d1 = divisor */
@@ -683,6 +694,7 @@ Ld$div$0:
 |=============================================================================
 
 | double __subdf3(double, double);
+	FUNC(__subdf3)
 SYM (__subdf3):
 	bchg	IMM (31),sp@(12) | change sign of second operand
 				| and fall through, so we always add
@@ -691,6 +703,7 @@ SYM (__subdf3):
 |=============================================================================
 
 | double __adddf3(double, double);
+	FUNC(__adddf3)
 SYM (__adddf3):
 #ifndef __mcoldfire__
 	link	a6,IMM (0)	| everything will be done in registers
@@ -1414,6 +1427,7 @@ Ladddf$nf:
 |=============================================================================
 
 | double __muldf3(double, double);
+	FUNC(__muldf3)
 SYM (__muldf3):
 #ifndef __mcoldfire__
 	link	a6,IMM (0)
@@ -1746,6 +1760,7 @@ Lmuldf$b$den:
 |=============================================================================
 
 | double __divdf3(double, double);
+	FUNC(__divdf3)
 SYM (__divdf3):
 #ifndef __mcoldfire__
 	link	a6,IMM (0)
@@ -2187,6 +2202,7 @@ Lround$0:
 |=============================================================================
 
 | double __negdf2(double, double);
+	FUNC(__negdf2)
 SYM (__negdf2):
 #ifndef __mcoldfire__
 	link	a6,IMM (0)
@@ -2359,6 +2375,7 @@ Lcmpd$inop:
 	PICJUMP	$_exception_handler
 
 | int __cmpdf2(double, double);
+	FUNC(__cmpdf2)
 SYM (__cmpdf2):
 	link	a6,IMM (0)
 	pea	1
@@ -2587,6 +2604,7 @@ Lf$div$0:
 |=============================================================================
 
 | float __subsf3(float, float);
+	FUNC(__subsf3)
 SYM (__subsf3):
 	bchg	IMM (31),sp@(8)	| change sign of second operand
 				| and fall through
@@ -2595,6 +2613,7 @@ SYM (__subsf3):
 |=============================================================================
 
 | float __addsf3(float, float);
+	FUNC(__addsf3)
 SYM (__addsf3):
 #ifndef __mcoldfire__
 	link	a6,IMM (0)	| everything will be done in registers
@@ -3081,6 +3100,7 @@ Laddsf$nf:
 |=============================================================================
 
 | float __mulsf3(float, float);
+	FUNC(__mulsf3)
 SYM (__mulsf3):
 #ifndef __mcoldfire__
 	link	a6,IMM (0)
@@ -3295,6 +3315,7 @@ Lmulsf$b$den:
 |=============================================================================
 
 | float __divsf3(float, float);
+	FUNC(__divsf3)
 SYM (__divsf3):
 #ifndef __mcoldfire__
 	link	a6,IMM (0)
@@ -3620,6 +3641,7 @@ Lround$0:
 | and +/-INFINITY.
 
 | float __negsf2(float);
+	FUNC(__negsf2)
 SYM (__negsf2):
 #ifndef __mcoldfire__
 	link	a6,IMM (0)
@@ -3761,6 +3783,7 @@ Lcmpf$inop:
 	PICJUMP	$_exception_handler
 
 | int __cmpsf2(float, float);
+	FUNC(__cmpsf2)
 SYM (__cmpsf2):
 	link	a6,IMM (0)
 	pea	1
@@ -3859,7 +3882,7 @@ Lround$to$minus:
 
 #ifdef  L_eqdf2
 	.text
-	.proc
+	FUNC(__eqdf2)
 	.globl	SYM (__eqdf2)
 SYM (__eqdf2):
 	link	a6,IMM (0)
@@ -3875,7 +3898,7 @@ SYM (__eqdf2):
 
 #ifdef  L_nedf2
 	.text
-	.proc
+	FUNC(__nedf2)
 	.globl	SYM (__nedf2)
 SYM (__nedf2):
 	link	a6,IMM (0)
@@ -3891,7 +3914,7 @@ SYM (__nedf2):
 
 #ifdef  L_gtdf2
 	.text
-	.proc
+	FUNC(__gtdf2)
 	.globl	SYM (__gtdf2)
 SYM (__gtdf2):
 	link	a6,IMM (0)
@@ -3907,7 +3930,7 @@ SYM (__gtdf2):
 
 #ifdef  L_gedf2
 	.text
-	.proc
+	FUNC(__gedf2)
 	.globl	SYM (__gedf2)
 SYM (__gedf2):
 	link	a6,IMM (0)
@@ -3923,7 +3946,7 @@ SYM (__gedf2):
 
 #ifdef  L_ltdf2
 	.text
-	.proc
+	FUNC(__ltdf2)
 	.globl	SYM (__ltdf2)
 SYM (__ltdf2):
 	link	a6,IMM (0)
@@ -3939,7 +3962,7 @@ SYM (__ltdf2):
 
 #ifdef  L_ledf2
 	.text
-	.proc
+	FUNC(__ledf2)
 	.globl	SYM (__ledf2)
 SYM (__ledf2):
 	link	a6,IMM (0)
@@ -3958,7 +3981,7 @@ SYM (__ledf2):
 
 #ifdef  L_eqsf2
 	.text
-	.proc
+	FUNC(__eqsf2)
 	.globl	SYM (__eqsf2)
 SYM (__eqsf2):
 	link	a6,IMM (0)
@@ -3972,7 +3995,7 @@ SYM (__eqsf2):
 
 #ifdef  L_nesf2
 	.text
-	.proc
+	FUNC(__nesf2)
 	.globl	SYM (__nesf2)
 SYM (__nesf2):
 	link	a6,IMM (0)
@@ -3986,7 +4009,7 @@ SYM (__nesf2):
 
 #ifdef  L_gtsf2
 	.text
-	.proc
+	FUNC(__gtsf2)
 	.globl	SYM (__gtsf2)
 SYM (__gtsf2):
 	link	a6,IMM (0)
@@ -4000,7 +4023,7 @@ SYM (__gtsf2):
 
 #ifdef  L_gesf2
 	.text
-	.proc
+	FUNC(__gesf2)
 	.globl	SYM (__gesf2)
 SYM (__gesf2):
 	link	a6,IMM (0)
@@ -4014,7 +4037,7 @@ SYM (__gesf2):
 
 #ifdef  L_ltsf2
 	.text
-	.proc
+	FUNC(__ltsf2)
 	.globl	SYM (__ltsf2)
 SYM (__ltsf2):
 	link	a6,IMM (0)
@@ -4028,7 +4051,7 @@ SYM (__ltsf2):
 
 #ifdef  L_lesf2
 	.text
-	.proc
+	FUNC(__lesf2)
 	.globl	SYM (__lesf2)
 SYM (__lesf2):
 	link	a6,IMM (0)
popd

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Add .type pseudo-op to 68K soft-float routines
  2007-07-29 21:06 PATCH: Add .type pseudo-op to 68K soft-float routines Mark Mitchell
@ 2007-07-30 10:32 ` Andreas Schwab
  2007-07-30 20:06   ` Mark Mitchell
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2007-07-30 10:32 UTC (permalink / raw)
  To: mark; +Cc: gcc-patches, law

Mark Mitchell <mark@codesourcery.com> writes:

> If there are no objections from the 68K maintainers, I will commit
> this in 48 hours.

No objections, just a small nit:

> +/* The .proc pseudo-op is accepted, but ignored, by GAS.  We could just		  define this to the empty string for non-ELF systems, but defining it

A newline was lost here.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: PATCH: Add .type pseudo-op to 68K soft-float routines
  2007-07-30 10:32 ` Andreas Schwab
@ 2007-07-30 20:06   ` Mark Mitchell
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Mitchell @ 2007-07-30 20:06 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc-patches, law

Andreas Schwab wrote:
> Mark Mitchell <mark@codesourcery.com> writes:
> 
>> If there are no objections from the 68K maintainers, I will commit
>> this in 48 hours.
> 
> No objections, just a small nit:
> 
>> +/* The .proc pseudo-op is accepted, but ignored, by GAS.  We could just		  define this to the empty string for non-ELF systems, but defining it
> 
> A newline was lost here.

Good catch!  I checked it in, with that change.

Please let me know if there are any problems.

Thanks,

-- 
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-07-30 19:37 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-29 21:06 PATCH: Add .type pseudo-op to 68K soft-float routines Mark Mitchell
2007-07-30 10:32 ` Andreas Schwab
2007-07-30 20:06   ` Mark Mitchell

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).