summaryrefslogtreecommitdiffstats
path: root/libexec/rtld-elf/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* MFC r308688:kib2016-11-221-1/+1
| | | | Assert that there is no unresolved symbols during rtld linking.
* MFC r308687:kib2016-11-221-1/+1
| | | | Update hint to utilize user variable.
* Fix race for incrementally rebuilding VERSION_MAP.bdrewery2016-07-031-2/+1
| | | | | | | | | | | | | | The dependency is needed in PROG_FULL since only the build of PROG_FULL is using the LDFLAGS and depending on VERSION_MAP. This was not a problem with MK_DEBUG_FILES==no since it only builds PROG. This should probably be using bsd.lib.mk instead [1] Reported by: swills, gjb Reviewed by: emaste Noted by: rgrimes [1] Sponsored by: EMC / Isilon Storage Division Approved by: re (kib)
* MFHgjb2016-04-041-0/+3
|\ | | | | | | Sponsored by: The FreeBSD Foundation
| * WITHOUT_TOOLCHAIN: Fix build of rtld.bdrewery2016-03-311-0/+3
| | | | | | | | | | | | | | | | | | | | MK_TOOLCHAIN==no disables building and installing of pic archives. c_pic.a is still needed for rtld though so force it to build in lib/libc and link directly to the objdir version of it for rtld. Somehow this has been broken since r148725. Sponsored by: EMC / Isilon Storage Division
* | Remove libc, librtld_db, libthr packages, and further increasegjb2016-02-051-1/+4
| | | | | | | | | | | | | | | | | | | | | | the constraints on what needs to be installed in a specific to maintain consistency during upgrades. Create a new clibs package containing libraries that are needed as a bare minimum for consistency. With much help and input from: kib Sponsored by: The FreeBSD Foundation
* | Include ld-elf.so and ld-elf32.so in the librtld_dbgjb2016-02-051-0/+1
|/ | | | | | package. Sponsored by: The FreeBSD Foundation
* Follow-on to r291666: use -ffreestanding instead of -fno-builtin.nwhitehorn2015-12-031-1/+1
| | | | Requested by: kib
* Fix build on GCC 5.2 where, at least on PPC64, the compiler would "optimize"nwhitehorn2015-12-031-2/+1
| | | | | | | | the malloc() + memset() in the local implementation of calloc() into a call to calloc(), helpfully turning it into an infinite loop. Clean up some unneeded flags on PPC64 while here. MFC after: 1 month
* Fix build after r291620.bdrewery2015-12-011-1/+1
| | | | | | | | | | | "don't know how to make /Versions.def. Stop" This was trying to define a target in bsd.symver.mk based on LIBCDIR which was not yet defined. Switching the order of inclusion of bsd.prog.mk and bsd.symver.mk fixes it and seems fine. Pointyhat to: bdrewery Sponsored by: EMC / Isilon Storage Division
* Don't override LIB*DIR variables from src.libnames.mk.bdrewery2015-12-011-4/+2
| | | | | | | | In some cases switch to the LIB*SRCDIR value. These recently were defined in r291327 and r291619. Sponsored by: EMC / Isilon Storage Division
* Use LIBEXECDIR for /usr/libexec.bdrewery2015-11-261-1/+1
| | | | | MFC after: 1 week Sponsored by: EMC / Isilon Storage Division
* META_MODE: No need to fix the link in this case.bdrewery2015-09-181-1/+1
| | | | | | | | | | | The exists(${DESTDIR}...) check runs with DESTDIR being blank. When the target runs it does have DESTDIR=${STAGE_OBJTOP} via bsd.sys.mk. This results in the first execution warning that the symlink is missing. The second run does run fine. However, this chflags is not needed at all for META_MODE/STAGING since we never had this path being a schg file while using META_MODE. Sponsored by: EMC / Isilon Storage Division
* Change compiler setting to make default visibility of the symbols forkib2015-03-291-0/+3
| | | | | | | | | | | rtld on x86 to be hidden. This is a micro-optimization, which allows intrinsic references inside rtld to be handled without indirection through PLT. The visibility of rtld symbols for other objects in the symbol namespace is controlled by a version script. Reviewed by: kan, jilles Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* Convert to LIBADDbapt2014-11-251-4/+2
| | | | Reduce overlinking
* Remove MK_ARM_EABI, the armeb issues have been fixed. The code to supportandrew2014-10-011-1/+1
| | | | | | | | | | | | the oabi is still in the tree, but it is expected this will be removed as developers work on surrounding code. With this commit the ARM EABI is the only supported supported ABI by FreeBSD on ARMa 32-bit processors. X-MFC after: never Relnotes: yes Differential Revision: https://reviews.freebsd.org/D876
* Document the whole settings needed to build a debug version of rtld.kib2014-08-291-0/+4
| | | | | Sponsored by: The FreeBSD Foundation MFC after: 3 days
* Revert r267233 for now. PIE support needs to be reworked.bdrewery2014-08-191-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | 1. 50+% of NO_PIE use is fixed by adding -fPIC to INTERNALLIB and other build-only utility libraries. 2. Another 40% is fixed by generating _pic.a variants of various libraries. 3. Some of the NO_PIE use is a bit absurd as it is disabling PIE (and ASLR) where it never would work anyhow, such as csu or loader. This suggests there may be better ways of adding support to the tree. Many of these cases can be fixed such that -fPIE will work but there is really no reason to have it in those cases. 4. Some of the uses are working around hacks done to some Makefiles that are really building libraries but have been using bsd.prog.mk because the code is cleaner. Had they been using bsd.lib.mk then NO_PIE would not have been needed. We likely do want to enable PIE by default (opt-out) for non-tree consumers (such as ports). For in-tree though we probably want to only enable PIE (opt-in) for common attack targets such as remote service daemons and setuid utilities. This is also a great performance compromise since ASLR is expected to reduce performance. As such it does not make sense to enable it in all utilities such as ls(1) that have little benefit to having it enabled. Reported by: kib
* Test RTLD's new LD_LIBRARY_PATH_FDS variable.jonathan2014-06-201-0/+4
| | | | | | | | | | | | Test LD_LIBRARY_PATH_FDS by linking a binary that requires a shared library that isn't in any of the usual search paths. Ensure this fails when we don't supply LD_LIBRARY_PATH_FDS or we pass invalid information in it. Ensure it works when we pass the correct directory in various places in the variable. Approved by: rwatson (mentor) MFC after: 3 weeks Sponsored by: DARPA/AFRL
* In preparation for ASLR [1] support add WITH_PIE to support building with -fPIE.bdrewery2014-06-081-0/+2
| | | | | | | | | | | | | | | | This is currently an opt-in build flag. Once ASLR support is ready and stable it should changed to opt-out and be enabled by default along with ASLR. Each application Makefile uses opt-out to ensure that ASLR will be enabled by default in new directories when the system is compiled with PIE/ASLR. [2] Mark known build failures as NO_PIE for now. The only known runtime failure was rtld. [1] http://www.bsdcan.org/2014/schedule/events/452.en.html Submitted by: Shawn Webb <lattera@gmail.com> Discussed between: des@ and Shawn Webb [2]
* Use src.opts.mk in preference to bsd.own.mk except where we need stuffimp2014-05-061-1/+1
| | | | from the latter.
* Replace LIBGCC by LIBCOMPILER_RT.ed2014-01-181-5/+6
| | | | | We now use libcompiler_rt on all platforms now. Instead of referring directly to -lgcc and LIBGCC, use -lcompiler_rt and LIBCOMPILER_RT.
* When building for ARM EABI link against libgcc for the __aeabi_* functions.andrew2013-01-191-0/+10
|
* Use absolute path for /usr/libexec/ld-elf.so.1 symlink.pjd2012-12-041-2/+2
| | | | | | | | | Requested by: kan, kib Use -h flags for chflags, so we won't remove 'schg' flag from system's /libexec/ld-elf.so.1. MFC after: 2 weeks
* Do not change entire BINDIR, it might be needed later, just changepjd2012-12-041-2/+2
| | | | | | symlink target. MFC after: 2 weeks
* Change /usr/libexec/ld-elf.so.1 to point at ../../libexec/ld-elf.so.1pjd2012-12-041-1/+1
| | | | | | | | | | | instead of /libexec/ld-elf.so.1. Below in the Makefile we execute 'chflags noschg ${DESTDIR}/usr/libexec/ld-elf.so.1', which follows symlink and removes 'schg' flag from system's /libexec/ld-elf.so.1 instead of the one in DESTDIR. It is also more friendly to use replative paths in symlink in case of jail/chroot environments. Obtained from: WHEEL Systems MFC after: 2 weeks
* Remove libssp_nonshared from the rtld linking set. The only use for thekib2012-03-241-1/+1
| | | | | | | library was definition for the weak alias of __stack_chk_fail. No objections from: kan MFC after: 2 weeks
* Centralize the calculation of the top source directory. Thiskib2012-03-231-2/+3
| | | | | | | | simplifies the build of rtld with partial checkout, allowing to override only one place to reference other tree. Submitted by: bde MFC after: 2 weeks
* Add support for preinit, init and fini arrays. Some ABIs, inkib2012-03-111-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | particular on ARM, do require working init arrays. Traditional FreeBSD crt1 calls _init and _fini of the binary, instead of allowing runtime linker to arrange the calls. This was probably done to have the same crt code serve both statically and dynamically linked binaries. Since ABI mandates that first is called preinit array functions, then init, and then init array functions, the init have to be called from rtld now. To provide binary compatibility to old FreeBSD crt1, which calls _init itself, rtld only calls intializers and finalizers for main binary if binary has a note indicating that new crt was used for linking. Add parsing of ELF notes to rtld, and cache p_osrel value since we parsed it anyway. The patch is inspired by init_array support for DragonflyBSD, written by John Marino. Reviewed by: kan Tested by: andrew (arm, previous version), flo (sparc64, previous version) MFC after: 3 weeks
* Rtld links with the specially built pic static libc library to get somekib2011-08-241-1/+1
| | | | | | | | | | | | | | | | | C runtime services, like printf(). Unfortunately, the multithread-safeness measures in the libc do not work in rtld environment. Rip the kernel printf() implementation and use it in the rtld instead of libc version. This printf does not require any shared global data and thus is mt-safe. Systematically use rtld_printf() and related functions, remove the calls to err(3). Note that stdio is still pulled from libc due to libmap implementaion using fopen(). This is safe but unoptimal, and can be changed later. Reported and tested by: pgj Diagnosed and reviewed by: kan (previous version) Approved by: re (bz)
* Compile RTLD with global dot symbols on 64-bit PowerPC, as a crutch fornwhitehorn2011-06-081-0/+1
| | | | | GDB's ability to locate r_debug_state (which is actually the only function that need be compiled this way).
* Add a hook to pass debug flags to the build of rtld when doing make inkib2010-12-251-1/+1
| | | | | | the rtld directory. Reviewed by: kan
* Use -fPIC to build libexec/rtld-elf on sparc64, so it will also be abledim2010-11-111-1/+6
| | | | | | to link with newer binutils, without overflowing the GOT. Obtained from: projects/binutils-2.17
* Unbreak ia64.marcel2010-10-221-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | With r169630 I disabled symbol versioning because it broke rtld. With r211706 rtld got broken for ia64 & powerpc64. It was fixed for powerpc64 with r212497. In between, r211749 removed the exports table because the version script handled the exports. But wait, symbol versioning was disabled on ia64. With exports controlled by the version script and symbol versioning disabled, all symbols are exported and too many symbols bind to the definition in rtld. Let's just say that waird things happen. So, enable symbol versioning on ia64 and apply a work-around for the SIGSEGV that triggered r169630 to begin with: when rtld relocates itself, it comes across r_debug_state and for some reason can't find the definition. This causes a failure, relocation aborts and null pointers galore. The work-around is to ignore the missing definition when rtld is relocating itself and keep going. Maybe with the next binutils this will all go away. Maybe not, in which case I still need to figure out why r_debug_state cannot be found. BTW: r_debug_state is in the symbol map -- I don't think any other rtld symbols that rtld references are in the symbol map...
* Make RTLD work on powerpc64 again. If there is a sub-directory namednwhitehorn2010-08-241-7/+10
| | | | | | MACHINE_ARCH, use that specific one, otherwise use MACHINE_CPUARCH. Reviewed by: imp
* MFtbemd:imp2010-08-231-7/+7
| | | | | Prefer MACHNE_CPUARCH to MACHINE_ARCH in most contexts where you want to test of all the CPUs of a given family conform.
* RTLD support for powerpc64. A few small modifications to the Makefilenwhitehorn2010-07-101-0/+4
| | | | | | | | | | | | | and symbol map are required to support various consequences of the dot symbol scheme: - Symbols beginning with a dot are reserved, so start private symbols with an underscore. - In order to set RTLD breakpoints, gdb must be able to locate the text entry point, not the data section function descriptor, so add .r_debug_state to the symbol map on powerpc64. Obtained from: projects/ppc64
* Make WARNS=6 the default for libexec/.ed2010-01-021-0/+1
| | | | | | | | | | | | | | | Just like bin/ and sbin/, I think setting WARNS to the highest value possible will make it more attractive for people to fix warnings. - The WARNS variable is set in the Makefile in the directory of the application itself, making it more likely that it will be removed out of curiosity to see what happens. - New applications will most likely build with WARNS=6 out of the box, because the author would more likely fix the warnings during development than lower WARNS. Unfortunately almost all apps in libexec require a lowered value of WARNS.
* Second attempt at eliminating .text relocations in shared librarieskan2009-07-141-1/+1
| | | | | | | | | | | | | | compiled with stack protector. Use libssp_nonshared library to pull __stack_chk_fail_local symbol into each library that needs it instead of pulling it from libc. GCC generates local calls to this function which result in absolute relocations put into position-independent code segment, making dynamic loader do extra work every time given shared library is being relocated and making affected text pages non-shareable. Reviewed by: kib Approved by: re (kib)
* Back out previous revision until better tested fix is ready.kan2009-06-291-1/+1
| | | | Approved by: re (impliciti, by approving previos check-in)
* Eliminate .text relocations in shared libraries compiled with stack protector.kan2009-06-281-1/+1
| | | | | | | | | | | | Use libssp_nonshared library to pull __stack_chk_fail_local symbol into each library that needs it instead of pulling it from libc. GCC generates local calls to this function which result in absolute relocations put into position-independent code segment, making dynamic loader do extra work everys time given shared library is being relocated and making affected text pages non-shareable. Reviewed by: kib Approved by: re (kensmith)
* Fix build when WITH_SSP is set explicitly.ru2009-02-211-2/+1
| | | | Submitted by: Jeremie Le Hen
* Enable GCC stack protection (aka Propolice) for userland:ru2008-06-251-0/+2
| | | | | | | | | | | | | | | | | | | | | - It is opt-out for now so as to give it maximum testing, but it may be turned opt-in for stable branches depending on the consensus. You can turn it off with WITHOUT_SSP. - WITHOUT_SSP was previously used to disable the build of GNU libssp. It is harmless to steal the knob as SSP symbols have been provided by libc for a long time, GNU libssp should not have been much used. - SSP is disabled in a few corners such as system bootstrap programs (sys/boot), process bootstrap code (rtld, csu) and SSP symbols themselves. - It should be safe to use -fstack-protector-all to build world, however libc will be automatically downgraded to -fstack-protector because it breaks rtld otherwise. - This option is unavailable on ia64. Enable GCC stack protection (aka Propolice) for kernel: - It is opt-out for now so as to give it maximum testing. - Do not compile your kernel with -fstack-protector-all, it won't work. Submitted by: Jeremie Le Hen <jeremie@le-hen.org>
* Don't enable symbol versioning on ia64 for now. It causesmarcel2007-05-161-0/+2
| | | | | | | symbol lookup failures that later result in null-pointer dereferences. This needs looking into, but since we're close to release it's possible that it's not resolved before that time.
* Enable symbol versioning by default. Use WITHOUT_SYMVER to disable it.deischen2007-05-131-1/+3
| | | | | | | | | | Warning, after symbol versioning is enabled, going back is not easy (use WITHOUT_SYMVER at your own risk). Change the default thread library to libthr. There most likely still needs to be a version bump for at least the thread libraries. If necessary, this will happen later.
* Retire rtld-specific Versions.def. Symbols exported by rtld are supposedkan2007-04-291-2/+3
| | | | | | | to override weak symbols exported by libc, so by definition these two are using the same symbol version names. Reflect the reality by referring to libc's Versions.def directly.
* Bring rtld exports in line with corresponding symbols exported fromkan2007-04-091-1/+1
| | | | | | | libc. Disable SYMVER_DEFAULT n rtld until its implications are understood better.
* Prepare rtld for symbol versioning. Disable it by default for now.kan2007-04-031-22/+16
|
* So do it like we do in usr.bin/tip/tip/Makefile. ;)ru2004-11-141-0/+2
|
* Revert previous commit. As ru explains:schweikh2004-11-141-1/+1
| | | | | | | | | | | In the old world (as the surrounding comment in makefile says), there was the /usr/libexec/ld-elf.so.1 binary which is now a symlink to /libexec/ld-elf.so.1. To symlink, we need to make sure that the _target_ (and the target is /usr/libexec/ld-elf.so.1) doesn't have "schg" flag set. A real solution is to protect the chflags call only if target exists, like we do in usr.bin/tip/tip/Makefile. Requested by: ru
OpenPOWER on IntegriCloud