From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16529 invoked by alias); 1 Nov 2017 12:46:24 -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 16511 invoked by uid 89); 1 Nov 2017 12:46:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 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=Hx-languages-length:1356, her, his X-HELO: mail-oi0-f48.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:from:date:message-id:subject:to; bh=lPNRStgzIAjkuLGdwJvUud0lUDfi4mj7hsq7wb/1Ajo=; b=LrW7/7XSRd4OaQ6PYX/HgRYmt73+HwOay92qLysVxosz7Yoc/X7T6cVQaIclI5jiAR cL7SJNATE3ojeMlzC6qyqKU5AO6uPZxHfTThmp7uoD5KQXLxGy6X4I5HbqbRIJipIjWc wf45K2MbQ9olIudbol0FD8N1E+NMrcGjLatzBTk90hOChHM3x6ReoVe3dAE2a9odRvkA QYH2B8UjHKL8CXElfDaTum7RyZ6YSg9//mKLdRZDLogjMrKHEyixLXO9Im3F97DuG1l0 w/K1JyIEDInhSHBo0oY9MjHz1gp0sT5/42c8q4+2wHaBk2zyrUB+u3A51riAfRQzKHsr oCSg== X-Gm-Message-State: AMCzsaUzd+z05sVqz5i2PQpiRLpcLyo5IBgQAmb968f6TtxqE5DvFdM2 6B3QzV1Gme2M/+WPMGxBljFp6rv3rA3Stb3d790Q4Q== X-Google-Smtp-Source: ABhQp+TjyMUwwgnL5iB+sFjL9lEjQcuUyyTWu0OiqDSg2SRqhQ3BhnYOCPg/joLge39a2hbmqq/5zFK0nYK9M68BPZU= X-Received: by 10.157.43.104 with SMTP id f37mr2880461otd.491.1509540371547; Wed, 01 Nov 2017 05:46:11 -0700 (PDT) MIME-Version: 1.0 From: "H.J. Lu" Date: Wed, 01 Nov 2017 12:46:00 -0000 Message-ID: Subject: PING^N: [PATCH] Add --enable-static-pie to build static PIE [BZ #19574] To: GNU C Library Content-Type: text/plain; charset="UTF-8" X-SW-Source: 2017-11/txt/msg00017.txt.bz2 I'd like to get static PIE: https://sourceware.org/ml/libc-alpha/2017-10/msg00587.html Static PIE is simply an extension of ld.so. The following changes are made for static PIE: 1. Add a new function, _dl_relocate_static_pie, to: a. Get the run-time load address. b. Read the dynamic section. c. Perform dynamic relocations. Dynamic linker also performs these steps. But static PIE doesn't load any shared objects. 2. Call _dl_relocate_static_pie at entrance of LIBC_START_MAIN in libc.a. crt1.o, which is used to create dynamic and non-PIE static executables, is updated to include a dummy _dl_relocate_static_pie. Pcrt1.o is added to create static PIE, which will link in the real _dl_relocate_static_pie. gPcrt1.o is also added to create static PIE with -pg. The main issues with static PIE are 1. Many binutils targets don't handle PIE properly. I opened a few binutils bugs for PIE. 2. Many assembly codes assumes PIC == SHARED. I opened a glibc bug for it. 3. Some dl-machine.h files may not handle undefined weak symbols in PIE properly. But we will never know for sure unless we build static PIE. I'd like to add static PIE support into glibc 2.27, which works on i686 and x86-64. I will help other target developers get static PIE working for his/her target. -- H.J.