[compiler-rt] r208603 - Move .subsections_via_symbols directives into DEFINE_COMPILERRT_PRIVATE_FUNCTION

Nick Kledzik kledzik at apple.com
Mon May 12 15:47:48 PDT 2014


FYI, this is a semantic change.   The .subsection_via_symbols directive tells the linker that the .o file has no functions that will fall into the next one (the compiler never does that, but it is common enough in hand written assembly).  That means the linker can dead strip functions not referenced.  By moving .subsection_via_symbols into FILE_LEVEL_DIRECTIVE, you’ve caused every file to opt-in to the directive, even if they have fall through code.  

I just did a quick survey of the .S files in compiler-rt and do not see any with fall through code.  Mostly because compiler-rt has the convention of one function per file.

So, this change should be benign now, but may cause surprises on darwin in the future if someone tries to write fall-through assembly code.

-Nick

On May 12, 2014, at 10:38 AM, Jonathan Roelofs <jonathan at codesourcery.com> wrote:
> Author: jroelofs
> Date: Mon May 12 12:38:36 2014
> New Revision: 208603
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=208603&view=rev
> Log:
> Move .subsections_via_symbols directives into DEFINE_COMPILERRT_PRIVATE_FUNCTION
> 
> Modified:
>    compiler-rt/trunk/lib/builtins/arm/restore_vfp_d8_d15_regs.S
>    compiler-rt/trunk/lib/builtins/arm/save_vfp_d8_d15_regs.S
>    compiler-rt/trunk/lib/builtins/arm/switch16.S
>    compiler-rt/trunk/lib/builtins/arm/switch32.S
>    compiler-rt/trunk/lib/builtins/arm/switch8.S
>    compiler-rt/trunk/lib/builtins/arm/switchu8.S
>    compiler-rt/trunk/lib/builtins/assembly.h
> 
> Modified: compiler-rt/trunk/lib/builtins/arm/restore_vfp_d8_d15_regs.S
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/restore_vfp_d8_d15_regs.S?rev=208603&r1=208602&r2=208603&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/builtins/arm/restore_vfp_d8_d15_regs.S (original)
> +++ compiler-rt/trunk/lib/builtins/arm/restore_vfp_d8_d15_regs.S Mon May 12 12:38:36 2014
> @@ -31,5 +31,3 @@ DEFINE_COMPILERRT_PRIVATE_FUNCTION(__res
> 	bx      lr                      // return to prolog
> END_COMPILERRT_FUNCTION(__restore_vfp_d8_d15_regs)
> 
> -	// tell linker it can break up file at label boundaries
> -	.subsections_via_symbols
> 
> Modified: compiler-rt/trunk/lib/builtins/arm/save_vfp_d8_d15_regs.S
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/save_vfp_d8_d15_regs.S?rev=208603&r1=208602&r2=208603&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/builtins/arm/save_vfp_d8_d15_regs.S (original)
> +++ compiler-rt/trunk/lib/builtins/arm/save_vfp_d8_d15_regs.S Mon May 12 12:38:36 2014
> @@ -31,5 +31,3 @@ DEFINE_COMPILERRT_PRIVATE_FUNCTION(__sav
> 	bx      lr                      // return to prolog
> END_COMPILERRT_FUNCTION(__save_vfp_d8_d15_regs)
> 
> -	// tell linker it can break up file at label boundaries
> -	.subsections_via_symbols
> 
> Modified: compiler-rt/trunk/lib/builtins/arm/switch16.S
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/switch16.S?rev=208603&r1=208602&r2=208603&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/builtins/arm/switch16.S (original)
> +++ compiler-rt/trunk/lib/builtins/arm/switch16.S Mon May 12 12:38:36 2014
> @@ -42,5 +42,3 @@ DEFINE_COMPILERRT_PRIVATE_FUNCTION(__swi
> 	bx      ip                      // jump to computed label
> END_COMPILERRT_FUNCTION(__switch16)
> 
> -	// tell linker it can break up file at label boundaries
> -	.subsections_via_symbols
> 
> Modified: compiler-rt/trunk/lib/builtins/arm/switch32.S
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/switch32.S?rev=208603&r1=208602&r2=208603&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/builtins/arm/switch32.S (original)
> +++ compiler-rt/trunk/lib/builtins/arm/switch32.S Mon May 12 12:38:36 2014
> @@ -42,6 +42,3 @@ DEFINE_COMPILERRT_PRIVATE_FUNCTION(__swi
> 	bx      ip                       // jump to computed label
> END_COMPILERRT_FUNCTION(__switch32)
> 
> -	// tell linker it can break up file at label boundaries
> -	.subsections_via_symbols
> -
> 
> Modified: compiler-rt/trunk/lib/builtins/arm/switch8.S
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/switch8.S?rev=208603&r1=208602&r2=208603&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/builtins/arm/switch8.S (original)
> +++ compiler-rt/trunk/lib/builtins/arm/switch8.S Mon May 12 12:38:36 2014
> @@ -40,6 +40,3 @@ DEFINE_COMPILERRT_PRIVATE_FUNCTION(__swi
> 	bx      ip                      // jump to computed label
> END_COMPILERRT_FUNCTION(__switch8)
> 
> -	// tell linker it can break up file at label boundaries
> -	.subsections_via_symbols
> -
> 
> Modified: compiler-rt/trunk/lib/builtins/arm/switchu8.S
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/arm/switchu8.S?rev=208603&r1=208602&r2=208603&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/builtins/arm/switchu8.S (original)
> +++ compiler-rt/trunk/lib/builtins/arm/switchu8.S Mon May 12 12:38:36 2014
> @@ -40,6 +40,3 @@ DEFINE_COMPILERRT_PRIVATE_FUNCTION(__swi
> 	bx      ip                      // jump to computed label
> END_COMPILERRT_FUNCTION(__switchu8)
> 
> -	// tell linker it can break up file at label boundaries
> -	.subsections_via_symbols
> -
> 
> Modified: compiler-rt/trunk/lib/builtins/assembly.h
> URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/builtins/assembly.h?rev=208603&r1=208602&r2=208603&view=diff
> ==============================================================================
> --- compiler-rt/trunk/lib/builtins/assembly.h (original)
> +++ compiler-rt/trunk/lib/builtins/assembly.h Mon May 12 12:38:36 2014
> @@ -25,6 +25,7 @@
> #if defined(__APPLE__)
> #define HIDDEN_DIRECTIVE .private_extern
> #define LOCAL_LABEL(name) L_##name
> +// tell linker it can break up file at label boundaries
> #define FILE_LEVEL_DIRECTIVE  .subsections_via_symbols
> #define SYMBOL_IS_FUNC(name)
> #else
> @@ -103,6 +104,7 @@
>   SYMBOL_NAME(name):
> 
> #define DEFINE_COMPILERRT_PRIVATE_FUNCTION(name)           \
> +  FILE_LEVEL_DIRECTIVE     SEPARATOR                       \
>   .globl SYMBOL_NAME(name) SEPARATOR                       \
>   SYMBOL_IS_FUNC(SYMBOL_NAME(name)) SEPARATOR              \
>   HIDDEN_DIRECTIVE SYMBOL_NAME(name) SEPARATOR             \
> 
> 
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits





More information about the llvm-commits mailing list