1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/build/unix/elfhack/Makefile.in Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,51 @@ 1.4 +# 1.5 +# This Source Code Form is subject to the terms of the Mozilla Public 1.6 +# License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 +# file, You can obtain one at http://mozilla.org/MPL/2.0/. 1.8 + 1.9 +INTERNAL_TOOLS = 1 1.10 + 1.11 +OS_CXXFLAGS := $(filter-out -fno-exceptions,$(OS_CXXFLAGS)) -fexceptions 1.12 + 1.13 +WRAP_LDFLAGS= 1.14 + 1.15 +include $(topsrcdir)/config/rules.mk 1.16 + 1.17 +test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX) elfhack 1.18 + $(MKSHLIB) $(LDFLAGS) $< -nostartfiles 1.19 + @echo === 1.20 + @echo === If you get failures below, please file a bug describing the error 1.21 + @echo === and your environment \(compiler and linker versions\), and use 1.22 + @echo === --disable-elf-hack until this is fixed. 1.23 + @echo === 1.24 + # Fail if the library doesn't have $(DT_TYPE) .dynamic info 1.25 + $(TOOLCHAIN_PREFIX)readelf -d $@ | grep '($(DT_TYPE))' 1.26 + @rm -f $@.bak 1.27 + $(CURDIR)/elfhack -b -f $@ 1.28 + # Fail if the backup file doesn't exist 1.29 + [ -f '$@.bak' ] 1.30 + # Fail if the new library doesn't contain less relocations 1.31 + [ $$($(TOOLCHAIN_PREFIX)objdump -R $@.bak | wc -l) -gt $$(objdump -R $@ | wc -l) ] 1.32 + 1.33 +test-array$(DLL_SUFFIX): DT_TYPE=INIT_ARRAY 1.34 +test-ctors$(DLL_SUFFIX): DT_TYPE=INIT 1.35 + 1.36 +.PRECIOUS: test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX) 1.37 + 1.38 +GARBAGE += test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX) test-array$(DLL_SUFFIX).bak test-ctors$(DLL_SUFFIX).bak 1.39 + 1.40 +ifndef CROSS_COMPILE 1.41 +ifdef COMPILE_ENVIRONMENT 1.42 +libs:: test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX) 1.43 + 1.44 +dummy: dummy.$(OBJ_SUFFIX) 1.45 + $(CC) -o $@ $^ $(LDFLAGS) 1.46 + 1.47 +libs:: dummy 1.48 + # Will either crash or return exit code 1 if elfhack is broken 1.49 + LD_PRELOAD=$(CURDIR)/test-array$(DLL_SUFFIX) $(CURDIR)/dummy 1.50 + LD_PRELOAD=$(CURDIR)/test-ctors$(DLL_SUFFIX) $(CURDIR)/dummy 1.51 + 1.52 +GARBAGE += dummy 1.53 +endif 1.54 +endif