From 1c443aa1c7b8c8bcafde796f2e41e4abce3793e1 Mon Sep 17 00:00:00 2001
From: matoro <matoro@users.noreply.github.com>
Date: Sat, 4 Nov 2023 20:01:22 -0400
Subject: [PATCH] Fix page size on Alpha

All tests pass.

Also explicitly specifies -no-pie for executables which should have it
disabled, to be compatible with gccs built with --enable-default-pie.
---
 src/patchelf.cc                        |   1 +
 tests/Makefile.am                      |   4 +++-
 tests/no-rpath-prebuild/no-rpath-alpha | Bin 0 -> 70600 bytes
 3 files changed, 4 insertions(+), 1 deletion(-)
 create mode 100755 tests/no-rpath-prebuild/no-rpath-alpha

Index: patchelf-0.18.0/src/patchelf.cc
===================================================================
--- patchelf-0.18.0.orig/src/patchelf.cc	2025-04-05 15:29:50.600982558 -0400
+++ patchelf-0.18.0/src/patchelf.cc	2025-04-05 15:41:41.000000000 -0400
@@ -366,6 +366,7 @@
     // requirements. There is no authoritative list of these values. The
     // current list is extracted from GNU gold's source code (abi_pagesize).
     switch (rdi(hdr()->e_machine)) {
+      case EM_ALPHA:
       case EM_IA_64:
       case EM_MIPS:
       case EM_PPC:
Index: patchelf-0.18.0/tests/Makefile.am
===================================================================
--- patchelf-0.18.0.orig/tests/Makefile.am	2025-04-05 15:29:50.600982558 -0400
+++ patchelf-0.18.0/tests/Makefile.am	2025-04-05 15:29:50.600982558 -0400
@@ -80,7 +81,7 @@
 simple_SOURCES = simple.c
 # no -fpic for simple.o
 simple_CFLAGS =
-simple_LDFLAGS = -Wl,-z,noexecstack
+simple_LDFLAGS = -Wl,-z,noexecstack -no-pie
 
 simple_pie_SOURCES = simple.c
 simple_pie_CFLAGS = -fPIC -pie
@@ -171,6 +172,7 @@
 no_rpath_SOURCES = no-rpath.c
 # no -fpic for no-rpath.o
 no_rpath_CFLAGS =
+no_rpath_LDFLAGS = -no-pie
 
 contiguous_note_sections_SOURCES = contiguous-note-sections.s contiguous-note-sections.ld
 contiguous_note_sections_LDFLAGS = -nostdlib -T $(srcdir)/contiguous-note-sections.ld
