Set .type @object for all global symbols in NCG
authorClemens Fruhwirth <clemens@endorphin.org>
Wed, 27 Jun 2007 16:51:50 +0000 (16:51 +0000)
committerClemens Fruhwirth <clemens@endorphin.org>
Wed, 27 Jun 2007 16:51:50 +0000 (16:51 +0000)
When linking against a dynamic library, the linker will emit a warning
if no type information is present within the library. We generate the
most trivial type for all externally visible labels, namely @object.

compiler/nativeGen/PprMach.hs

index 29cd23e..52d7706 100644 (file)
@@ -692,8 +692,14 @@ pprGloblDecl lbl
                                    SLIT(".globl ")) <>
                pprCLabel_asm lbl
 
+pprTypeAndSizeDecl :: CLabel -> Doc
+pprTypeAndSizeDecl lbl
+  | not (externallyVisibleCLabel lbl) = empty
+  | otherwise = ptext SLIT(".type ") <>
+               pprCLabel_asm lbl <> ptext SLIT(", @object")
+
 pprLabel :: CLabel -> Doc
-pprLabel lbl = pprGloblDecl lbl $$ (pprCLabel_asm lbl <> char ':')
+pprLabel lbl = pprGloblDecl lbl $$ pprTypeAndSizeDecl lbl $$ (pprCLabel_asm lbl <> char ':')
 
 
 pprASCII str