Message ID | 20200106195818.56351-2-broonie@kernel.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | arm64: Conversions to modern assembly annotations | expand |
On Mon, Jan 06, 2020 at 07:58:16PM +0000, Mark Brown wrote: > As part of an effort to make the annotations in assembly code clearer and > more consistent new macros have been introduced, including replacements > for ENTRY() and ENDPROC(). > > On arm64 we have ENDPIPROC(), a custom version of ENDPROC() which is > used for code that will need to run in position independent environments > like EFI, it creates an alias for the function with the prefix __pi_ and > then emits the standard ENDPROC. Add new-style macros to replace this > which expand to the standard SYM_FUNC_*() and SYM_FUNC_ALIAS_*(), > resulting in the same object code. These are added in linkage.h for > consistency with where the generic assembler code has its macros. > > Signed-off-by: Mark Brown <broonie@kernel.org> > --- > arch/arm64/include/asm/linkage.h | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/arch/arm64/include/asm/linkage.h b/arch/arm64/include/asm/linkage.h > index 1b266292f0be..23944ce14969 100644 > --- a/arch/arm64/include/asm/linkage.h > +++ b/arch/arm64/include/asm/linkage.h > @@ -4,4 +4,20 @@ > #define __ALIGN .align 2 > #define __ALIGN_STR ".align 2" > > +/* > + * Annotate a function as position independent, i.e., safe to be called before > + * the kernel virtual mapping is activated. > + */ > +#define SYM_FUNC_START_PI(x) \ > + SYM_FUNC_START_ALIAS(__pi_##x) ASM_NL \ > + SYM_FUNC_START(x) > + > +#define SYM_FUNC_START_PI_WEAK(x) \ > + SYM_FUNC_START_ALIAS(__pi_##x) ASM_NL \ > + SYM_FUNC_START_WEAK(x) Naming's hard, but I think this is particularly bad because it reads to me like it's declaring a weak, position-independent symbol, whereas the weak symbol is actually the version without the "__pi_" prefix. Maybe SYM_FUNC_START_WEAK_PI() is a tiny bit better? Hrm. Will
On Tue, Jan 07, 2020 at 02:44:08PM +0000, Will Deacon wrote: > On Mon, Jan 06, 2020 at 07:58:16PM +0000, Mark Brown wrote: > > +#define SYM_FUNC_START_PI_WEAK(x) \ > > + SYM_FUNC_START_ALIAS(__pi_##x) ASM_NL \ > > + SYM_FUNC_START_WEAK(x) > Naming's hard, but I think this is particularly bad because it reads to me > like it's declaring a weak, position-independent symbol, whereas the weak > symbol is actually the version without the "__pi_" prefix. Maybe > SYM_FUNC_START_WEAK_PI() is a tiny bit better? Hrm. I really don't have strong feelings about the name, if you're happy with _WEAK_PI I'm more than happy to go with that. Like you say it's messy.
diff --git a/arch/arm64/include/asm/linkage.h b/arch/arm64/include/asm/linkage.h index 1b266292f0be..23944ce14969 100644 --- a/arch/arm64/include/asm/linkage.h +++ b/arch/arm64/include/asm/linkage.h @@ -4,4 +4,20 @@ #define __ALIGN .align 2 #define __ALIGN_STR ".align 2" +/* + * Annotate a function as position independent, i.e., safe to be called before + * the kernel virtual mapping is activated. + */ +#define SYM_FUNC_START_PI(x) \ + SYM_FUNC_START_ALIAS(__pi_##x) ASM_NL \ + SYM_FUNC_START(x) + +#define SYM_FUNC_START_PI_WEAK(x) \ + SYM_FUNC_START_ALIAS(__pi_##x) ASM_NL \ + SYM_FUNC_START_WEAK(x) + +#define SYM_FUNC_END_PI(x) \ + SYM_FUNC_END(x) ASM_NL \ + SYM_FUNC_END_ALIAS(__pi_##x) + #endif
As part of an effort to make the annotations in assembly code clearer and more consistent new macros have been introduced, including replacements for ENTRY() and ENDPROC(). On arm64 we have ENDPIPROC(), a custom version of ENDPROC() which is used for code that will need to run in position independent environments like EFI, it creates an alias for the function with the prefix __pi_ and then emits the standard ENDPROC. Add new-style macros to replace this which expand to the standard SYM_FUNC_*() and SYM_FUNC_ALIAS_*(), resulting in the same object code. These are added in linkage.h for consistency with where the generic assembler code has its macros. Signed-off-by: Mark Brown <broonie@kernel.org> --- arch/arm64/include/asm/linkage.h | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)