-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add HAProxy static PIE ELF. Add instructions and helper scripts to build HAProxy as a static PIE ELF. Co-authored-by: Gabriele Pappalardo <leleattolo99@gmail.com> Co-authored-by: Alberto Zurini <alberto.zurini@gmail.com> Co-authored-by: Federico Bertossi <livebymax@gmail.com> Signed-off-by: Alessandro Grassi <alessandrograssi17@gmail.com>
- Loading branch information
1 parent
5974451
commit b1a77cd
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- Makefile_OLD.txt 2022-10-23 16:24:37.113951164 +0200 | ||
+++ Makefile 2022-10-23 15:25:44.686153369 +0200 | ||
@@ -326,13 +326,13 @@ | ||
# These CFLAGS contain general optimization options, CPU-specific optimizations | ||
# and debug flags. They may be overridden by some distributions which prefer to | ||
# set all of them at once instead of playing with the CPU and DEBUG variables. | ||
-CFLAGS = $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS) $(SPEC_CFLAGS) | ||
+CFLAGS = -fPIC $(ARCH_FLAGS) $(CPU_CFLAGS) $(DEBUG_CFLAGS) $(SPEC_CFLAGS) | ||
|
||
#### Common LDFLAGS | ||
# These LDFLAGS are used as the first "ld" options, regardless of any library | ||
# path or any other option. They may be changed to add any linker-specific | ||
# option at the beginning of the ld command line. | ||
-LDFLAGS = $(ARCH_FLAGS) -g | ||
+LDFLAGS = -static-pie $(ARCH_FLAGS) -g | ||
|
||
#### list of all "USE_*" options. These ones must be updated if new options are | ||
# added, so that the relevant options are properly added to the CFLAGS and to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Build HAProxy as static PIE | ||
|
||
Build the [HAProxy](https://git.haproxy.org/): The Reliable, High Performance TCP/HTTP Load Balancer as a static PIE ELF running on Linux. | ||
|
||
## Requirements | ||
|
||
Make sure the following packages are installed: | ||
* gcc >= 8 (required for the `-static-pie` linking option) | ||
* autotools | ||
* GNU Make | ||
* zlib development files | ||
* OpenSSL development files | ||
|
||
For Ubuntu, run the command below to install all requirements: | ||
|
||
``` | ||
$ sudo apt install build-essential zlib1g-dev libssl-dev | ||
``` | ||
|
||
## Build | ||
|
||
The `HAProxy` static PIE ELF is located in the current folder. | ||
If you want to rebuild it, run: | ||
|
||
``` | ||
$ ./build.sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
\#!/bin/bash | ||
|
||
# Clean up. | ||
rm -fr haproxy-git | ||
|
||
echo -n "Downloading HAProxy ... " | ||
git clone https://github.com/haproxy/haproxy.git haproxy-git | ||
echo "" | ||
echo -n "Building HAProxy ... " | ||
pushd haproxy-git > /dev/null 2>&1 | ||
patch Makefile < ../Makefile.patch | ||
make TARGET=linux-glibc-legacy | ||
popd > /dev/null 2>&1 | ||
|
||
cp haproxy-git/haproxy . | ||
rm -fr haproxy-git |
Binary file not shown.