diff mbox

[44/74] lto: Mark functions used by the vsyscall init code visible

Message ID 1345345030-22211-45-git-send-email-andi@firstfloor.org (mailing list archive)
State New, archived
Headers show

Commit Message

Andi Kleen Aug. 19, 2012, 2:56 a.m. UTC
From: Andi Kleen <ak@linux.intel.com>

The vsyscall code is compiled without LTO. This also includes
its init function. The function which are called by it have
to be visible, otherwise they could be optimized away

Signed-off-by: Andi Kleen <ak@linux.intel.com>
---
 drivers/char/random.c |    2 +-
 include/linux/mm.h    |    1 +
 mm/vmalloc.c          |    2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

Comments

Michal Marek Sept. 1, 2012, 3:26 p.m. UTC | #1
Dne 19.8.2012 04:56, Andi Kleen napsal(a):
> From: Andi Kleen <ak@linux.intel.com>
> 
> The vsyscall code is compiled without LTO. This also includes
> its init function. The function which are called by it have
> to be visible, otherwise they could be optimized away
> 
> Signed-off-by: Andi Kleen <ak@linux.intel.com>
> ---
>  drivers/char/random.c |    2 +-
>  include/linux/mm.h    |    1 +
>  mm/vmalloc.c          |    2 +-
>  3 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/char/random.c b/drivers/char/random.c
> index b86eae9..33c8fe5 100644
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -1450,7 +1450,7 @@ late_initcall(random_int_secret_init);
>   * depleting entropy is too high
>   */
>  static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash);
> -unsigned int get_random_int(void)
> +__visible unsigned int get_random_int(void)

I think that there should be a comment why the symbol needs to be
visible (just copy the reasoning from the changelog). Otherwise someone
might attempt to do a cleanup a few years later, noticing that there is
no assembler code calling get_random_int().

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andi Kleen Sept. 1, 2012, 5:16 p.m. UTC | #2
> I think that there should be a comment why the symbol needs to be
> visible (just copy the reasoning from the changelog). Otherwise someone
> might attempt to do a cleanup a few years later, noticing that there is
> no assembler code calling get_random_int().

Ok. On hindsight maybe it's better to split vsyscall_64.c into two
files, one only with the vsyscall code and another with the init code.

-Andi
--
To unsubscribe from this list: send the line "unsubscribe linux-kbuild" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Andi Kleen Sept. 1, 2012, 5:26 p.m. UTC | #3
On Sat, Sep 01, 2012 at 07:16:45PM +0200, Andi Kleen wrote:
> > I think that there should be a comment why the symbol needs to be
> > visible (just copy the reasoning from the changelog). Otherwise someone
> > might attempt to do a cleanup a few years later, noticing that there is
> > no assembler code calling get_random_int().
> 
> Ok. On hindsight maybe it's better to split vsyscall_64.c into two
> files, one only with the vsyscall code and another with the init code.

Or checking the code again it's already done because only the emulation
is left and that is already a separate file. I'll drop those patches.

-Andi
diff mbox

Patch

diff --git a/drivers/char/random.c b/drivers/char/random.c
index b86eae9..33c8fe5 100644
--- a/drivers/char/random.c
+++ b/drivers/char/random.c
@@ -1450,7 +1450,7 @@  late_initcall(random_int_secret_init);
  * depleting entropy is too high
  */
 static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash);
-unsigned int get_random_int(void)
+__visible unsigned int get_random_int(void)
 {
 	__u32 *hash;
 	unsigned int ret;
diff --git a/include/linux/mm.h b/include/linux/mm.h
index 311be90..d3ca155 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -1413,6 +1413,7 @@  extern void set_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file);
 extern struct file *get_mm_exe_file(struct mm_struct *mm);
 
 extern int may_expand_vm(struct mm_struct *mm, unsigned long npages);
+__visible
 extern int install_special_mapping(struct mm_struct *mm,
 				   unsigned long addr, unsigned long len,
 				   unsigned long flags, struct page **pages);
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 2bb90b1..286ea0c 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1558,7 +1558,7 @@  EXPORT_SYMBOL(vunmap);
  *	Maps @count pages from @pages into contiguous kernel virtual
  *	space.
  */
-void *vmap(struct page **pages, unsigned int count,
+__visible void *vmap(struct page **pages, unsigned int count,
 		unsigned long flags, pgprot_t prot)
 {
 	struct vm_struct *area;