* [PATCH] module: LLVMLinux: Fix section mismatch issues on alias usage
@ 2014-02-21 4:28 behanw
2014-02-21 15:08 ` Paul Gortmaker
0 siblings, 1 reply; 3+ messages in thread
From: behanw @ 2014-02-21 4:28 UTC (permalink / raw)
To: rob, paul.gortmaker, rdunlap, geert
Cc: akpm, gregkh, linux-kernel, Jan-Simon Möller, Behan Webster
From: Jan-Simon Möller <dl9pf@gmx.de>
Attribute aliases don't inherit the link section name when compiled with clang.
As a result, the linking section needs to be explicitly specified when building
a module. This behavior is undefined in the standard which is why it differs from
compiler to compiler.
Author: PaX Team <pageexec@freemail.hu>
ML-Post: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120507/142707.html
URL: http://llvm.linuxfoundation.org
Merge: Jan-Simon Möller <dl9pf@gmx.de>
Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
Signed-off-by: Behan Webster <behanw@converseincode.com>
---
include/linux/init.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/linux/init.h b/include/linux/init.h
index e168880..384ec5e 100644
--- a/include/linux/init.h
+++ b/include/linux/init.h
@@ -297,13 +297,14 @@ void __init parse_early_options(char *cmdline);
#define module_init(initfn) \
static inline initcall_t __inittest(void) \
{ return initfn; } \
- int init_module(void) __attribute__((alias(#initfn)));
+ int init_module(void) __section(.init) __attribute__((alias(#initfn)));
/* This is only required if you want to be unloadable. */
#define module_exit(exitfn) \
static inline exitcall_t __exittest(void) \
{ return exitfn; } \
- void cleanup_module(void) __attribute__((alias(#exitfn)));
+ void cleanup_module(void) __section(.exit) \
+ __attribute__((alias(#exitfn)));
#define __setup_param(str, unique_id, fn) /* nothing */
#define __setup(str, func) /* nothing */
--
1.8.3.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] module: LLVMLinux: Fix section mismatch issues on alias usage
2014-02-21 4:28 [PATCH] module: LLVMLinux: Fix section mismatch issues on alias usage behanw
@ 2014-02-21 15:08 ` Paul Gortmaker
2014-02-25 2:33 ` Behan Webster
0 siblings, 1 reply; 3+ messages in thread
From: Paul Gortmaker @ 2014-02-21 15:08 UTC (permalink / raw)
To: behanw, rob, rdunlap, geert
Cc: akpm, gregkh, linux-kernel, Jan-Simon Möller
On 14-02-20 11:28 PM, behanw@converseincode.com wrote:
> From: Jan-Simon Möller <dl9pf@gmx.de>
^^^^^^^^^^^^^^
This line implies that Jan is the author.
>
> Attribute aliases don't inherit the link section name when compiled with clang.
> As a result, the linking section needs to be explicitly specified when building
> a module. This behavior is undefined in the standard which is why it differs from
> compiler to compiler.
But is there a good reason why clang doesn't inherit them in the
interest of compatibility with gcc and existing code?
>
> Author: PaX Team <pageexec@freemail.hu>
> ML-Post: http://lists.cs.uiuc.edu/pipermail/llvm-commits/Week-of-Mon-20120507/142707.html
> URL: http://llvm.linuxfoundation.org
> Merge: Jan-Simon Möller <dl9pf@gmx.de>
I know we've seen the faceless entity "PaX Team" before, but can we
please not make it worse by adding a bunch of other non standard tag
line formats? And ideally have a real human name for the author too.
Paul.
--
> Signed-off-by: Jan-Simon Möller <dl9pf@gmx.de>
> Signed-off-by: Behan Webster <behanw@converseincode.com>
> ---
> include/linux/init.h | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/init.h b/include/linux/init.h
> index e168880..384ec5e 100644
> --- a/include/linux/init.h
> +++ b/include/linux/init.h
> @@ -297,13 +297,14 @@ void __init parse_early_options(char *cmdline);
> #define module_init(initfn) \
> static inline initcall_t __inittest(void) \
> { return initfn; } \
> - int init_module(void) __attribute__((alias(#initfn)));
> + int init_module(void) __section(.init) __attribute__((alias(#initfn)));
>
> /* This is only required if you want to be unloadable. */
> #define module_exit(exitfn) \
> static inline exitcall_t __exittest(void) \
> { return exitfn; } \
> - void cleanup_module(void) __attribute__((alias(#exitfn)));
> + void cleanup_module(void) __section(.exit) \
> + __attribute__((alias(#exitfn)));
>
> #define __setup_param(str, unique_id, fn) /* nothing */
> #define __setup(str, func) /* nothing */
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] module: LLVMLinux: Fix section mismatch issues on alias usage
2014-02-21 15:08 ` Paul Gortmaker
@ 2014-02-25 2:33 ` Behan Webster
0 siblings, 0 replies; 3+ messages in thread
From: Behan Webster @ 2014-02-25 2:33 UTC (permalink / raw)
To: Paul Gortmaker, rob, rdunlap, geert
Cc: akpm, gregkh, linux-kernel, Jan-Simon Möller
On 02/21/14 07:08, Paul Gortmaker wrote:
>> Attribute aliases don't inherit the link section name when compiled with clang.
>> As a result, the linking section needs to be explicitly specified when building
>> a module. This behavior is undefined in the standard which is why it differs from
>> compiler to compiler.
> But is there a good reason why clang doesn't inherit them in the
> interest of compatibility with gcc and existing code?
There is no reason other than it doesn't appear to be documented
behaviour anywhere that can be found. It seems like this use of an
aliased symbol inheriting attributes never came up before. Personally I
think the kernel code pushes compilers harder than most other code bases. :)
Having said that, it seems since we first started needing this patch to
build the kernel with clang, this issue may have been fixed in the most
recent updates to clang in the last few weeks. I've been testing with
the latest released version of clang v3.4 (since clang recently when
through a merge window of their own) which still requires this patch.
However in appears that this issue may now have been fixed in mainline
clang. I'll do some more testing to verify and get back to this thread.
> I know we've seen the faceless entity "PaX Team" before, but can we
> please not make it worse by adding a bunch of other non standard tag
> line formats? And ideally have a real human name for the author too.
Fair enough. Will fix and resubmit if the patch proves to still be
necessary.
Thanks for the input,
Behan
--
Behan Webster
behanw@converseincode.com
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-02-25 2:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-02-21 4:28 [PATCH] module: LLVMLinux: Fix section mismatch issues on alias usage behanw
2014-02-21 15:08 ` Paul Gortmaker
2014-02-25 2:33 ` Behan Webster
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.