diff options
4 files changed, 344 insertions, 1 deletions
diff --git a/sys-freebsd/freebsd-libexec/ChangeLog b/sys-freebsd/freebsd-libexec/ChangeLog index 35f5731c83f0..d1e937c8b559 100644 --- a/sys-freebsd/freebsd-libexec/ChangeLog +++ b/sys-freebsd/freebsd-libexec/ChangeLog @@ -1,6 +1,14 @@ # ChangeLog for sys-freebsd/freebsd-libexec # Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-libexec/ChangeLog,v 1.25 2007/04/06 14:59:47 uberlord Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-libexec/ChangeLog,v 1.26 2007/09/12 00:15:46 uberlord Exp $ + +*freebsd-libexec-6.2-r2 (12 Sep 2007) + + 12 Sep 2007; Roy Marples <uberlord@gentoo.org> + +files/freebsd-libexec-6.2-dl_iterate_phdr.patch, + +freebsd-libexec-6.2-r2.ebuild: + Backport dl_iterate_phdr from FreeBSD-7 so that future gcc's don't pull in + libgcc_s.so.1 *freebsd-libexec-6.2-r1 (06 Apr 2007) diff --git a/sys-freebsd/freebsd-libexec/files/digest-freebsd-libexec-6.2-r2 b/sys-freebsd/freebsd-libexec/files/digest-freebsd-libexec-6.2-r2 new file mode 100644 index 000000000000..d6256bfdef1c --- /dev/null +++ b/sys-freebsd/freebsd-libexec/files/digest-freebsd-libexec-6.2-r2 @@ -0,0 +1,21 @@ +MD5 be30e9d113cb08eabbc8c2ad7a99b648 freebsd-bin-6.2.tar.bz2 406748 +RMD160 d687c8ee46fdcc6ea441367a50aad03b695ee616 freebsd-bin-6.2.tar.bz2 406748 +SHA256 202c2024d9a5326ddfd07cae49e2f663118a8ae2f8c79a40c92d513acece3935 freebsd-bin-6.2.tar.bz2 406748 +MD5 da39228784512bd5bb4fba41f84d70d5 freebsd-contrib-6.2.tar.bz2 36594160 +RMD160 8b89f1ac72ba0054efe1aec2d747ecd33789fde3 freebsd-contrib-6.2.tar.bz2 36594160 +SHA256 dbbd9198597e176242806329242d0e12181820a921e5da42aadefaacda1b6277 freebsd-contrib-6.2.tar.bz2 36594160 +MD5 a25ab389e5f4ebef301abe071b4c196e freebsd-etc-6.2.tar.bz2 190297 +RMD160 1540601566ece689b3fc2935329a2eca62a24314 freebsd-etc-6.2.tar.bz2 190297 +SHA256 ff5970db1d7842d2933589203ae0c3907dee427b2ea99de68fce678582bf1804 freebsd-etc-6.2.tar.bz2 190297 +MD5 63b8b5552e729be41b98a73665bcd422 freebsd-lib-6.2.tar.bz2 2670374 +RMD160 95bbce7862fc7a406b8629914f281d5e01e5ea71 freebsd-lib-6.2.tar.bz2 2670374 +SHA256 8e0c909a79a9ed18841f8a5a6e25fc770f76de1a5dc20cbd6bc591bed52d1033 freebsd-lib-6.2.tar.bz2 2670374 +MD5 5cad9ad0ed76a85bf9188020ed9be879 freebsd-libexec-6.2.tar.bz2 277231 +RMD160 423490cb7c888bfce7edcf473d77868c65c21fe2 freebsd-libexec-6.2.tar.bz2 277231 +SHA256 546821f50ff3e69cebd59e1415798233050259de33a4b37acfcbd56b8d92782b freebsd-libexec-6.2.tar.bz2 277231 +MD5 c6c8f8a7218d2294e499f80a2c77def3 freebsd-ubin-6.2.tar.bz2 1772844 +RMD160 8101bc3e98fa485e31ecf0d5529136ddeb4be5b9 freebsd-ubin-6.2.tar.bz2 1772844 +SHA256 446c1a8c7031defda8b184ccf4535cacf651928f324db6ce0aaec3b87b04d9ae freebsd-ubin-6.2.tar.bz2 1772844 +MD5 a1596f3407f95b33f927afc0e3eff428 freebsd-usbin-6.2.tar.bz2 2695872 +RMD160 ea6104fcfbf6c0be511a80d0475e5a8f716292be freebsd-usbin-6.2.tar.bz2 2695872 +SHA256 6195301d39e7bc7fa00f6dec71479b1800ea5c3dc9d3ea375dafe4e71e6485f0 freebsd-usbin-6.2.tar.bz2 2695872 diff --git a/sys-freebsd/freebsd-libexec/files/freebsd-libexec-6.2-dl_iterate_phdr.patch b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-6.2-dl_iterate_phdr.patch new file mode 100644 index 000000000000..080fa5983ece --- /dev/null +++ b/sys-freebsd/freebsd-libexec/files/freebsd-libexec-6.2-dl_iterate_phdr.patch @@ -0,0 +1,246 @@ +--- libexec/rtld-elf/rtld.h 2005/12/18 04:52:34 1.36 ++++ libexec/rtld-elf/rtld.h 2005/12/18 19:43:32 1.37 +@@ -90,6 +90,11 @@ typedef struct Struct_Needed_Entry { + unsigned long name; /* Offset of name in string table */ + } Needed_Entry; + ++typedef struct Struct_Name_Entry { ++ STAILQ_ENTRY(Struct_Name_Entry) link; ++ char name[1]; ++} Name_Entry; ++ + /* Lock object */ + typedef struct Struct_LockInfo { + void *context; /* Client context for creating locks */ +@@ -173,6 +193,9 @@ typedef struct Struct_Obj_Entry { + const char *rpath; /* Search path specified in object */ + Needed_Entry *needed; /* Shared objects needed by this one (%) */ + ++ STAILQ_HEAD(, Struct_Name_Entry) names; /* List of names for this object we ++ know about. */ ++ + Elf_Addr init; /* Initialization function to call */ + Elf_Addr fini; /* Termination function to call */ + +diff -ur libexec/rtld-elf/map_object.c libexec/rtld-elf/map_object.c +--- libexec/rtld-elf/map_object.c 2005-02-27 12:55:40 +0000 ++++ libexec/rtld-elf/map_object.c 2007-09-10 11:29:53 +0100 +@@ -61,7 +61,6 @@ + Elf_Phdr **segs; + int nsegs; + Elf_Phdr *phdyn; +- Elf_Phdr *phphdr; + Elf_Phdr *phinterp; + Elf_Phdr *phtls; + caddr_t mapbase; +@@ -79,7 +78,8 @@ + Elf_Addr clear_vaddr; + caddr_t clear_addr; + caddr_t clear_page; +- size_t nclear; ++ Elf_Addr phdr_vaddr; ++ size_t nclear, phsize; + Elf_Addr bss_vaddr; + Elf_Addr bss_vlimit; + caddr_t bss_addr; +@@ -95,9 +95,11 @@ + * in that order. + */ + phdr = (Elf_Phdr *) ((char *)hdr + hdr->e_phoff); ++ phsize = hdr->e_phnum * sizeof (phdr[0]); + phlimit = phdr + hdr->e_phnum; + nsegs = -1; +- phdyn = phphdr = phinterp = phtls = NULL; ++ phdyn = phinterp = phtls = NULL; ++ phdr_vaddr = 0; + segs = alloca(sizeof(segs[0]) * hdr->e_phnum); + while (phdr < phlimit) { + switch (phdr->p_type) { +@@ -108,7 +110,7 @@ + + case PT_LOAD: + segs[++nsegs] = phdr; +- if (segs[nsegs]->p_align < PAGE_SIZE) { ++ if ((segs[nsegs]->p_align & (PAGE_SIZE - 1)) != 0) { + _rtld_error("%s: PT_LOAD segment %d not page-aligned", + path, nsegs); + return NULL; +@@ -116,7 +118,8 @@ + break; + + case PT_PHDR: +- phphdr = phdr; ++ phdr_vaddr = phdr->p_vaddr; ++ phsize = phdr->p_memsz; + break; + + case PT_DYNAMIC: +@@ -211,6 +214,11 @@ + return NULL; + } + } ++ if (phdr_vaddr == 0 && data_offset <= hdr->e_phoff && ++ (data_vlimit - data_vaddr + data_offset) >= ++ (hdr->e_phoff + hdr->e_phnum * sizeof (Elf_Phdr))) { ++ phdr_vaddr = data_vaddr + hdr->e_phoff - data_offset; ++ } + } + + obj = obj_new(); +@@ -227,10 +235,19 @@ + obj->dynamic = (const Elf_Dyn *) (obj->relocbase + phdyn->p_vaddr); + if (hdr->e_entry != 0) + obj->entry = (caddr_t) (obj->relocbase + hdr->e_entry); +- if (phphdr != NULL) { +- obj->phdr = (const Elf_Phdr *) (obj->relocbase + phphdr->p_vaddr); +- obj->phsize = phphdr->p_memsz; ++ if (phdr_vaddr != 0) { ++ obj->phdr = (const Elf_Phdr *) (obj->relocbase + phdr_vaddr); ++ } else { ++ obj->phdr = malloc(phsize); ++ if (obj->phdr == NULL) { ++ obj_free(obj); ++ _rtld_error("%s: cannot allocate program header", path); ++ return NULL; ++ } ++ memcpy((char *)obj->phdr, (char *)hdr + hdr->e_phoff, phsize); ++ obj->phdr_alloc = true; + } ++ obj->phsize = phsize; + if (phinterp != NULL) + obj->interp = (const char *) (obj->relocbase + phinterp->p_vaddr); + if (phtls != NULL) { +@@ -308,7 +325,6 @@ + if (obj->tls_done) { + free_tls_offset(obj); + } +- free(obj->path); + while (obj->needed != NULL) { + Needed_Entry *needed = obj->needed; + obj->needed = needed->next; +@@ -325,6 +341,7 @@ + free(elm); + } + free(obj->origin_path); ++ free(obj->path); + free(obj->priv); + free(obj); + } +diff -ur libexec/rtld-elf/rtld.c libexec/rtld-elf/rtld.c +--- libexec/rtld-elf/rtld.c 2006-09-02 21:38:13 +0100 ++++ libexec/rtld-elf/rtld.c 2007-09-10 11:22:48 +0100 +@@ -153,6 +153,7 @@ + static Obj_Entry *obj_main; /* The main program shared object */ + static Obj_Entry obj_rtld; /* The dynamic linker shared object */ + static unsigned int obj_count; /* Number of objects in obj_list */ ++static unsigned int obj_loads; /* Number of objects in obj_list */ + + static Objlist list_global = /* Objects dlopened with RTLD_GLOBAL */ + STAILQ_HEAD_INITIALIZER(list_global); +@@ -192,6 +193,9 @@ + (func_ptr_type) &__tls_get_addr, + (func_ptr_type) &_rtld_allocate_tls, + (func_ptr_type) &_rtld_free_tls, ++#ifdef _GENTOO_DL_ITERATE_PHDR_ ++ (func_ptr_type) &dl_iterate_phdr, ++#endif + NULL + }; + +@@ -363,6 +365,7 @@ + *obj_tail = obj_main; + obj_tail = &obj_main->next; + obj_count++; ++ obj_loads++; + /* Make sure we don't call the main program's init and fini functions. */ + obj_main->init = obj_main->fini = (Elf_Addr)NULL; + +@@ -1287,6 +1290,7 @@ + *obj_tail = obj; + obj_tail = &obj->next; + obj_count++; ++ obj_loads++; + linkmap_add(obj); /* for GDB & dlinfo() */ + + dbg(" %p .. %p: %s", obj->mapbase, +@@ -1951,6 +1955,39 @@ + return (error); + } + ++#ifdef _GENTOO_DL_ITERATE_PHDR ++int ++dl_iterate_phdr(__dl_iterate_hdr_callback callback, void *param) ++{ ++ struct dl_phdr_info phdr_info; ++ const Obj_Entry *obj; ++ int error, lockstate; ++ ++ lockstate = rlock_acquire(rtld_bind_lock); ++ ++ error = 0; ++ ++ for (obj = obj_list; obj != NULL; obj = obj->next) { ++ phdr_info.dlpi_addr = (Elf_Addr)obj->relocbase; ++ phdr_info.dlpi_name = STAILQ_FIRST(&obj->names) ? ++ STAILQ_FIRST(&obj->names)->name : obj->path; ++ phdr_info.dlpi_phdr = obj->phdr; ++ phdr_info.dlpi_phnum = obj->phsize / sizeof(obj->phdr[0]); ++ phdr_info.dlpi_tls_modid = obj->tlsindex; ++ phdr_info.dlpi_tls_data = obj->tlsinit; ++ phdr_info.dlpi_adds = obj_loads; ++ phdr_info.dlpi_subs = obj_loads - obj_count; ++ ++ if ((error = callback(&phdr_info, sizeof phdr_info, param)) != 0) ++ break; ++ ++ } ++ rlock_release(rtld_bind_lock, lockstate); ++ ++ return (error); ++} ++#endif ++ + struct fill_search_info_args { + int request; + unsigned int flags; +diff -ur libexec/rtld-elf/rtld.h libexec/rtld-elf/rtld.h +--- libexec/rtld-elf/rtld.h 2005-12-30 22:13:56 +0000 ++++ libexec/rtld-elf/rtld.h 2007-09-10 11:22:22 +0100 +@@ -176,15 +176,16 @@ + Elf_Addr init; /* Initialization function to call */ + Elf_Addr fini; /* Termination function to call */ + +- bool mainprog; /* True if this is the main program */ +- bool rtld; /* True if this is the dynamic linker */ +- bool textrel; /* True if there are relocations to text seg */ +- bool symbolic; /* True if generated with "-Bsymbolic" */ +- bool bind_now; /* True if all relocations should be made first */ +- bool traced; /* Already printed in ldd trace output */ +- bool jmpslots_done; /* Already have relocated the jump slots */ +- bool init_done; /* Already have added object to init list */ +- bool tls_done; /* Already allocated offset for static TLS */ ++ bool mainprog : 1; /* True if this is the main program */ ++ bool rtld : 1; /* True if this is the dynamic linker */ ++ bool textrel : 1; /* True if there are relocations to text seg */ ++ bool symbolic : 1; /* True if generated with "-Bsymbolic" */ ++ bool bind_now : 1; /* True if all relocations should be made first */ ++ bool traced : 1; /* Already printed in ldd trace output */ ++ bool jmpslots_done : 1; /* Already have relocated the jump slots */ ++ bool init_done : 1; /* Already have added object to init list */ ++ bool tls_done : 1; /* Already allocated offset for static TLS */ ++ bool phdr_alloc : 1; /* Phdr is allocated and needs to be freed. */ + + struct link_map linkmap; /* for GDB and dlinfo() */ + Objlist dldags; /* Object belongs to these dlopened DAGs (%) */ +diff -ur libexec.orig/rtld-elf/rtld_lock.c libexec/rtld-elf/rtld_lock.c +--- libexec.orig/rtld-elf/rtld_lock.c 2004-11-16 20:45:51 +0000 ++++ libexec/rtld-elf/rtld_lock.c 2007-09-10 11:22:22 +0100 +@@ -54,7 +54,7 @@ + #define RC_INCR 0x2 /* Adjusts count of readers desiring lock */ + + typedef struct Struct_Lock { +- volatile int lock; ++ volatile u_int lock; + void *base; + } Lock; + diff --git a/sys-freebsd/freebsd-libexec/freebsd-libexec-6.2-r2.ebuild b/sys-freebsd/freebsd-libexec/freebsd-libexec-6.2-r2.ebuild new file mode 100644 index 000000000000..9b53de56ec9b --- /dev/null +++ b/sys-freebsd/freebsd-libexec/freebsd-libexec-6.2-r2.ebuild @@ -0,0 +1,68 @@ +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-freebsd/freebsd-libexec/freebsd-libexec-6.2-r2.ebuild,v 1.1 2007/09/12 00:15:46 uberlord Exp $ + +inherit bsdmk freebsd pam + +DESCRIPTION="FreeBSD libexec things" +SLOT="0" +KEYWORDS="~sparc-fbsd ~x86-fbsd" + +IUSE="pam ssl kerberos ipv6 nis" + +SRC_URI="mirror://gentoo/${LIBEXEC}.tar.bz2 + mirror://gentoo/${UBIN}.tar.bz2 + mirror://gentoo/${BIN}.tar.bz2 + mirror://gentoo/${CONTRIB}.tar.bz2 + mirror://gentoo/${LIB}.tar.bz2 + mirror://gentoo/${ETC}.tar.bz2 + mirror://gentoo/${USBIN}.tar.bz2" + +RDEPEND="=sys-freebsd/freebsd-lib-${RV}* + pam? ( virtual/pam )" +DEPEND="${RDEPEND} + =sys-freebsd/freebsd-mk-defs-${RV}* + =sys-freebsd/freebsd-sources-${RV}*" + +S="${WORKDIR}/libexec" + +PATCHES="${FILESDIR}/${PN}-setXid.patch + ${FILESDIR}/${PN}-nossp.patch + ${FILESDIR}/${PN}-6.1-libfallback.patch + ${FILESDIR}/${PN}-6.2-dl_iterate_phdr.patch + ${FILESDIR}/${PN}-6.2-sparc64.patch" + +# Remove sendmail, tcp_wrapper and other useless stuff +REMOVE_SUBDIRS="smrsh mail.local tcpd telnetd rshd rlogind lukemftpd ftpd" + +pkg_setup() { + use pam || mymakeopts="${mymakeopts} NO_PAM= " + use ssl || mymakeopts="${mymakeopts} NO_OPENSSL= NO_CRYPT= " + use kerberos || mymakeopts="${mymakeopts} NO_KERBEROS= " + use ipv6 || mymakeopts="${mymakeopts} NO_INET6= " + use nis || mymakeopts="${mymakeopts} NO_NIS= " + + mymakeopts="${mymakeopts} NO_SENDMAIL= NO_PF= " +} + +src_unpack() { + freebsd_src_unpack + + ln -s /usr/include "${WORKDIR}/include" +} + +src_compile() { + NOSSP_FLAGS="$(test-flags -fno-stack-protector -fno-stack-protector-all)" + export NOSSP_FLAGS + freebsd_src_compile +} + +src_install() { + freebsd_src_install + + newinitd "${FILESDIR}/bootpd.initd" + newconfd "${FILESDIR}/bootpd.confd" + + insinto /etc + doins "${WORKDIR}/etc/gettytab" +} |