mirror of
https://codeberg.org/kiss-community/repo
synced 2024-12-21 23:00:06 -07:00
libelf: Swap to elftoolchain libelf
This commit is contained in:
parent
aeb8c6bca5
commit
0195824b4f
@ -1,10 +1,48 @@
|
||||
#!/bin/sh -e
|
||||
#
|
||||
# Word splitting (for CFLAGS, CC, etc) is sadly required.
|
||||
# shellcheck disable=2086
|
||||
#
|
||||
# This package used to provide the old 'libelf' library. This had a sane
|
||||
# build system and caused us no trouble. There are two issues with the
|
||||
# old library, 1. It's been unmaintained for years. 2. The Linux kernel
|
||||
# will (soon) no longer be compatible with it.
|
||||
#
|
||||
# elfutils is not an option (as an alternative) as it heavily depends on
|
||||
# glibc. To package it for a musl based system 8 or so patches are needed
|
||||
# as well as various libc "extensions" from glibc (fts, obstack, argp).
|
||||
#
|
||||
# elftoolchain requires BSD make to build. Rather than package BSD make,
|
||||
# let's just do the equivalent ourselves in shell. This is fairly simple
|
||||
# as all we're building is 'libelf' and not the entire toolchain.
|
||||
export CFLAGS="-shared -fPIC -O2 $CFLAGS "
|
||||
|
||||
sed -i 's/-I/-isystem /g' libelf.pc.in
|
||||
# Patch unneeded in next release.
|
||||
patch -p1 < libelf-linux.patch
|
||||
|
||||
./configure \
|
||||
--prefix=/usr \
|
||||
--enable-nls=auto
|
||||
# Generate needed header file.
|
||||
common/native-elf-format > common/native-elf-format.h
|
||||
|
||||
make
|
||||
make prefix="$1/usr" install
|
||||
# Generate needed .c files using m4.
|
||||
for file in libelf/*.m4; do
|
||||
${M4:-m4} -DSRCDIR=libelf "$file" > "${file%%.m4}.c"
|
||||
done
|
||||
|
||||
# Create all objects (.o).
|
||||
for file in libelf/*.c; do
|
||||
${CC:-cc} -I./common $CFLAGS -c -o "${file%%.c}.o" "$file"
|
||||
done
|
||||
|
||||
mkdir -p "$1/usr/lib"
|
||||
|
||||
# Create shared library.
|
||||
${CC:-cc} $CFLAGS -I./common libelf/*.o -o "$1/usr/lib/libelf.so.1"
|
||||
|
||||
# Create static library.
|
||||
${AR:-ar} rc "$1/usr/lib/libelf.a" libelf/*.o
|
||||
|
||||
# Install remaining headers/files.
|
||||
ln -sf libelf.so.1 "$1/usr/lib/libelf.so"
|
||||
install -Dm644 libelf/libelf.h "$1/usr/include/libelf.h"
|
||||
install -Dm644 libelf/gelf.h "$1/usr/include/gelf.h"
|
||||
install -Dm644 common/elfdefinitions.h "$1/usr/include/elfdefinitions.h"
|
||||
|
@ -1 +1,2 @@
|
||||
591a9b4ec81c1f2042a97aa60564e0cb79d041c52faa7416acb38bc95bd2c76d libelf-0.8.13.tar.gz
|
||||
92bfe36f886024bbc433846483b026c7ce44d553b9b941a0fd13e451911ae297 elftoolchain-0.7.1.tgz
|
||||
06200f356e309558942a378de07d2cf2e0dcaa3c25cc71542599e39f265c607c libelf-linux.patch
|
||||
|
27
extra/libelf/patches/libelf-linux.patch
Normal file
27
extra/libelf/patches/libelf-linux.patch
Normal file
@ -0,0 +1,27 @@
|
||||
From 4857158172f38c6f66a51f9249c7c49d846fa7e7 Mon Sep 17 00:00:00 2001
|
||||
From: jkoshy <jkoshy@95820547-d848-0410-985e-9ae8fe0fa350>
|
||||
Date: Sun, 9 Jun 2019 17:01:37 +0000
|
||||
Subject: [PATCH] Ensure that the value of a 32-bit parameter passed to the
|
||||
ELF64_R_INFO() macro does not get lost.
|
||||
|
||||
Submitted by: Michael Forney on -developers
|
||||
|
||||
git-svn-id: svn://svn.code.sf.net/p/elftoolchain/code/trunk@3742 95820547-d848-0410-985e-9ae8fe0fa350
|
||||
---
|
||||
common/elfdefinitions.h | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/common/elfdefinitions.h b/common/elfdefinitions.h
|
||||
index 0c207226..235b66dd 100644
|
||||
--- a/common/elfdefinitions.h
|
||||
+++ b/common/elfdefinitions.h
|
||||
@@ -2806,7 +2806,8 @@ typedef struct {
|
||||
|
||||
#define ELF64_R_SYM(I) ((I) >> 32)
|
||||
#define ELF64_R_TYPE(I) ((I) & 0xFFFFFFFFUL)
|
||||
-#define ELF64_R_INFO(S,T) (((S) << 32) + ((T) & 0xFFFFFFFFUL))
|
||||
+#define ELF64_R_INFO(S,T) \
|
||||
+ (((Elf64_Xword) (S) << 32) + ((T) & 0xFFFFFFFFUL))
|
||||
|
||||
/*
|
||||
* Symbol versioning structures.
|
@ -1 +1,2 @@
|
||||
https://fossies.org/linux/misc/old/libelf-0.8.13.tar.gz
|
||||
https://downloads.sourceforge.net/sourceforge/elftoolchain/elftoolchain-0.7.1.tgz
|
||||
patches/libelf-linux.patch
|
||||
|
@ -1 +1 @@
|
||||
0.8.13 2
|
||||
0.7.1 1
|
||||
|
Loading…
Reference in New Issue
Block a user