Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/libexec/ld.elf_so Build ld.elf_so with -fvisibility=hidden. ...



details:   https://anonhg.NetBSD.org/src/rev/6b103cfd0216
branches:  trunk
changeset: 759267:6b103cfd0216
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sun Dec 05 00:56:06 2010 +0000

description:
Build ld.elf_so with -fvisibility=hidden. Exploit this for i386/x86_64
to simplify the assembler code.

diffstat:

 libexec/ld.elf_so/Makefile                 |   3 ++-
 libexec/ld.elf_so/arch/i386/rtld_start.S   |  10 ++++++----
 libexec/ld.elf_so/arch/x86_64/rtld_start.S |  10 ++++++----
 libexec/ld.elf_so/rtld.h                   |  16 ++++++++--------
 4 files changed, 22 insertions(+), 17 deletions(-)

diffs (144 lines):

diff -r 691b5407d112 -r 6b103cfd0216 libexec/ld.elf_so/Makefile
--- a/libexec/ld.elf_so/Makefile        Sun Dec 05 00:34:21 2010 +0000
+++ b/libexec/ld.elf_so/Makefile        Sun Dec 05 00:56:06 2010 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.98 2010/10/29 15:08:17 christos Exp $
+#      $NetBSD: Makefile,v 1.99 2010/12/05 00:56:06 joerg Exp $
 #
 # NOTE: when changing ld.so, ensure that ldd still compiles.
 #
@@ -40,6 +40,7 @@
 
 LDFLAGS+=      -shared -symbolic -nostartfiles
 LDFLAGS+=      -Wl,-static
+CFLAGS+=       -fvisibility=hidden
 
 # Adds SRCS, CPPFLAGS, LDFLAGS, etc.  Must go first so MD startup source
 # is first.
diff -r 691b5407d112 -r 6b103cfd0216 libexec/ld.elf_so/arch/i386/rtld_start.S
--- a/libexec/ld.elf_so/arch/i386/rtld_start.S  Sun Dec 05 00:34:21 2010 +0000
+++ b/libexec/ld.elf_so/arch/i386/rtld_start.S  Sun Dec 05 00:56:06 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld_start.S,v 1.10 2008/04/28 20:23:03 martin Exp $   */
+/*     $NetBSD: rtld_start.S,v 1.11 2010/12/05 00:56:07 joerg Exp $    */
 
 /*-
  * Copyright (c) 1998, 2002 The NetBSD Foundation, Inc.
@@ -34,6 +34,7 @@
        .text
        .align  4
        .globl  .rtld_start
+       .hidden .rtld_start
        .type   .rtld_start,@function
 .rtld_start:
        subl    $8,%esp                 # make room of obj_main and exit proc
@@ -48,12 +49,12 @@
 
        pushl   %ebx                    # relocbase
        pushl   %ecx                    # &_DYNAMIC
-       call    _rtld_relocate_nonplt_self@PLT
+       call    _rtld_relocate_nonplt_self
 
        leal    12(%esp),%eax           # &cleanup
        pushl   %ebx                    # relocbase
        pushl   %eax                    # sp
-       call    _rtld@PLT               # _rtld(sp, relocbase)
+       call    _rtld                   # _rtld(sp, relocbase)
 
        addl    $16,%esp                # pop args
 
@@ -64,6 +65,7 @@
 
        .align  4
        .globl  _rtld_bind_start
+       .hidden _rtld_bind_start
        .type   _rtld_bind_start,@function
 _rtld_bind_start:      # (obj, reloff)
        pushf                           # save registers
@@ -73,7 +75,7 @@
 
        pushl   20(%esp)                # Copy of reloff
        pushl   20(%esp)                # Copy of obj
-       call    _rtld_bind@PLT          # Call the binder
+       call    _rtld_bind              # Call the binder
        addl    $8,%esp                 # pop binder args
        movl    %eax,20(%esp)           # Store function to be called in obj
 
diff -r 691b5407d112 -r 6b103cfd0216 libexec/ld.elf_so/arch/x86_64/rtld_start.S
--- a/libexec/ld.elf_so/arch/x86_64/rtld_start.S        Sun Dec 05 00:34:21 2010 +0000
+++ b/libexec/ld.elf_so/arch/x86_64/rtld_start.S        Sun Dec 05 00:56:06 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld_start.S,v 1.7 2010/12/03 22:48:25 joerg Exp $     */
+/*     $NetBSD: rtld_start.S,v 1.8 2010/12/05 00:56:07 joerg Exp $     */
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,6 +40,7 @@
        .text
        .align  16
        .globl  .rtld_start
+       .hidden .rtld_start
        .type   .rtld_start,@function
 .rtld_start:
        subq    $16,%rsp                # make room of obj_main and exit proc
@@ -52,11 +53,11 @@
        subq    (%rax),%rbx             # relocbase
 
        movq    %rbx,%rsi
-       call    _rtld_relocate_nonplt_self@PLT
+       call    _rtld_relocate_nonplt_self
 
        movq    %r12,%rdi
        movq    %rbx,%rsi
-       call    _rtld@PLT               # _rtld(sp, relocbase)
+       call    _rtld                   # _rtld(sp, relocbase)
 
        popq    %rbx                    # %rbx = ps_strings
        popq    %rdx                    # %rdx = cleanup
@@ -65,6 +66,7 @@
 
        .align  4
        .globl  _rtld_bind_start
+       .hidden _rtld_bind_start
        .type   _rtld_bind_start,@function
 _rtld_bind_start:      # (obj, reloff)
        # This function is called with a misaligned stack from the PLT
@@ -84,7 +86,7 @@
        movq    80(%rsp),%rdi
        movq    88(%rsp),%rsi
 
-       call    _rtld_bind@PLT          # call the binder
+       call    _rtld_bind              # call the binder
        movq    %rax,88(%rsp)           # store function in obj
 
        popq    %r11
diff -r 691b5407d112 -r 6b103cfd0216 libexec/ld.elf_so/rtld.h
--- a/libexec/ld.elf_so/rtld.h  Sun Dec 05 00:34:21 2010 +0000
+++ b/libexec/ld.elf_so/rtld.h  Sun Dec 05 00:56:06 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtld.h,v 1.95 2010/10/16 10:27:07 skrll Exp $   */
+/*     $NetBSD: rtld.h,v 1.96 2010/12/05 00:56:06 joerg Exp $   */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -254,13 +254,13 @@
 /* rtld.c */
 
 /* We export these symbols using _rtld_symbol_lookup and is_exported. */
-char *dlerror(void);
-void *dlopen(const char *, int);
-void *dlsym(void *, const char *);
-int dlclose(void *);
-int dladdr(const void *, Dl_info *);
-int dlinfo(void *, int, void *);
-int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *),
+__dso_public char *dlerror(void);
+__dso_public void *dlopen(const char *, int);
+__dso_public void *dlsym(void *, const char *);
+__dso_public int dlclose(void *);
+__dso_public int dladdr(const void *, Dl_info *);
+__dso_public int dlinfo(void *, int, void *);
+__dso_public int dl_iterate_phdr(int (*)(struct dl_phdr_info *, size_t, void *),
     void *);
 
 /* These aren't exported */



Home | Main Index | Thread Index | Old Index