From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2178) id 74B863858407; Fri, 4 Nov 2022 18:50:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 74B863858407 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1667587807; bh=Fu0i8fFERkl8MJhUuHRzgnZt8lZqMtVhmMQgvzrG6so=; h=From:To:Subject:Date:From; b=mWugrHQ5I5W93P1Bhb7ZTKah4aFLJh5UjIDQU4bt5JZvD7caG4BHcwmdrrMnExgya cvVAOdmNNEdrLLHwINfYqiOz5GnTEdInpb1EJ0Mjg4Src0Z/x8PaCGpdesw71U4xJj GpliAGnKmjr5tGxD87x/c0oQpNInUN+Bi5eCU5ms= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Florian Weimer To: glibc-cvs@sourceware.org Subject: [glibc] elf: Disable some subtests of ifuncmain1, ifuncmain5 for !PIE X-Act-Checkin: glibc X-Git-Author: Florian Weimer X-Git-Refname: refs/heads/master X-Git-Oldrev: 2ff48a4025515e93d722947a9eabb114f4a65b22 X-Git-Newrev: 9cc9d61ee12f2f8620d8e0ea3c42af02bf07fe1e Message-Id: <20221104185007.74B863858407@sourceware.org> Date: Fri, 4 Nov 2022 18:50:07 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=9cc9d61ee12f2f8620d8e0ea3c42af02bf07fe1e commit 9cc9d61ee12f2f8620d8e0ea3c42af02bf07fe1e Author: Florian Weimer Date: Fri Nov 4 18:37:16 2022 +0100 elf: Disable some subtests of ifuncmain1, ifuncmain5 for !PIE Diff: --- elf/ifuncmain1.c | 13 +++++++++++++ elf/ifuncmain5.c | 9 +++++++++ 2 files changed, 22 insertions(+) diff --git a/elf/ifuncmain1.c b/elf/ifuncmain1.c index 747fc02648..6effce3d77 100644 --- a/elf/ifuncmain1.c +++ b/elf/ifuncmain1.c @@ -19,7 +19,14 @@ typedef int (*foo_p) (void); #endif foo_p foo_ptr = foo; + +/* Address-significant access to protected symbols is not supported in + position-dependent mode on several architectures because GCC + generates relocations that assume that the address is local to the + main program. */ +#ifdef __PIE__ foo_p foo_procted_ptr = foo_protected; +#endif extern foo_p get_foo_p (void); extern foo_p get_foo_hidden_p (void); @@ -37,12 +44,16 @@ main (void) if ((*foo_ptr) () != -1) abort (); +#ifdef __PIE__ if (foo_procted_ptr != foo_protected) abort (); +#endif if (foo_protected () != 0) abort (); +#ifdef __PIE__ if ((*foo_procted_ptr) () != 0) abort (); +#endif p = get_foo_p (); if (p != foo) @@ -55,8 +66,10 @@ main (void) abort (); p = get_foo_protected_p (); +#ifdef __PIE__ if (p != foo_protected) abort (); +#endif if (ret_foo_protected != 0 || (*p) () != ret_foo_protected) abort (); diff --git a/elf/ifuncmain5.c b/elf/ifuncmain5.c index f398085cb4..6fda768fb6 100644 --- a/elf/ifuncmain5.c +++ b/elf/ifuncmain5.c @@ -14,12 +14,19 @@ get_foo (void) return foo; } + +/* Address-significant access to protected symbols is not supported in + position-dependent mode on several architectures because GCC + generates relocations that assume that the address is local to the + main program. */ +#ifdef __PIE__ foo_p __attribute__ ((noinline)) get_foo_protected (void) { return foo_protected; } +#endif int main (void) @@ -30,9 +37,11 @@ main (void) if ((*p) () != -1) abort (); +#ifdef __PIE__ p = get_foo_protected (); if ((*p) () != 0) abort (); +#endif return 0; }