From patchwork Thu Oct 12 22:06:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 23518 Received: (qmail 3362 invoked by alias); 12 Oct 2017 22:07:04 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 3347 invoked by uid 89); 12 Oct 2017 22:07:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-24.9 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-oi0-f49.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=sAwZJouqGWtL2kDMfa7HFscJ6BO4IeqMnIFP98Xo6/8=; b=beTWvuZ7dKQ2SAocUKiy52Jq75um63MFQ1ox0XU1S2vIgUBXi+74my0wUqQX81NBAj A1n2l7qyWRtlb33kTY3eM9GE3aPZhib1HwesaObQ7FwN9tsCp59JYLae3HgakaUo94NW 9yk45+VRdKqR90ddmt/cMvvloOz1qQtozdWF9x4Kcr70P9/XWTH0KZxLrzz/i0fDZbQb wQXfB7O71iMTTGyKmVITB6hUAGWiFMHFxrK115FaMTjeWBvuceFLpjhmxATJ3qiNBN/N pT0EeeRY5pI/ArhWPKPuqIdZ8QKq+AC7iV5IK5XWbMeyc4n7fSVSSL6iqIAtHIZblsV+ 9WVQ== X-Gm-Message-State: AMCzsaVMf1+IRrG1SBKNGoSDuQP4GsovCHt6nrUSDW6ZMgisPxZbl6Xp SNYr9/qwXzzNdUlyv4RaDu3noX2BdNhx2K5HXQM= X-Google-Smtp-Source: ABhQp+TdAX6ec87mMb+V2S4Hxs4emPnaL1P8KSQ+RIXc3/yJ3Yijus+FS0XZ2cmy9HqM0yYUec76bZYiFfg/epwmBEo= X-Received: by 10.157.83.138 with SMTP id w10mr2789621otg.290.1507846020333; Thu, 12 Oct 2017 15:07:00 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <59D64E44.6040304@arm.com> From: "H.J. Lu" Date: Thu, 12 Oct 2017 15:06:59 -0700 Message-ID: Subject: Re: PING: [PATCH] Add --enable-static-pie to build static PIE To: Szabolcs Nagy Cc: Joseph Myers , nd@arm.com, GNU C Library On 10/5/17, H.J. Lu wrote: > On 10/5/17, Szabolcs Nagy wrote: >> On 05/10/17 14:11, H.J. Lu wrote: >>> On 9/29/17, H.J. Lu wrote: >>>> I submitted patches for other targets to address obvious issues with >>>> static >>>> PIE. Build results of build-many-glibcs.py with --enable-static-pie >>>> with >>>> all >>>> patches for static PIE applied are >>>> >>>> PASS: glibcs-aarch64_be-linux-gnu build >>>> PASS: glibcs-aarch64-linux-gnu build >> >> can you tell me the binutils version used? >> building fails with recent binutils master: >> >> builddir/libc.a(dl-reloc-static-pie.o): In function >> `elf_get_dynamic_info': >> srcdir/elf/get-dynamic-info.h:73:(.text+0x4c): relocation truncated to >> fit: >> R_AARCH64_ADR_PREL_PG_HI21 against >> symbol `_dl_main_map' defined in .data.rel.local section in >> builddir/libc.a(dl-support.o) >> srcdir/elf/get-dynamic-info.h:70:(.text+0x50): relocation truncated to >> fit: >> R_AARCH64_ADR_PREL_PG_HI21 against >> symbol `_dl_main_map' defined in .data.rel.local section in >> builddir/libc.a(dl-support.o) >> >> and >> >> $ objdump -t builddir/elf/dl-support.o >> ... >> 0000000000000000 g O .data.rel.local 0000000000000468 .hidden >> _dl_main_map >> ... >> $ objdump -r builddir/elf/dl-reloc-static-pie.o >> ... >> 000000000000004c R_AARCH64_ADR_PREL_PG_HI21 >> _dl_main_map+0x000000037ffffa40 >> 0000000000000050 R_AARCH64_ADR_PREL_PG_HI21 >> _dl_main_map+0x000000037ffff1e0 >> ... >> >> those offsets look wrong, i'll need to investigate >> >> > > Did you mean addend? In any case, I checked a workaround > into hjl/pie/static. Please give it a try, Here is the updated patch. The main change is that gPcrt1.o is also added to create static PIE with -pg. OK for master? From 1798eb01da55411ce2c74ad0241801c03a1b67e6 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Wed, 27 Sep 2017 16:47:29 -0700 Subject: [PATCH 11/11] Add --enable-static-pie to build-many-glibcs.py --- scripts/build-many-glibcs.py | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/build-many-glibcs.py b/scripts/build-many-glibcs.py index a6c01f9cc4..2b6b132bb4 100755 --- a/scripts/build-many-glibcs.py +++ b/scripts/build-many-glibcs.py @@ -1342,6 +1342,7 @@ class Glibc(object): cmdlist.create_copy_dir(srcdir, srcdir_copy) cfg_cmd = [os.path.join(srcdir_copy, 'configure'), '--prefix=/usr', + '--enable-static-pie', '--enable-profile', '--build=%s' % self.ctx.build_triplet, '--host=%s' % self.triplet, -- 2.13.6