Bug 1747778 - Test what we can test of elfhack when cross-building. r=firefox-build-system-reviewers,mhentges

While here, switch to use $(READELF).

Differential Revision: https://phabricator.services.mozilla.com/D134746
This commit is contained in:
Mike Hommey 2021-12-30 00:50:56 +00:00
parent 0d3683e53f
commit 6eab403e68
2 changed files with 11 additions and 9 deletions

View File

@ -5,6 +5,7 @@
include $(topsrcdir)/config/rules.mk
ifdef COMPILE_ENVIRONMENT
test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX) elfhack
$(MKSHLIB) $(LDFLAGS) $< -nostartfiles
@echo ===
@ -20,18 +21,17 @@ test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX)
# Fail if the backup file doesn't exist
[ -f '$@.bak' ]
# Fail if the new library doesn't contain less relocations
[ $$($(TOOLCHAIN_PREFIX)objdump -R $@.bak | wc -l) -gt $$(objdump -R $@ | wc -l) ]
[ $$($(READELF) -r $@.bak | wc -l) -gt $$($(READELF) -r $@ | wc -l) ]
test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): DSO_SONAME=$@
test-array$(DLL_SUFFIX): DT_TYPE=INIT_ARRAY
test-ctors$(DLL_SUFFIX): DT_TYPE=INIT
libs:: test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX)
.PRECIOUS: test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX)
ifndef CROSS_COMPILE
ifdef COMPILE_ENVIRONMENT
libs:: test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX)
dummy: dummy.$(OBJ_SUFFIX)
$(CC) -o $@ $^ $(LDFLAGS)

View File

@ -10,13 +10,15 @@ DIRS += ["inject"]
if not CONFIG["CROSS_COMPILE"]:
SOURCES += [
"dummy.c",
"test-array.c",
"test-ctors.c",
]
SOURCES["dummy.c"].flags += ["-fno-lto"]
SOURCES["test-array.c"].flags += ["-fno-lto"]
SOURCES["test-ctors.c"].flags += ["-fno-lto"]
SOURCES += [
"test-array.c",
"test-ctors.c",
]
SOURCES["test-array.c"].flags += ["-fno-lto"]
SOURCES["test-ctors.c"].flags += ["-fno-lto"]
HOST_SOURCES += [
"elf.cpp",