From patchwork Thu Apr 25 12:33:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 1090733 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=sourceware.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=libc-alpha-return-101611-incoming=patchwork.ozlabs.org@sourceware.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.b="bBCuEfeC"; dkim-atps=neutral Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 44qc7D0LN9z9s9G for ; Thu, 25 Apr 2019 22:33:59 +1000 (AEST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; q=dns; s=default; b=ailxzOj/QgJp2fj1/VPLzj4G6Ty5R U5/Lq4Xb1Adv4VfNA8/2ppSmgP0Q6/FTcAIrhTFZg7Zf0eJf1YVfqSyX3K0eSe9Y 69g1BRNUsFwHKQekdmaUV7ZYMqguUVlU01f9SGh6hif/3wQthongNNwR136QdeeW M9wywCkabB1kpo= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:from:to:subject:date:message-id:mime-version :content-type; s=default; bh=0iP6d4qKYIC9f07gZL1H3FUW5N4=; b=bBC uEfeC6t8rKAFrxqOxA+czK3ZIXe9yBistd9EL3+e9/VLzNvq40uRaQMek9mJ0Zkh P6ArivXbLjFRNcDIBrbVkn0ZLQi8R1t4touAp0ZUc7MXsAktcm/Xh3za+CIP7jI+ efSfmlRtX0nMzY+3LDU/rllvaOzSNYPvwDODLuHo= Received: (qmail 519 invoked by alias); 25 Apr 2019 12:33:54 -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 511 invoked by uid 89); 25 Apr 2019 12:33:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-18.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mx1.redhat.com From: Florian Weimer To: libc-alpha@sourceware.org Subject: [PATCH] Makeconfig: Move $(CC) to +link command variables Date: Thu, 25 Apr 2019 14:33:49 +0200 Message-ID: <87a7geclhu.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 This change is needed to add linker flags which come very early in the command linke (before LDFLAGS) and are not applied to test programs (only to installed programs). 2019-04-25 Florian Weimer * Makeconfig (+link-pie-before-libc): Remove $(CC). (+link-pie, +link-pie-tests, +link-pie-printers-tests): Add $(CC). (+link-static-before-libc): Remove $(CC). (+link-static, +link-static-tests): Add $(CC). (+link-before-libc): Remove $(CC). (+link, +link-pie, +link-pie-printers): Add $(CC). Reviewed-by: Carlos O'Donell diff --git a/Makeconfig b/Makeconfig index 89443e9a90..92c9b59bb5 100644 --- a/Makeconfig +++ b/Makeconfig @@ -415,7 +415,7 @@ link-extra-libs-tests = $(libsupport) # Command for linking PIE programs with the C library. ifndef +link-pie -+link-pie-before-libc = $(CC) $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \ ++link-pie-before-libc = $(if $($(@F)-no-pie),$(no-pie-ldflag),-pie) \ -Wl,-O1 -nostdlib -nostartfiles -o $@ \ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ @@ -428,23 +428,24 @@ ifndef +link-pie $(link-extra-libs) +link-pie-after-libc = $(+postctorS) $(+postinit) define +link-pie -$(+link-pie-before-libc) $(rtld-LDFLAGS) $(link-extra-flags) $(link-libc) $(+link-pie-after-libc) +$(CC) $(+link-pie-before-libc) $(rtld-LDFLAGS) $(link-extra-flags) \ + $(link-libc) $(+link-pie-after-libc) $(call after-link,$@) endef define +link-pie-tests -$(+link-pie-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \ - $(+link-pie-after-libc) +$(CC) $(+link-pie-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \ + $(+link-pie-after-libc) $(call after-link,$@) endef define +link-pie-printers-tests -$(+link-pie-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \ - $(+link-pie-after-libc) +$(CC) $(+link-pie-before-libc) $(built-rtld-LDFLAGS) \ + $(link-libc-printers-tests) $(+link-pie-after-libc) $(call after-link,$@) endef endif # Command for statically linking programs with the C library. ifndef +link-static -+link-static-before-libc = $(CC) -nostdlib -nostartfiles -static -o $@ \ ++link-static-before-libc = -nostdlib -nostartfiles -static -o $@ \ $(if $($(@F)-no-pie),$(no-pie-ldflag),$(default-pie-ldflag)) \ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ $(firstword $(CRT-$(@F)) $(csu-objpfx)$(real-static-start-installed-name)) \ @@ -456,11 +457,13 @@ ifndef +link-static $(link-extra-libs-static) +link-static-after-libc = $(+postctorT) $(+postinit) define +link-static -$(+link-static-before-libc) $(link-extra-flags) $(link-libc-static) $(+link-static-after-libc) +$(CC) $(+link-static-before-libc) $(link-extra-flags) $(link-libc-static) \ + $(+link-static-after-libc) $(call after-link,$@) endef define +link-static-tests -$(+link-static-before-libc) $(link-libc-static-tests) $(+link-static-after-libc) +$(CC) $(+link-static-before-libc) $(link-libc-static-tests) \ + $(+link-static-after-libc) $(call after-link,$@) endef endif @@ -475,7 +478,7 @@ ifeq (yes,$(build-pie-default)) +link-tests = $(+link-pie-tests) +link-printers-tests = $(+link-pie-printers-tests) else # not build-pie-default -+link-before-libc = $(CC) -nostdlib -nostartfiles -o $@ \ ++link-before-libc = -nostdlib -nostartfiles -o $@ \ $(sysdep-LDFLAGS) $(LDFLAGS) $(LDFLAGS-$(@F)) \ $(combreloc-LDFLAGS) $(relro-LDFLAGS) $(hashstyle-LDFLAGS) \ $(firstword $(CRT-$(@F)) $(csu-objpfx)$(start-installed-name)) \ @@ -487,16 +490,17 @@ else # not build-pie-default $(link-extra-libs) +link-after-libc = $(+postctor) $(+postinit) define +link -$(+link-before-libc) $(rtld-LDFLAGS) $(link-extra-flags) $(link-libc) $(+link-after-libc) +$(CC) $(+link-before-libc) $(rtld-LDFLAGS) $(link-extra-flags) $(link-libc) \ + $(+link-after-libc) $(call after-link,$@) endef define +link-tests -$(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \ +$(CC) $(+link-before-libc) $(rtld-tests-LDFLAGS) $(link-libc-tests) \ $(+link-after-libc) $(call after-link,$@) endef define +link-printers-tests -$(+link-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \ +$(CC) $(+link-before-libc) $(built-rtld-LDFLAGS) $(link-libc-printers-tests) \ $(+link-after-libc) $(call after-link,$@) endef