Revert "Use shared object files for ELF"

Broke RVCT. New magic coming for ICC. Stay tuned!

This reverts commit c73eb2ffff
This commit is contained in:
Johann 2011-06-08 11:36:04 -07:00 committed by Code Review
parent c73eb2ffff
commit abb7c2181e
3 changed files with 11 additions and 99 deletions

View File

@ -220,14 +220,11 @@ define so_template
# for creating them. # for creating them.
# #
# This needs further abstraction for dealing with non-GNU linkers. # This needs further abstraction for dealing with non-GNU linkers.
comma := ,
$(1): $(1):
$(if $(quiet),@echo " [LD] $$@") $(if $(quiet),@echo " [LD] $$@")
$(qexec)$$(LD) -shared $$(LDFLAGS) \ $(qexec)$$(LD) -shared $$(LDFLAGS) \
-Wl,--no-undefined \ -Wl,--no-undefined -Wl,-soname,$$(SONAME) \
$$(if $$(SONAME), -Wl$$(comma)-soname$$(comma)$$(SONAME)) \ -Wl,--version-script,$$(SO_VERSION_SCRIPT) -o $$@ \
$$(if $$(SO_VERSION_SCRIPT), -Wl$$(comma)--version-script$$(comma)$$(SO_VERSION_SCRIPT)) \
-o $$@ \
$$(filter %.o,$$?) $$(extralibs) $$(filter %.o,$$?) $$(extralibs)
endef endef
@ -294,7 +291,7 @@ LIBS=$(call enabled,LIBS)
.libs: $(LIBS) .libs: $(LIBS)
@touch $@ @touch $@
$(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib)))) $(foreach lib,$(filter %_g.a,$(LIBS)),$(eval $(call archive_template,$(lib))))
$(foreach lib,$(filter %.so %so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH),$(LIBS)),$(eval $(call so_template,$(lib)))) $(foreach lib,$(filter %so.$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH),$(LIBS)),$(eval $(call so_template,$(lib))))
INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS) INSTALL-LIBS=$(call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS)
ifeq ($(MAKECMDGOALS),dist) ifeq ($(MAKECMDGOALS),dist)

View File

@ -347,46 +347,6 @@ bail:
return 1; return 1;
} }
int parse_elf_program(elf_obj_t *elf, int idx, Elf32_Phdr *phdr32, Elf64_Phdr *phdr64)
{
if (phdr32)
{
if (idx >= elf->hdr32.e_phnum)
goto bail;
COPY_STRUCT(phdr32, elf->buf, elf->hdr32.e_phoff + idx * elf->hdr32.e_phentsize,
elf->sz);
ENDIAN_ASSIGN_IN_PLACE(phdr32->p_type);
ENDIAN_ASSIGN_IN_PLACE(phdr32->p_offset);
ENDIAN_ASSIGN_IN_PLACE(phdr32->p_vaddr);
ENDIAN_ASSIGN_IN_PLACE(phdr32->p_paddr);
ENDIAN_ASSIGN_IN_PLACE(phdr32->p_filesz);
ENDIAN_ASSIGN_IN_PLACE(phdr32->p_memsz);
ENDIAN_ASSIGN_IN_PLACE(phdr32->p_flags);
ENDIAN_ASSIGN_IN_PLACE(phdr32->p_align);
}
else /* if (phdr64) */
{
if (idx >= elf->hdr64.e_phnum)
goto bail;
COPY_STRUCT(phdr64, elf->buf, elf->hdr64.e_phoff + idx * elf->hdr64.e_phentsize,
elf->sz);
ENDIAN_ASSIGN_IN_PLACE(phdr64->p_type);
ENDIAN_ASSIGN_IN_PLACE(phdr64->p_offset);
ENDIAN_ASSIGN_IN_PLACE(phdr64->p_vaddr);
ENDIAN_ASSIGN_IN_PLACE(phdr64->p_paddr);
ENDIAN_ASSIGN_IN_PLACE(phdr64->p_filesz);
ENDIAN_ASSIGN_IN_PLACE(phdr64->p_memsz);
ENDIAN_ASSIGN_IN_PLACE(phdr64->p_flags);
ENDIAN_ASSIGN_IN_PLACE(phdr64->p_align);
}
return 0;
bail:
return 1;
}
char *parse_elf_string_table(elf_obj_t *elf, int s_idx, int idx) char *parse_elf_string_table(elf_obj_t *elf, int s_idx, int idx)
{ {
if (elf->bits == 32) if (elf->bits == 32)
@ -451,19 +411,15 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
int i; int i;
Elf32_Off strtab_off32; Elf32_Off strtab_off32;
Elf64_Off strtab_off64; /* save String Table offset for later use */ Elf64_Off strtab_off64; /* save String Table offset for later use */
Elf32_Word load_alignment32;
Elf64_Xword load_alignment64;
memset(&elf, 0, sizeof(elf)); memset(&elf, 0, sizeof(elf));
elf.buf = buf; elf.buf = buf;
elf.sz = sz; elf.sz = sz;
/* Parse Header */
if (parse_elf_header(&elf)) if (parse_elf_header(&elf))
goto bail; goto bail;
/* Parse Section and Program headers for string table offset and data
* aligment, respectively.
*/
if (elf.bits == 32) if (elf.bits == 32)
{ {
Elf32_Shdr shdr; Elf32_Shdr shdr;
@ -485,15 +441,6 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
} }
} }
} }
Elf32_Phdr phdr;
for (i = 0; i< elf.hdr32.e_phnum; i++)
{
parse_elf_program(&elf, i, &phdr, NULL);
if (phdr.p_type == PT_LOAD)
{
load_alignment32 = phdr.p_align;
}
}
} }
else /* if (elf.bits == 64) */ else /* if (elf.bits == 64) */
{ {
@ -516,15 +463,6 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
} }
} }
} }
Elf64_Phdr phdr;
for (i = 0; i< elf.hdr64.e_phnum; i++)
{
parse_elf_program(&elf, i, NULL, &phdr);
if (phdr.p_type == PT_LOAD)
{
load_alignment64 = phdr.p_align;
}
}
} }
/* Parse all Symbol Tables */ /* Parse all Symbol Tables */
@ -535,7 +473,7 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
{ {
parse_elf_section(&elf, i, &shdr, NULL); parse_elf_section(&elf, i, &shdr, NULL);
if (shdr.sh_type == SHT_DYNSYM) if (shdr.sh_type == SHT_SYMTAB)
{ {
for (ofst = shdr.sh_offset; for (ofst = shdr.sh_offset;
ofst < shdr.sh_offset + shdr.sh_size; ofst < shdr.sh_offset + shdr.sh_size;
@ -582,7 +520,7 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
} }
memcpy(&val, memcpy(&val,
elf.buf + (sym.st_value - load_alignment32), elf.buf + dhdr.sh_offset + sym.st_value,
sym.st_size); sym.st_size);
} }
@ -627,7 +565,7 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
{ {
parse_elf_section(&elf, i, NULL, &shdr); parse_elf_section(&elf, i, NULL, &shdr);
if (shdr.sh_type == SHT_DYNSYM) if (shdr.sh_type == SHT_SYMTAB)
{ {
for (ofst = shdr.sh_offset; for (ofst = shdr.sh_offset;
ofst < shdr.sh_offset + shdr.sh_size; ofst < shdr.sh_offset + shdr.sh_size;
@ -674,7 +612,7 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
} }
memcpy(&val, memcpy(&val,
elf.buf + (sym.st_value - load_alignment64), elf.buf + dhdr.sh_offset + sym.st_value,
sym.st_size); sym.st_size);
} }

29
libs.mk
View File

@ -257,27 +257,12 @@ $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
# #
# Calculate platform- and compiler-specific offsets for hand coded assembly # Calculate platform- and compiler-specific offsets for hand coded assembly
# #
#
# Parse shared object files for elf, object files for mach-o and coff
#
ifeq ($(TGT_OS), linux)
OIE_LIB:=yes
OIE_EXT:=.so
else
OIE_EXT:=.o
endif
ifeq ($(CONFIG_EXTERNAL_BUILD),) # Visual Studio uses obj_int_extract.bat ifeq ($(CONFIG_EXTERNAL_BUILD),) # Visual Studio uses obj_int_extract.bat
ifeq ($(ARCH_ARM), yes) ifeq ($(ARCH_ARM), yes)
asm_com_offsets.asm: obj_int_extract asm_com_offsets.asm: obj_int_extract
asm_com_offsets.asm: $(VP8_PREFIX)common/asm_com_offsets.c$(OIE_EXT) asm_com_offsets.asm: $(VP8_PREFIX)common/asm_com_offsets.c.o
./obj_int_extract rvds $< $(ADS2GAS) > $@ ./obj_int_extract rvds $< $(ADS2GAS) > $@
OBJS-yes += $(VP8_PREFIX)common/asm_com_offsets.c.o OBJS-yes += $(VP8_PREFIX)common/asm_com_offsets.c.o
ifeq ($(OIE_LIB), yes)
$(VP8_PREFIX)common/asm_com_offsets.c.so: $(VP8_PREFIX)common/asm_com_offsets.c.o
LIBS-yes += $(VP8_PREFIX)common/asm_com_offsets.c.so
endif
CLEAN-OBJS += asm_com_offsets.asm CLEAN-OBJS += asm_com_offsets.asm
$(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_com_offsets.asm $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_com_offsets.asm
endif endif
@ -285,13 +270,9 @@ ifeq ($(CONFIG_EXTERNAL_BUILD),) # Visual Studio uses obj_int_extract.bat
ifeq ($(ARCH_ARM)$(ARCH_X86)$(ARCH_X86_64), yes) ifeq ($(ARCH_ARM)$(ARCH_X86)$(ARCH_X86_64), yes)
ifeq ($(CONFIG_VP8_ENCODER), yes) ifeq ($(CONFIG_VP8_ENCODER), yes)
asm_enc_offsets.asm: obj_int_extract asm_enc_offsets.asm: obj_int_extract
asm_enc_offsets.asm: $(VP8_PREFIX)encoder/asm_enc_offsets.c$(OIE_EXT) asm_enc_offsets.asm: $(VP8_PREFIX)encoder/asm_enc_offsets.c.o
./obj_int_extract rvds $< $(ADS2GAS) > $@ ./obj_int_extract rvds $< $(ADS2GAS) > $@
OBJS-yes += $(VP8_PREFIX)encoder/asm_enc_offsets.c.o OBJS-yes += $(VP8_PREFIX)encoder/asm_enc_offsets.c.o
ifeq ($(OIE_LIB), yes)
$(VP8_PREFIX)encoder/asm_enc_offsets.c.so: $(VP8_PREFIX)encoder/asm_enc_offsets.c.o
LIBS-yes += $(VP8_PREFIX)encoder/asm_enc_offsets.c.so
endif
CLEAN-OBJS += asm_enc_offsets.asm CLEAN-OBJS += asm_enc_offsets.asm
$(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_enc_offsets.asm $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_enc_offsets.asm
endif endif
@ -300,13 +281,9 @@ ifeq ($(CONFIG_EXTERNAL_BUILD),) # Visual Studio uses obj_int_extract.bat
ifeq ($(ARCH_ARM), yes) ifeq ($(ARCH_ARM), yes)
ifeq ($(CONFIG_VP8_DECODER), yes) ifeq ($(CONFIG_VP8_DECODER), yes)
asm_dec_offsets.asm: obj_int_extract asm_dec_offsets.asm: obj_int_extract
asm_dec_offsets.asm: $(VP8_PREFIX)decoder/asm_dec_offsets.c$(OIE_EXT) asm_dec_offsets.asm: $(VP8_PREFIX)decoder/asm_dec_offsets.c.o
./obj_int_extract rvds $< $(ADS2GAS) > $@ ./obj_int_extract rvds $< $(ADS2GAS) > $@
OBJS-yes += $(VP8_PREFIX)decoder/asm_dec_offsets.c.o OBJS-yes += $(VP8_PREFIX)decoder/asm_dec_offsets.c.o
ifeq ($(OIE_LIB), yes)
$(VP8_PREFIX)decoder/asm_dec_offsets.c.so: $(VP8_PREFIX)decoder/asm_dec_offsets.c.o
LIBS-yes += $(VP8_PREFIX)decoder/asm_dec_offsets.c.so
endif
CLEAN-OBJS += asm_dec_offsets.asm CLEAN-OBJS += asm_dec_offsets.asm
$(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_dec_offsets.asm $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)asm_dec_offsets.asm
endif endif