Add elfutils, prelink

git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1049 311d38ba-8fff-0310-9ca6-ca027cbcb966
This commit is contained in:
Richard Purdie 2006-12-19 19:24:24 +00:00
parent 01303ccecf
commit a8b7d094ed
9 changed files with 721 additions and 0 deletions

View File

@ -0,0 +1,132 @@
Index: elfutils-0.108/configure.ac
===================================================================
--- elfutils-0.108.orig/configure.ac 2006-04-10 19:18:34.000000000 +0100
+++ elfutils-0.108/configure.ac 2006-04-10 19:19:33.000000000 +0100
@@ -49,6 +49,10 @@
dnl Add all the languages for which translations are available.
ALL_LINGUAS=
+if test X"$CFLAGS" = X; then
+ CFLAGS="-Wall -Werror -g -O2"
+fi
+
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_YACC
Index: elfutils-0.108/lib/Makefile.am
===================================================================
--- elfutils-0.108.orig/lib/Makefile.am 2006-04-10 19:18:34.000000000 +0100
+++ elfutils-0.108/lib/Makefile.am 2006-04-10 19:19:33.000000000 +0100
@@ -21,7 +21,7 @@
else
AM_CFLAGS =
endif
-AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra $($(*F)_CFLAGS)
+AM_CFLAGS += -fpic -Wshadow -Wunused $($(*F)_CFLAGS)
INCLUDES = -I$(srcdir)/../libelf -I..
noinst_LIBRARIES = libeu.a
Index: elfutils-0.108/libasm/Makefile.am
===================================================================
--- elfutils-0.108.orig/libasm/Makefile.am 2006-04-10 19:18:34.000000000 +0100
+++ elfutils-0.108/libasm/Makefile.am 2006-04-10 19:19:33.000000000 +0100
@@ -18,7 +18,7 @@
else
AM_CFLAGS =
endif
-AM_CFLAGS += -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2
+AM_CFLAGS += -Wshadow -Wunused -Wformat=2
INCLUDES = -I. -I$(srcdir) -I.. -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl \
-I$(top_srcdir)/lib
GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
Index: elfutils-0.108/libcpu/Makefile.am
===================================================================
--- elfutils-0.108.orig/libcpu/Makefile.am 2006-04-10 19:18:34.000000000 +0100
+++ elfutils-0.108/libcpu/Makefile.am 2006-04-10 19:19:33.000000000 +0100
@@ -13,7 +13,7 @@
## 3001 King Ranch Road, Ukiah, CA 95482.
##
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H
-AM_CFLAGS = -Wall -Wshadow -Werror -Wextra -Wformat=2 -Wunused
+AM_CFLAGS = -Wshadow -Wformat=2 -Wunused
INCLUDES = -I$(srcdir)
noinst_LIBRARIES = libcpu_i386.a
Index: elfutils-0.108/libdw/Makefile.am
===================================================================
--- elfutils-0.108.orig/libdw/Makefile.am 2006-04-10 19:18:34.000000000 +0100
+++ elfutils-0.108/libdw/Makefile.am 2006-04-10 19:19:33.000000000 +0100
@@ -18,7 +18,7 @@
else
AM_CFLAGS =
endif
-AM_CFLAGS += -Wall -Werror -Wshadow -Wunused -Wformat=2 -Wextra -std=gnu99
+AM_CFLAGS += -Wshadow -Wunused -Wformat=2 -std=gnu99
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib
VERSION = 1
Index: elfutils-0.108/libebl/Makefile.am
===================================================================
--- elfutils-0.108.orig/libebl/Makefile.am 2006-04-10 19:18:34.000000000 +0100
+++ elfutils-0.108/libebl/Makefile.am 2006-04-10 19:19:33.000000000 +0100
@@ -18,7 +18,7 @@
else
AM_CFLAGS =
endif
-AM_CFLAGS += -fpic -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 \
+AM_CFLAGS += -fpic -Wshadow -Wunused -Wformat=2 \
-std=gnu99
INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/lib -I..
Index: elfutils-0.108/libelf/Makefile.am
===================================================================
--- elfutils-0.108.orig/libelf/Makefile.am 2006-04-10 19:18:34.000000000 +0100
+++ elfutils-0.108/libelf/Makefile.am 2006-04-10 19:19:33.000000000 +0100
@@ -21,7 +21,7 @@
else
AM_CFLAGS =
endif
-AM_CFLAGS += -Wall -Wshadow -Werror -Wunused -Wextra -Wformat=2 -std=gnu99 \
+AM_CFLAGS += -Wshadow -Wunused -Wformat=2 -std=gnu99 \
$($(*F)_CFLAGS)
INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I..
GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
Index: elfutils-0.108/src/Makefile.am
===================================================================
--- elfutils-0.108.orig/src/Makefile.am 2006-04-10 19:18:34.000000000 +0100
+++ elfutils-0.108/src/Makefile.am 2006-04-10 19:20:19.000000000 +0100
@@ -15,14 +15,12 @@
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H $(YYDEBUG) \
-DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\"
if MUDFLAP
-AM_CFLAGS = -Wall -Wshadow -Wunused -Wextra -std=gnu99 -fmudflap \
+AM_CFLAGS = -Wshadow -Wunused -std=gnu99 -fmudflap \
$(native_ld_cflags) $(if $($(*F)_no_Wunused),,-Wunused) \
$(if $($(*F)_no_Wformat),,-Wformat=2)
else
-AM_CFLAGS = -Wall -Wshadow -std=gnu99 $(native_ld_cflags) \
- $(if $($(*F)_no_Werror),,-Werror) \
- $(if $($(*F)_no_Wunused),,-Wunused -Wextra) \
- $(if $($(*F)_no_Wformat),,-Wformat=2)
+AM_CFLAGS = -Wshadow -std=gnu99 $(native_ld_cflags) \
+ $(if $($(*F)_no_Werror),,-Werror)
endif
if MUDFLAP
libmudflap = -lmudflap
Index: elfutils-0.108/tests/Makefile.am
===================================================================
--- elfutils-0.108.orig/tests/Makefile.am 2006-04-10 19:18:34.000000000 +0100
+++ elfutils-0.108/tests/Makefile.am 2006-04-10 19:19:33.000000000 +0100
@@ -14,10 +14,10 @@
##
DEFS = -DHAVE_CONFIG_H -D_GNU_SOURCE
if MUDFLAP
-AM_CFLAGS = -Wall -Werror -std=gnu99 -fmudflap\
+AM_CFLAGS = -std=gnu99 -fmudflap\
$(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2)
else
-AM_CFLAGS = -Wall -Werror -std=gnu99 \
+AM_CFLAGS = -std=gnu99 \
$(if $($(*F)_no_Wformat),-Wno-format,-Wformat=2)
AM_LDFLAGS = -Wl,-rpath,\$$ORIGIN/../libasm:\$$ORIGIN/../libdw:\$$ORIGIN/../libebl:\$$ORIGIN/../libelf
endif

View File

@ -0,0 +1,98 @@
--- elfutils-0.89/configure.ac~warnings.patch 2003-09-26 02:04:04.000000000 -0400
+++ elfutils-0.89/configure.ac 2004-05-01 00:16:33.000000000 -0400
@@ -28,6 +28,10 @@
ALL_LINGUAS=
+if test X"$CFLAGS" = X; then
+ CFLAGS="-Wall -Werror -g -O2"
+fi
+
AC_PROG_CC
AC_PROG_CPP
AC_PROG_GCC_TRADITIONAL
--- elfutils-0.89/./lib/Makefile.am~warnings.patch 2003-09-22 18:57:58.000000000 -0400
+++ elfutils-0.89/./lib/Makefile.am 2004-05-01 00:12:43.000000000 -0400
@@ -14,7 +14,7 @@
## 3001 King Ranch Road, Ukiah, CA 95482.
##
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H
-AM_CFLAGS = -Wall -Werror -fpic
+AM_CFLAGS = -fpic
INCLUDES = -I$(srcdir)/../libelf -I..
noinst_LIBRARIES = libeu.a
--- elfutils-0.89/./libelf/Makefile.am~warnings.patch 2003-08-12 02:45:24.000000000 -0400
+++ elfutils-0.89/./libelf/Makefile.am 2004-05-01 00:12:43.000000000 -0400
@@ -14,7 +14,6 @@
## 3001 King Ranch Road, Ukiah, CA 95482.
##
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H
-AM_CFLAGS = -Wall -Werror
INCLUDES = -I$(srcdir) -I$(top_srcdir)/lib -I..
GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
VERSION = 1
--- elfutils-0.89/./libebl/Makefile.am~warnings.patch 2003-09-22 18:53:17.000000000 -0400
+++ elfutils-0.89/./libebl/Makefile.am 2004-05-01 00:12:43.000000000 -0400
@@ -14,7 +14,7 @@
## 3001 King Ranch Road, Ukiah, CA 95482.
##
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall
-AM_CFLAGS = -Wall -Werror -DOBJDIR=\"$(shell pwd)\" -fpic
+AM_CFLAGS = -DOBJDIR=\"$(shell pwd)\" -fpic
INCLUDES = -I$(srcdir) -I$(top_srcdir)/libelf -I$(top_srcdir)/lib -I..
VERSION = 1
PACKAGE_VERSION = @PACKAGE_VERSION@
--- elfutils-0.89/./libdwarf/Makefile.am~warnings.patch 2003-08-12 02:46:05.000000000 -0400
+++ elfutils-0.89/./libdwarf/Makefile.am 2004-05-01 00:12:43.000000000 -0400
@@ -14,7 +14,6 @@
## 3001 King Ranch Road, Ukiah, CA 95482.
##
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -DDWARF_DEBUG
-AM_CFLAGS = -Wall -Werror
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib
VERSION = 1
--- elfutils-0.89/./libdw/Makefile.am~warnings.patch 2003-08-12 02:46:18.000000000 -0400
+++ elfutils-0.89/./libdw/Makefile.am 2004-05-01 00:12:43.000000000 -0400
@@ -17,7 +17,6 @@
## Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
##
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H
-AM_CFLAGS = -Wall -Werror -Wshadow
INCLUDES = -I. -I$(srcdir) -I$(srcdir)/../libelf -I.. -I$(srcdir)/../lib
VERSION = 1
--- elfutils-0.89/./libasm/Makefile.am~warnings.patch 2003-08-13 05:21:25.000000000 -0400
+++ elfutils-0.89/./libasm/Makefile.am 2004-05-01 00:12:43.000000000 -0400
@@ -14,7 +14,6 @@
## 3001 King Ranch Road, Ukiah, CA 95482.
##
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H
-AM_CFLAGS = -Wall -Werror
INCLUDES = -I. -I$(srcdir) -I.. -I$(top_srcdir)/libelf -I$(top_srcdir)/libebl \
-I$(top_srcdir)/lib
GCC_INCLUDE = -I$(shell $(CC) -print-file-name=include)
--- elfutils-0.89/./src/Makefile.am~warnings.patch 2003-09-22 18:57:09.000000000 -0400
+++ elfutils-0.89/./src/Makefile.am 2004-05-01 00:12:43.000000000 -0400
@@ -14,8 +14,8 @@
## 3001 King Ranch Road, Ukiah, CA 95482.
##
DEFS = -D_GNU_SOURCE -DHAVE_CONFIG_H -Wall -Wshadow $(YYDEBUG) \
- $(if $($(*F)_no_Werror),,-Werror) $(native_ld_cflags)
-AM_CFLAGS = -Wall -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\"
+ $(if $(filter -Werror,$(CFLAGS)),$(if $($(*F)_no_Werror),,-Werror)) $(native_ld_cflags)
+AM_CFLAGS = -DSRCDIR=\"$(shell cd $(srcdir);pwd)\" -DOBJDIR=\"$(shell pwd)\"
INCLUDES = -I$(srcdir) -I$(srcdir)/../libelf -I$(srcdir)/../libebl -I$(srcdir)/../lib -I$(srcdir)/../libdwarf -I..
YACC = @YACC@ -d
--- elfutils-0.89/./tests/Makefile.am~warnings.patch 2003-08-13 05:19:04.000000000 -0400
+++ elfutils-0.89/./tests/Makefile.am 2004-05-01 00:12:43.000000000 -0400
@@ -14,7 +14,6 @@
## 3001 King Ranch Road, Ukiah, CA 95482.
##
DEFS = -DHAVE_CONFIG_H -D_GNU_SOURCE
-AM_CFLAGS = -Wall -Werror
AM_LDFLAGS = -Wl,-rpath,\$$ORIGIN/../libasm:\$$ORIGIN/../libdwarf:\$$ORIGIN/../libdw:\$$ORIGIN/../libebl:\$$ORIGIN/../libelf
INCLUDES = -I$(top_srcdir)/libasm -I$(top_srcdir)/libdwarf \
-I$(top_srcdir)/libdw \

View File

@ -0,0 +1,36 @@
SECTION = "base"
LICENSE = "OSL"
DESCRIPTION = "A collection of utilities and DSOs to handle compiled objects."
DEPENDS = "libtool"
SRC_URI = "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/elfutils-${PV}.tar.gz \
file://warnings.patch;patch=1"
inherit autotools
SOV = "${PV}"
do_stage () {
install -m 0644 libelf/libelf.a ${STAGING_LIBDIR}/libelf.a
install -m 0755 libelf/libelf.so.1 ${STAGING_LIBDIR}/libelf-${SOV}.so
ln -sf libelf-${SOV}.so ${STAGING_LIBDIR}/libelf.so.1
ln -sf libelf.so.1 ${STAGING_LIBDIR}/libelf.so
install -m 0644 libasm/libasm.a ${STAGING_LIBDIR}/libasm.a
install -m 0755 libasm/libasm.so.1 ${STAGING_LIBDIR}/libasm-${SOV}.so
ln -sf libasm-${SOV}.so ${STAGING_LIBDIR}/libasm.so.1
ln -sf libasm.so.1 ${STAGING_LIBDIR}/libasm.so
install -m 0644 libdw/libdw.a ${STAGING_LIBDIR}/libdw.a
install -m 0755 libdw/libdw.so.1 ${STAGING_LIBDIR}/libdw-${SOV}.so
ln -sf libdw-${SOV}.so ${STAGING_LIBDIR}/libdw.so.1
ln -sf libdw.so.1 ${STAGING_LIBDIR}/libdw.so
install -m 0644 libebl/libebl.a ${STAGING_LIBDIR}/libebl.a
install -d ${STAGING_LIBDIR}/elfutils/
install -m 0755 libebl/libebl_*.so ${STAGING_LIBDIR}/elfutils/
install -m 0644 ${S}/libelf/libelf.h ${STAGING_INCDIR}/
install -m 0644 ${S}/libelf/gelf.h ${STAGING_INCDIR}/
install -m 0644 ${S}/libelf/nlist.h ${STAGING_INCDIR}/
install -d ${STAGING_INCDIR}/elfutils
install -m 0644 ${S}/libebl/libebl.h ${STAGING_INCDIR}/elfutils/
install -m 0644 ${S}/libdw/libdw.h ${STAGING_INCDIR}/elfutils/
install -m 0644 ${S}/libasm/libasm.h ${STAGING_INCDIR}/elfutils/
}

View File

@ -0,0 +1,43 @@
SECTION = "base"
LICENSE = "OSL"
DESCRIPTION = "A collection of utilities and DSOs to handle compiled objects."
DEPENDS = "libtool"
SRC_URI = "http://distro.ibiblio.org/pub/linux/distributions/gentoo/distfiles/elfutils-${PV}.tar.gz \
file://warnings.patch;patch=1"
inherit autotools
SOV = "${PV}"
do_stage () {
install -m 0644 libelf/libelf.a ${STAGING_LIBDIR}/libelf.a
install -m 0755 libelf/libelf.so.1 ${STAGING_LIBDIR}/libelf-${SOV}.so
ln -sf libelf-${SOV}.so ${STAGING_LIBDIR}/libelf.so.1
ln -sf libelf.so.1 ${STAGING_LIBDIR}/libelf.so
install -m 0644 libasm/libasm.a ${STAGING_LIBDIR}/libasm.a
install -m 0755 libasm/libasm.so.1 ${STAGING_LIBDIR}/libasm-${SOV}.so
ln -sf libasm-${SOV}.so ${STAGING_LIBDIR}/libasm.so.1
ln -sf libasm.so.1 ${STAGING_LIBDIR}/libasm.so
install -m 0644 libdw/libdw.a ${STAGING_LIBDIR}/libdw.a
install -m 0755 libdw/libdw.so.1 ${STAGING_LIBDIR}/libdw-${SOV}.so
ln -sf libdw-${SOV}.so ${STAGING_LIBDIR}/libdw.so.1
ln -sf libdw.so.1 ${STAGING_LIBDIR}/libdw.so
install -m 0644 libebl/libebl.a ${STAGING_LIBDIR}/libebl.a
install -d ${STAGING_LIBDIR}/elfutils/
install -m 0755 libebl/libebl_*.so ${STAGING_LIBDIR}/elfutils/
install -m 0644 libdwarf/libdwarf.a ${STAGING_LIBDIR}/libdwarf.a
install -m 0755 libdwarf/libdwarf.so.1 ${STAGING_LIBDIR}/libdwarf-${SOV}.so
ln -sf libdwarf-${SOV}.so ${STAGING_LIBDIR}/libdwarf.so.1
ln -sf libdwarf.so.1 ${STAGING_LIBDIR}/libdwarf.so
install -m 0644 ${S}/libelf/libelf.h ${STAGING_INCDIR}/
install -m 0644 ${S}/libelf/gelf.h ${STAGING_INCDIR}/
install -m 0644 ${S}/libelf/nlist.h ${STAGING_INCDIR}/
install -m 0644 ${S}/libdwarf/dwarf.h ${STAGING_INCDIR}/
install -d ${STAGING_INCDIR}/elfutils
install -m 0644 ${S}/libebl/libebl.h ${STAGING_INCDIR}/elfutils/
install -m 0644 ${S}/libebl/elf-knowledge.h ${STAGING_INCDIR}/elfutils/
install -m 0644 ${S}/libdwarf/libdwarf.h ${STAGING_INCDIR}/elfutils/
install -m 0644 ${S}/libdw/libdw.h ${STAGING_INCDIR}/elfutils/
install -m 0644 ${S}/libasm/libasm.h ${STAGING_INCDIR}/elfutils/
}

View File

@ -0,0 +1,286 @@
Index: prelink-0.0.20050901/src/arch-arm.c
===================================================================
--- prelink-0.0.20050901.orig/src/arch-arm.c 2004-09-30 17:07:57.000000000 +0100
+++ prelink-0.0.20050901/src/arch-arm.c 2006-04-07 14:41:25.000000000 +0100
@@ -145,6 +145,24 @@
error (0, 0, "%s: R_ARM_PC24 relocs with non-zero addend should not be present in prelinked REL sections",
dso->filename);
return 1;
+ case R_ARM_TLS_DTPOFF32:
+ write_le32 (dso, rel->r_offset, value);
+ break;
+ /* DTPMOD32 and TPOFF32 is impossible to predict unless prelink
+ sets the rules. Also for TPOFF{32,} there is REL->RELA problem. */
+ case R_ARM_TLS_DTPMOD32:
+ if (dso->ehdr.e_type == ET_EXEC)
+ {
+ error (0, 0, "%s: R_ARM_TLS_DTPMOD32 reloc in executable?",
+ dso->filename);
+ return 1;
+ }
+ break;
+ case R_ARM_TLS_TPOFF32:
+ if (dso->ehdr.e_type == ET_EXEC)
+ error (0, 0, "%s: R_ARM_TLS_TPOFF32 relocs should not be present in prelinked ET_EXEC REL sections",
+ dso->filename);
+ break;
case R_ARM_COPY:
if (dso->ehdr.e_type == ET_EXEC)
/* COPY relocs are handled specially in generic code. */
@@ -195,6 +213,24 @@
write_le32 (dso, rela->r_offset,
(read_ule32 (dso, rela->r_offset) & 0xff000000) | val);
break;
+ case R_ARM_TLS_DTPOFF32:
+ write_le32 (dso, rela->r_offset, value + rela->r_addend);
+ break;
+ /* DTPMOD32 and TPOFF32 is impossible to predict unless prelink
+ sets the rules. */
+ case R_ARM_TLS_DTPMOD32:
+ if (dso->ehdr.e_type == ET_EXEC)
+ {
+ error (0, 0, "%s: R_ARM_TLS_DTPMOD32 reloc in executable?",
+ dso->filename);
+ return 1;
+ }
+ break;
+ case R_ARM_TLS_TPOFF32:
+ if (dso->ehdr.e_type == ET_EXEC && info->resolvetls)
+ write_le32 (dso, rela->r_offset,
+ -(value + rela->r_addend - info->resolvetls->offset));
+ break;
case R_ARM_COPY:
if (dso->ehdr.e_type == ET_EXEC)
/* COPY relocs are handled specially in generic code. */
@@ -315,6 +351,7 @@
{
GElf_Addr value;
struct prelink_conflict *conflict;
+ struct prelink_tls *tls;
GElf_Rela *ret;
if (GELF_R_TYPE (rel->r_info) == R_ARM_RELATIVE
@@ -324,8 +361,31 @@
conflict = prelink_conflict (info, GELF_R_SYM (rel->r_info),
GELF_R_TYPE (rel->r_info));
if (conflict == NULL)
- return 0;
- value = conflict_lookup_value (conflict);
+ {
+ if (info->curtls == NULL)
+ return 0;
+ switch (GELF_R_TYPE (rel->r_info))
+ {
+ /* Even local DTPMOD and TPOFF relocs need conflicts. */
+ case R_ARM_TLS_DTPMOD32:
+ case R_ARM_TLS_TPOFF32:
+ break;
+ default:
+ return 0;
+ }
+ value = 0;
+ }
+ else
+ {
+ /* DTPOFF32 wants to see only real conflicts, not lookups
+ with reloc_class RTYPE_CLASS_TLS. */
+ if (GELF_R_TYPE (rel->r_info) == R_ARM_TLS_DTPOFF32
+ && conflict->lookup.tls == conflict->conflict.tls
+ && conflict->lookupval == conflict->conflictval)
+ return 0;
+
+ value = conflict_lookup_value (conflict);
+ }
ret = prelink_conflict_add_rela (info);
if (ret == NULL)
return 1;
@@ -342,6 +402,33 @@
error (0, 0, "%s: R_ARM_%s relocs should not be present in prelinked REL sections",
dso->filename, GELF_R_TYPE (rel->r_info) == R_ARM_ABS32 ? "ABS32" : "PC24");
return 1;
+ case R_ARM_TLS_DTPMOD32:
+ case R_ARM_TLS_DTPOFF32:
+ case R_ARM_TLS_TPOFF32:
+ if (conflict != NULL
+ && (conflict->reloc_class != RTYPE_CLASS_TLS
+ || conflict->lookup.tls == NULL))
+ {
+ error (0, 0, "%s: R_ARM_TLS not resolving to STT_TLS symbol",
+ dso->filename);
+ return 1;
+ }
+ tls = conflict ? conflict->lookup.tls : info->curtls;
+ ret->r_info = GELF_R_INFO (0, R_ARM_ABS32);
+ switch (GELF_R_TYPE (rel->r_info))
+ {
+ case R_ARM_TLS_DTPMOD32:
+ ret->r_addend = tls->modid;
+ break;
+ case R_ARM_TLS_DTPOFF32:
+ ret->r_addend = value;
+ break;
+ case R_ARM_TLS_TPOFF32:
+ ret->r_addend = -(value + read_ule32 (dso, rel->r_offset)
+ - tls->offset);
+ break;
+ }
+ break;
case R_ARM_COPY:
error (0, 0, "R_ARM_COPY should not be present in shared libraries");
return 1;
@@ -359,6 +446,7 @@
{
GElf_Addr value;
struct prelink_conflict *conflict;
+ struct prelink_tls *tls;
GElf_Rela *ret;
Elf32_Sword val;
@@ -369,8 +457,31 @@
conflict = prelink_conflict (info, GELF_R_SYM (rela->r_info),
GELF_R_TYPE (rela->r_info));
if (conflict == NULL)
- return 0;
- value = conflict_lookup_value (conflict);
+ {
+ if (info->curtls == NULL)
+ return 0;
+ switch (GELF_R_TYPE (rela->r_info))
+ {
+ /* Even local DTPMOD and TPOFF relocs need conflicts. */
+ case R_ARM_TLS_DTPMOD32:
+ case R_ARM_TLS_TPOFF32:
+ break;
+ default:
+ return 0;
+ }
+ value = 0;
+ }
+ else
+ {
+ /* DTPOFF32 wants to see only real conflicts, not lookups
+ with reloc_class RTYPE_CLASS_TLS. */
+ if (GELF_R_TYPE (rela->r_info) == R_ARM_TLS_DTPOFF32
+ && conflict->lookup.tls == conflict->conflict.tls
+ && conflict->lookupval == conflict->conflictval)
+ return 0;
+
+ value = conflict_lookup_value (conflict);
+ }
ret = prelink_conflict_add_rela (info);
if (ret == NULL)
return 1;
@@ -398,6 +509,32 @@
case R_ARM_COPY:
error (0, 0, "R_ARM_COPY should not be present in shared libraries");
return 1;
+ case R_ARM_TLS_DTPMOD32:
+ case R_ARM_TLS_DTPOFF32:
+ case R_ARM_TLS_TPOFF32:
+ if (conflict != NULL
+ && (conflict->reloc_class != RTYPE_CLASS_TLS
+ || conflict->lookup.tls == NULL))
+ {
+ error (0, 0, "%s: R_386_TLS not resolving to STT_TLS symbol",
+ dso->filename);
+ return 1;
+ }
+ tls = conflict ? conflict->lookup.tls : info->curtls;
+ ret->r_info = GELF_R_INFO (0, R_ARM_ABS32);
+ switch (GELF_R_TYPE (rela->r_info))
+ {
+ case R_ARM_TLS_DTPMOD32:
+ ret->r_addend = tls->modid;
+ break;
+ case R_ARM_TLS_DTPOFF32:
+ ret->r_addend += value;
+ break;
+ case R_ARM_TLS_TPOFF32:
+ ret->r_addend = -(value + rela->r_addend - tls->offset);
+ break;
+ }
+ break;
default:
error (0, 0, "%s: Unknown arm relocation type %d", dso->filename,
(int) GELF_R_TYPE (rela->r_info));
@@ -418,6 +555,7 @@
abort ();
case R_ARM_RELATIVE:
case R_ARM_ABS32:
+ case R_ARM_TLS_TPOFF32:
rela->r_addend = (Elf32_Sword) read_ule32 (dso, rel->r_offset);
break;
case R_ARM_PC24:
@@ -426,6 +564,8 @@
break;
case R_ARM_COPY:
case R_ARM_GLOB_DAT:
+ case R_ARM_TLS_DTPOFF32:
+ case R_ARM_TLS_DTPMOD32:
rela->r_addend = 0;
break;
}
@@ -445,6 +585,7 @@
abort ();
case R_ARM_RELATIVE:
case R_ARM_ABS32:
+ case R_ARM_TLS_TPOFF32:
write_le32 (dso, rela->r_offset, rela->r_addend);
break;
case R_ARM_PC24:
@@ -453,6 +594,8 @@
| ((rela->r_addend >> 2) & 0xffffff));
break;
case R_ARM_GLOB_DAT:
+ case R_ARM_TLS_DTPMOD32:
+ case R_ARM_TLS_DTPOFF32:
write_le32 (dso, rela->r_offset, 0);
break;
}
@@ -488,6 +631,13 @@
/* FALLTHROUGH */
case R_ARM_PC24:
return 1;
+ case R_ARM_TLS_TPOFF32:
+ /* In shared libraries TPOFF is changed always into
+ conflicts, for executables we need to preserve
+ original addend. */
+ if (dso->ehdr.e_type == ET_EXEC)
+ return 1;
+ break;
}
}
}
@@ -612,6 +762,12 @@
return 0;
error (0, 0, "%s: R_ARM_COPY reloc in shared library?", dso->filename);
return 1;
+ case R_ARM_TLS_DTPMOD32:
+ case R_ARM_TLS_DTPOFF32:
+ write_le32 (dso, rel->r_offset, 0);
+ break;
+ case R_ARM_TLS_TPOFF32:
+ break;
default:
error (0, 0, "%s: Unknown arm relocation type %d", dso->filename,
(int) GELF_R_TYPE (rel->r_info));
@@ -634,6 +790,10 @@
{
case R_ARM_COPY: return RTYPE_CLASS_COPY;
case R_ARM_JUMP_SLOT: return RTYPE_CLASS_PLT;
+ case R_ARM_TLS_DTPMOD32:
+ case R_ARM_TLS_DTPOFF32:
+ case R_ARM_TLS_TPOFF32:
+ return RTYPE_CLASS_TLS;
default: return RTYPE_CLASS_VALID;
}
}
@@ -646,7 +806,7 @@
.R_JMP_SLOT = R_ARM_JUMP_SLOT,
.R_COPY = R_ARM_COPY,
.R_RELATIVE = R_ARM_RELATIVE,
- .dynamic_linker = "/lib/ld-linux.so.2",
+ .dynamic_linker = "/lib/ld-linux.so.3",
.adjust_dyn = arm_adjust_dyn,
.adjust_rel = arm_adjust_rel,
.adjust_rela = arm_adjust_rela,

View File

@ -0,0 +1,18 @@
# This config file contains a list of directories both with binaries
# and libraries prelink should consider by default.
# If a directory name is prefixed with `-l ', the directory hierarchy
# will be walked as long as filesystem boundaries are not crossed.
# If a directory name is prefixed with `-h ', symbolic links in a
# directory hierarchy are followed.
-l /usr/local/sbin
-l /sbin
-l /usr/sbin
-l /usr/local/bin
-l /bin
-l /usr/bin
-l /usr/X11R6/bin
-l /usr/games
-l /usr/local/lib
-l /lib
-l /usr/lib
-l /usr/X11R6/lib

View File

@ -0,0 +1,40 @@
#!/bin/sh
. /etc/default/prelink
renice +19 -p $$ >/dev/null 2>&1
if [ "$PRELINKING" != yes ]; then
if [ -f /etc/prelink.cache ]; then
echo /usr/sbin/prelink -uav > /var/log/prelink.log
/usr/sbin/prelink -uav >> /var/log/prelink.log 2>&1
rm -f /etc/prelink.cache
# Restart init if needed
[ -n "$(find `ldd /sbin/init | awk '{ print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u
fi
exit 0
fi
if [ ! -f /etc/prelink.cache -o -f /var/lib/misc/prelink.force ] \
|| grep -q '^prelink-ELF0.[0-2]' /etc/prelink.cache; then
# If cache does not exist or is from older prelink versions or
# if we were asked to explicitely, force full prelinking
rm -f /etc/prelink.cache /var/lib/misc/prelink.force
PRELINK_OPTS="$PRELINK_OPTS -f"
date > /var/lib/misc/prelink.full
elif [ -n "$PRELINK_FULL_TIME_INTERVAL" \
-a "`find /var/lib/misc/prelink.full -mtime -${PRELINK_FULL_TIME_INTERVAL} 2>/dev/null`" \
= /var/lib/misc/prelink.full ]; then
# If prelink without -q has been run in the last
# PRELINK_FULL_TIME_INTERVAL days, just use quick mode
PRELINK_OPTS="$PRELINK_OPTS -q"
else
date > /var/lib/misc/prelink.full
fi
echo /usr/sbin/prelink -av $PRELINK_OPTS > /var/log/prelink.log
/usr/sbin/prelink -av $PRELINK_OPTS >> /var/log/prelink.log 2>&1
# Restart init if needed
[ -n "$(find `ldd /sbin/init | awk '{ print $3 }'` /sbin/init -ctime -1 2>/dev/null )" ] && /sbin/telinit u
exit 0

View File

@ -0,0 +1,22 @@
# Set this to no to disable prelinking altogether
# or to yes to enable it.
# (if you change this from yes to no prelink -ua
# will be run next night to undo prelinking)
PRELINKING=unknown
# Options to pass to prelink
# -m Try to conserve virtual memory by allowing overlapping
# assigned virtual memory slots for libraries which
# never appear together in one binary
# -R Randomize virtual memory slot assignments for libraries.
# This makes it slightly harder for various buffer overflow
# attacks, since library addresses will be different on each
# host using -R.
PRELINK_OPTS=-mR
# How often should full prelink be run (in days)
# Normally, prelink will be run in quick mode, every
# $PRELINK_FULL_TIME_INTERVAL days it will be run
# in normal mode. Comment this line out if prelink
# should be run in normal mode always.
PRELINK_FULL_TIME_INTERVAL=14

View File

@ -0,0 +1,46 @@
SECTION = "devel"
DEPENDS = "elfutils"
DESCRIPTION = " The prelink package contains a utility which modifies ELF shared libraries \
and executables, so that far fewer relocations need to be resolved at \
runtime and thus programs come up faster."
LICENSE = "GPL"
PR = "r2"
SRC_URI = "${DEBIAN_MIRROR}/main/p/prelink/prelink_0.0.${PV}.orig.tar.gz \
file://prelink.conf \
file://prelink.cron.daily \
file://prelink.default"
TARGET_OS_ORIG := "${TARGET_OS}"
OVERRIDES_append = ":${TARGET_OS_ORIG}"
SRC_URI_append_linux-gnueabi = " file://arm_eabi.patch;patch=1"
S = "${WORKDIR}/prelink-0.0.${PV}"
EXTRA_OECONF = "--disable-64bit"
inherit autotools
do_install_append () {
install -d ${D}${sysconfdir}/cron.daily ${D}${sysconfdir}/default
install -m 0644 ${WORKDIR}/prelink.conf ${D}${sysconfdir}/prelink.conf
install -m 0644 ${WORKDIR}/prelink.cron.daily ${D}${sysconfdir}/cron.daily/prelink
install -m 0644 ${WORKDIR}/prelink.default ${D}${sysconfdir}/default/prelink
}
pkg_postinst_prelink() {
#!/bin/sh
if [ "x$D" != "x" ]; then
exit 1
fi
prelink -a
}
pkg_postrm_prelink() {
#!/bin/sh
prelink -au
}