Compile tst-prelink.c without PIE [BZ #21815]

Message ID 20170802145254.GA19486@gmail.com
State New, archived
Headers

Commit Message

Lu, Hongjiu Aug. 2, 2017, 2:52 p.m. UTC
  tst-prelink.c checks for conflict with GLOB_DAT relocation against
stdout.  On i386, there is no GLOB_DAT relocation against stdout with
PIE.  Compile tst-prelink.c without PIE to generate GLOB_DAT relocation.

Any objections?

H.J.
---
	[BZ #21815]
	* elf/Makefile (CFLAGS-tst-prelink.c): New.
	(LDFLAGS-tst-prelink): Likewise.
---
 elf/Makefile | 3 +++
 1 file changed, 3 insertions(+)
  

Comments

H.J. Lu Aug. 4, 2017, 1:32 p.m. UTC | #1
On Wed, Aug 2, 2017 at 7:52 AM, H.J. Lu <hongjiu.lu@intel.com> wrote:
> tst-prelink.c checks for conflict with GLOB_DAT relocation against
> stdout.  On i386, there is no GLOB_DAT relocation against stdout with
> PIE.  Compile tst-prelink.c without PIE to generate GLOB_DAT relocation.
>
> Any objections?
>
> H.J.
> ---
>         [BZ #21815]
>         * elf/Makefile (CFLAGS-tst-prelink.c): New.
>         (LDFLAGS-tst-prelink): Likewise.
> ---
>  elf/Makefile | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/elf/Makefile b/elf/Makefile
> index e758a4c960..d39f4c5665 100644
> --- a/elf/Makefile
> +++ b/elf/Makefile
> @@ -356,6 +356,9 @@ update-all-abi: update-all-abi-ld
>
>  ifeq ($(have-glob-dat-reloc),yes)
>  tests += tst-prelink
> +# Don't compile tst-prelink.c with PIE for GLOB_DAT relocation.
> +CFLAGS-tst-prelink.c += -fno-pie
> +LDFLAGS-tst-prelink = $(no-pie-ldflag)
>  ifeq ($(run-built-tests),yes)
>  tests-special += $(objpfx)tst-prelink-cmp.out
>  endif
> --
> 2.13.3
>

I am checking it in today.
  

Patch

diff --git a/elf/Makefile b/elf/Makefile
index e758a4c960..d39f4c5665 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -356,6 +356,9 @@  update-all-abi: update-all-abi-ld
 
 ifeq ($(have-glob-dat-reloc),yes)
 tests += tst-prelink
+# Don't compile tst-prelink.c with PIE for GLOB_DAT relocation.
+CFLAGS-tst-prelink.c += -fno-pie
+LDFLAGS-tst-prelink = $(no-pie-ldflag)
 ifeq ($(run-built-tests),yes)
 tests-special += $(objpfx)tst-prelink-cmp.out
 endif