From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26266 invoked by alias); 29 Sep 2017 21:38:56 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 26248 invoked by uid 89); 29 Sep 2017 21:38:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.3 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-it0-f66.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=S88uXfwla2ySzwJITXgOvsIDsBTzyVhf8jkqAXMZEKM=; b=Yuf/Tg/pSTit/SN5CC2G4VGTr4FDf5PgDqhAALmq0Aw5Xo71UmLXjfzAkKJEwG7ReW xs2KPDKEQxo0lBurY+LpiPoxGbg4tKo19yC1Xiu27s7HNahV8cm3Wh6+Cq489PSgG+kp oJP/Abs0RdhTjg3HHDuR2koUJSfV67Aj1rtEidnbNOTSF6NX7buRuL9WatSWc5Xum05a 5GTJu6JSQb/CtJ7N8J9gMp+5f/ASZ5ZaPGRML6I6E6/FTMLlK8J44eaSXd9G39vH3Fam h+rv3E25BzcsHX9EW2ZlE43u4YERaNGtyZg3QO4NbEysU+SNIolBWUQgLisnL8Zyc/15 uswA== X-Gm-Message-State: AMCzsaUgbPSmI1EjDM3/OjvcrSFxCBhmX7cNtROmIIGeIF5bh7EydN8W ll8V3X9gVaokULh95v95az3k/HPL X-Google-Smtp-Source: AOwi7QAavn/gx1GtvJvME7BYWPqfIMuv4hFZR1nLtze5UUiu84zFNbAratRTXf+r75JFS/NRalLjIQ== X-Received: by 10.36.103.194 with SMTP id u185mr9582936itc.57.1506721133336; Fri, 29 Sep 2017 14:38:53 -0700 (PDT) Date: Fri, 29 Sep 2017 21:38:00 -0000 From: "H.J. Lu" To: GNU C Library Subject: [PATCH] ld.so: Replace (&bootstrap_map) with BOOTSTRAP_MAP Message-ID: <20170929213843.GU2482@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.0 (2017-09-02) X-SW-Source: 2017-09/txt/msg01160.txt.bz2 (&_dl_main_map) is used instead of (&bootstrap_map) to bootstrap static PIE. Define BOOTSTRAP_MAP with (&_dl_main_map) to avoid hardcode to (&bootstrap_map). Tested on x86-64. OK for master? H.J. --- * elf/rtld.c (BOOTSTRAP_MAP): New. (RESOLVE_MAP): Replace (&bootstrap_map) with BOOTSTRAP_MAP. * sysdeps/hppa/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC): Likewise. * sysdeps/ia64/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC): Likewise. * sysdeps/mips/dl-machine.h (ELF_MACHINE_BEFORE_RTLD_RELOC): Likewise. --- elf/rtld.c | 3 ++- sysdeps/hppa/dl-machine.h | 2 +- sysdeps/ia64/dl-machine.h | 2 +- sysdeps/mips/dl-machine.h | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/elf/rtld.c b/elf/rtld.c index d8e75c02e6..90505aee7d 100644 --- a/elf/rtld.c +++ b/elf/rtld.c @@ -454,7 +454,8 @@ _dl_start (void *arg) Since ld.so must not have any undefined symbols the result is trivial: always the map of ld.so itself. */ #define RTLD_BOOTSTRAP -#define RESOLVE_MAP(sym, version, flags) (&bootstrap_map) +#define BOOTSTRAP_MAP (&bootstrap_map) +#define RESOLVE_MAP(sym, version, flags) BOOTSTRAP_MAP #include "dynamic-link.h" if (HP_TIMING_INLINE && HP_SMALL_TIMING_AVAIL) diff --git a/sysdeps/hppa/dl-machine.h b/sysdeps/hppa/dl-machine.h index e24bd25c63..acfb9fc31f 100644 --- a/sysdeps/hppa/dl-machine.h +++ b/sysdeps/hppa/dl-machine.h @@ -62,7 +62,7 @@ __hppa_init_bootstrap_fdesc_table (struct link_map *map) } #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \ - __hppa_init_bootstrap_fdesc_table (&bootstrap_map); \ + __hppa_init_bootstrap_fdesc_table (BOOTSTRAP_MAP); \ _dl_fptr_init(); /* Return nonzero iff ELF header is compatible with the running host. */ diff --git a/sysdeps/ia64/dl-machine.h b/sysdeps/ia64/dl-machine.h index 8d0d3c97dd..b56f1c8194 100644 --- a/sysdeps/ia64/dl-machine.h +++ b/sysdeps/ia64/dl-machine.h @@ -45,7 +45,7 @@ __ia64_init_bootstrap_fdesc_table (struct link_map *map) } #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \ - __ia64_init_bootstrap_fdesc_table (&bootstrap_map); + __ia64_init_bootstrap_fdesc_table (BOOTSTRAP_MAP); /* Return nonzero iff ELF header is compatible with the running host. */ static inline int __attribute__ ((unused)) diff --git a/sysdeps/mips/dl-machine.h b/sysdeps/mips/dl-machine.h index 74ead7f524..da9d6332ea 100644 --- a/sysdeps/mips/dl-machine.h +++ b/sysdeps/mips/dl-machine.h @@ -190,7 +190,7 @@ elf_machine_load_address (void) fiddles with global data. */ #define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \ do { \ - struct link_map *map = &bootstrap_map; \ + struct link_map *map = BOOTSTRAP_MAP; \ ElfW(Sym) *sym; \ ElfW(Addr) *got; \ int i, n; \ -- 2.13.6