This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Darwin dead code strip support


Now, Darwin linker supports dead code strip. Which means, at link time, linker can eliminate unused symbols. But sometimes user may want to keep some of them (for example debug_tree() in gcc). This patch allows user to annotate such symbols using existing attribute used. Target hook is used to allow various targets to take appropriate actions when attribute used is used. Darwin target hook emits .no_dead_strip assembler directive.

Bootstrapped and tested on powerpc-darwin.

OK?
Thanks,
-
Devang

2004-08-11 Devang Patel <dpatel@apple.com>

        * c-common.c (handle_used_attribute): Let target mark decl used.
        * c-decl.c (start_function): decls decorated with attribute used
        may already have their assembler name set.
        * target-def.h (TARGET_ASM_MARK_DECL_USED): New #define.
        (TARGET_ASM_OUT): New member, TARGET_ASM_MARK_DECL_USED.
        * target.h (struct gcc_target): New member, mark_decl_used.
        * targhooks.c (default_mark_decl_used): New function.
        * targhooks.h (default_mark_decl_used): New decl.
        * darwin.c (darwin_mark_decl_used): New function.
        * darwin.h (TARGET_ASM_MARK_DECL_USED): New #define.

        testsuite:
        gcc.dg/darwin-20040809-1.c: New test

Attachment: 3739318.diff
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]