Debian Codegraph @

build/unix/elfhack/Makefile.in

raw
1 #
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
6 include $(topsrcdir)/config/rules.mk
7
8 ifdef COMPILE_ENVIRONMENT
9 ifndef RELRHACK
10 test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX) elfhack
11 $(MKSHLIB) $(LDFLAGS) $< -nostartfiles
12 @echo ===
13 @echo === If you get failures below, please file a bug describing the error
14 @echo === and your environment \(compiler and linker versions\), and
15 @echo === provide the pre-elfhacked library as an attachment.
16 @echo === Use --disable-elf-hack until this is fixed.
17 @echo ===
18 # Fail if the library doesn't have $(DT_TYPE) .dynamic info
19 $(READELF) -d $@ | grep '\b$(DT_TYPE)\b'
20 @rm -f [email protected]
21 $(CURDIR)/elfhack -b -f $@
22 # Fail if the backup file doesn't exist
23 [ -f '[email protected]' ]
24 # Fail if the new library doesn't contain less relocations
25 [ $$($(READELF) -r [email protected] | wc -l) -gt $$($(READELF) -r $@ | wc -l) ]
26
27 test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): DSO_SONAME=$@
28 test-array$(DLL_SUFFIX): DT_TYPE=INIT_ARRAY
29 test-ctors$(DLL_SUFFIX): DT_TYPE=INIT
30
31 libs:: test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX)
32
33 .PRECIOUS: test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX)
34
35 ifndef CROSS_COMPILE
36 dummy: dummy.$(OBJ_SUFFIX)
37 $(CC) -o $@ $^ $(LDFLAGS)
38
39 libs:: dummy
40 # Will either crash or return exit code 1 if elfhack is broken
41 LD_PRELOAD=$(CURDIR)/test-array$(DLL_SUFFIX) $(CURDIR)/dummy
42 LD_PRELOAD=$(CURDIR)/test-ctors$(DLL_SUFFIX) $(CURDIR)/dummy
43
44 endif
45 endif
46 endif