From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by sourceware.org (Postfix) with ESMTPS id 66DF43858D37 for ; Sat, 22 Jan 2022 13:05:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 66DF43858D37 Received: by mail-pl1-x629.google.com with SMTP id x11so5450755plg.6 for ; Sat, 22 Jan 2022 05:05:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=T1mEVPXrd0RmHG0qkZ46Gxfl1Mj69znjEyxEvrBfg8M=; b=DYg7egULypO2PbnezPfyolc+Uo4l1Fo+8EMDUk+sG2Z+0H0EYRWbv5Uo4o3DWlxPUA 5FpTV3hh5HwhrjUcH5aVC5b6wwhBrrNjFTl0uAN76bsFzEFHSUIStZjEXsVj+mIlpWzL CeSBD/+s9+tLFkSqJAnaE/KGyLJrVbTtPu7NIK4aot1vUYsKROAeoMcQFN9+gDwdUW6t rdAFKdOUpLc/bqtNpNjUZzaNxRmvqsfp8+qFRddAU2+FLw0mTTmCpUWShMe0+Sh4zIsk q26U61ERBcPNiljnQITaoPcjWLQ47UbJKQV5JwYBSIzCWHalLkqxnRksEHg3yNdL87kG Vrcg== X-Gm-Message-State: AOAM530vEcClAMVLmFApVd7lPigeb/CSHYJ3wrJZR7xJ05vgzvapqLsW OuSUt+2hY/xpouaMFva2He3LkEOq3nc5w/p4anQ= X-Google-Smtp-Source: ABdhPJyttNKNk+YDgiSJ+woPpI6ya85Lc7AEwgbvmcj9mm23NTTfsRsgw8YGuorD2lfw4EiEDmby/9Qxcfm2qdOS3BQ= X-Received: by 2002:a17:90a:b798:: with SMTP id m24mr5003501pjr.143.1642856713472; Sat, 22 Jan 2022 05:05:13 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: "H.J. Lu" Date: Sat, 22 Jan 2022 05:04:37 -0800 Message-ID: Subject: Re: PowerPC64 DT_RELR To: Alan Modra Cc: Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3027.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Jan 2022 13:05:15 -0000 On Fri, Jan 21, 2022 at 8:28 PM Alan Modra wrote: > > On Wed, Jan 19, 2022 at 02:56:07PM -0800, H.J. Lu wrote: > > Does PowerPC64 support static PIE? If yes, it may need more linker changes. > > No. There are things in glibc that need fixing. We have small-model > toc relocs being used in assembly. This results in the linker > refusing to do toc/got indirect to toc pointer relative code > optimisation for those sequences. So we get toc/got entries with > relative relocations that result in segfaults when static-pie binaries > are trying to relocate themselves. > > What were the linker changes you thought would be necessary? > The main issue is symbols generated by linker and linker scripts. I enabled DT_RELR in glibc and binutls by default $ readelf -r elf/ld.so ... Relocation section '.relr.dyn' at offset 0xd78 contains 6 entries: 142 offsets 0000000000033000 ... diff --git a/ld/ldmain.c b/ld/ldmain.c index ea72b14a301..6ed71a74d87 100644 --- a/ld/ldmain.c +++ b/ld/ldmain.c @@ -359,6 +359,7 @@ main (int argc, char **argv) #endif link_info.start_stop_gc = false; link_info.start_stop_visibility = STV_PROTECTED; + link_info.enable_dt_relr = 1; ldfile_add_arch (""); emulation = get_emulation (argc, argv); These triggered many run-time and link-time failures. -- H.J.