From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 57538 invoked by alias); 17 Mar 2017 15:58:05 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 57523 invoked by uid 89); 17 Mar 2017 15:58:04 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.5 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=H*RU:209.85.216.195, Hx-spam-relays-external:209.85.216.195, management X-HELO: mail-qt0-f195.google.com Received: from mail-qt0-f195.google.com (HELO mail-qt0-f195.google.com) (209.85.216.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 Mar 2017 15:58:03 +0000 Received: by mail-qt0-f195.google.com with SMTP id r45so9976862qte.0 for ; Fri, 17 Mar 2017 08:58:04 -0700 (PDT) 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=MvSS2/nBN6jeLPAd5KfgAljL3jGM9jKgGeaNj9cSAns=; b=oPP25EQlSbwFcKsBltMscjlklOPUhA2iwB4Sq6foFeUnVYtH83m9tSaGKYv3qk2W6v ohCl4u0WfIrdfINsQoFoEXEAjm4PG2mZhIKdd+FWE8mpsSCxEr+I4ur28YdEF4kuhk5K tXBm7cSxb3NVRURwWl4/IioK8KaY/rsCsBg1qzY0N/KyO3RfQ2vFpUyVzEFjBoTl215G 8s5VG4mtZlI+5pcRWcOK5RktLwbZ17cCIQYR7fOg0mBD6OSFFImDN4/yOUz1BbWezwuI g24zcEmLDxzQZFWEe7AQfNqJk+CcAK7PoD4BsQvbU1i5RYJxwPK/EhwZAsqtQag1DWZI FAGQ== X-Gm-Message-State: AFeK/H08ilB6Kew8RseQT0BUylGL1iUGf3NFzEcrcwwynFxPBQkYJvKv8c6am40dOp76sNSBGTsN7YfQwIgZPg== X-Received: by 10.200.55.65 with SMTP id p1mr14560033qtb.202.1489766282554; Fri, 17 Mar 2017 08:58:02 -0700 (PDT) MIME-Version: 1.0 Received: by 10.55.157.2 with HTTP; Fri, 17 Mar 2017 08:58:02 -0700 (PDT) In-Reply-To: <20170317033836.GQ4983@bubble.grove.modra.org> References: <20170315224617.GA23626@intel.com> <20170317033836.GQ4983@bubble.grove.modra.org> From: "H.J. Lu" Date: Fri, 17 Mar 2017 15:58:00 -0000 Message-ID: Subject: Re: [PATCH] Support SHF_GNU_MBIND and PT_GNU_MBIND_XXX To: Alan Modra Cc: Binutils Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2017-03/txt/msg00261.txt.bz2 On Thu, Mar 16, 2017 at 8:38 PM, Alan Modra wrote: > On Wed, Mar 15, 2017 at 03:46:17PM -0700, H.J. Lu wrote: >> Any comments? > > Doesn't pass my sniff test. > > You say that management of special memory regions doesn't belong in > the kernel or glibc, but will be handled by a vendor supplied > library. In that case, why must ld.so run your magic > __gnu_mbind_setup function? If ld.so doesn't need to run __gnu_mbind_setup needs to called with memory type, address and length in executable, DSOs and dlopened DSOs before constructors are called. > __gnu_mbind_setup then there's no need to pass information to ld.so > via special segment types and flags. > > Just have the application call __gnu_mbind_setup. The function > can take the address range(s) requested as a parameter rather than > putting them into the executable headers. It shouldn't be difficult > for the linker to arrange such a call on application startup. > The goal is to place data in special memory sections via attribute. To place an uninitialized variable, foo, in a mbind bss section with memory type 1: int foo __attribute__ ((mbind(0x1))); To place a variable, foo, in a mbind data section with memory type 2: int foo __attribute__ ((mbind(0x2))) = 1; To place a read-only variable, foo, in a mbind rodata section with memory type 3: const int foo __attribute__ ((mbind(0x3))) = 1; How can linker arrange calling __gnu_mbind_setup in executable, DSOs and dlopened DSOs before constructors are called? -- H.J.