PATCH: use non-readonly data section for objc references

Ovidiu Predescu ovidiu@cup.hp.com
Thu Aug 10 14:32:00 GMT 2000


Looks good, I'll install it!

Thanks,
Ovidiu

On Thu, 10 Aug 2000 17:16:35 -0400 (EDT), Todd Vierling <tv@wasabisystems.com> 
wrote:

> When compiling Objective-C code -fPIC, readonly data references are created
> that produce absolute relocs--something frowned upon by the linker (and
> resulting in Many warnings by the linker, not to mention runtime overhead
> with the dynamic linker).  This was found on NetBSD when attempting to make
> libobjc a shared library.
> 
> The following patch (against 2.95.2) will use a writable data section when
> compiling PIC code.  And the answer to the original comment:  "This is why
> not."  8^)
> 
> ==========
> *** gcc/objc/objc-act.c	2000/07/26 00:19:06
> --- gcc/objc/objc-act.c	2000/08/10 21:06:50
> ***************
> *** 8399,8406 ****
>         pushdecl (decl);
>         rest_of_decl_compilation (decl, 0, 0, 0);
>   
> !       /* Make following constant read-only (why not)?  */
> !       readonly_data_section ();
>   
>         exp = build1 (ADDR_EXPR, string_type_node, decl);
>   
> --- 8399,8409 ----
>         pushdecl (decl);
>         rest_of_decl_compilation (decl, 0, 0, 0);
>   
> !       /* Make following constant read-only, if not compiling PIC. */
> !       if (flag_pic)
> !         data_section();
> !       else
> !         readonly_data_section ();
>   
>         exp = build1 (ADDR_EXPR, string_type_node, decl);
>   
> ==========
> 
> -- 
> -- Todd Vierling <tv@wasabisystems.com>  *  http://www.wasabisystems.com/
> -- Speed, stability, security, and support.  Wasabi NetBSD:  Run with it.
> 
> 


-- 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.2 (GNU/Linux)
Comment: Exmh version 2.2 06/23/2000

iD8DBQE5kx171cM8Hy0YC5kRAkWoAJ9BLc1c3SY9Z/3drVktGMUXOTZGbwCgsPUz
lMjJH1yOefNVf37chZxGdhY=
=7WJl
-----END PGP SIGNATURE-----


More information about the Gcc-patches mailing list