Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
aom-rav1e
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Xiph.Org
aom-rav1e
Commits
c73eb2ff
Commit
c73eb2ff
authored
13 years ago
by
Johann Koenig
Browse files
Options
Downloads
Patches
Plain Diff
Use shared object files for ELF
Fixes #326 Change-Id: I5f2a4257430ef62f674190acefd43a0474821288
parent
d1c0ba8f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
build/make/Makefile
+6
-3
6 additions, 3 deletions
build/make/Makefile
build/make/obj_int_extract.c
+67
-5
67 additions, 5 deletions
build/make/obj_int_extract.c
libs.mk
+26
-3
26 additions, 3 deletions
libs.mk
with
99 additions
and
11 deletions
build/make/Makefile
+
6
−
3
View file @
c73eb2ff
...
...
@@ -220,11 +220,14 @@ define so_template
# for creating them.
#
# This needs further abstraction for dealing with non-GNU linkers.
comma
:=
,
$(1)
:
$(
if
$(
quiet
)
,@echo
" [LD]
$$
@"
)
$(
qexec
)$$(
LD
)
-shared
$$(
LDFLAGS
)
\
-Wl
,--no-undefined
-Wl
,-soname,
$$(
SONAME
)
\
-Wl
,--version-script,
$$(
SO_VERSION_SCRIPT
)
-o
$$
@
\
-Wl
,--no-undefined
\
$$(
if
$$(
SONAME
)
,
-Wl
$$(
comma
)
-soname
$$(
comma
)$$(
SONAME
))
\
$$(
if
$$(
SO_VERSION_SCRIPT
)
,
-Wl
$$(
comma
)
--version-script
$$(
comma
)$$(
SO_VERSION_SCRIPT
))
\
-o
$$
@
\
$$(
filter %.o,
$$
?
)
$$(
extralibs
)
endef
...
...
@@ -291,7 +294,7 @@ LIBS=$(call enabled,LIBS)
.libs
:
$(LIBS)
@
touch
$@
$(
foreach
lib,
$(
filter %_g.a,
$(
LIBS
))
,
$(
eval
$(
call archive_template,
$(
lib
))))
$(
foreach
lib,
$(
filter %so.
$(
VERSION_MAJOR
)
.
$(
VERSION_MINOR
)
.
$(
VERSION_PATCH
)
,
$(
LIBS
))
,
$(
eval
$(
call so_template,
$(
lib
))))
$(
foreach
lib,
$(
filter
%.so
%so.
$(
VERSION_MAJOR
)
.
$(
VERSION_MINOR
)
.
$(
VERSION_PATCH
)
,
$(
LIBS
))
,
$(
eval
$(
call so_template,
$(
lib
))))
INSTALL-LIBS
=
$(
call cond_enabled,CONFIG_INSTALL_LIBS,INSTALL-LIBS
)
ifeq
($(MAKECMDGOALS),dist)
...
...
This diff is collapsed.
Click to expand it.
build/make/obj_int_extract.c
+
67
−
5
View file @
c73eb2ff
...
...
@@ -347,6 +347,46 @@ bail:
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
)
{
if
(
elf
->
bits
==
32
)
...
...
@@ -411,15 +451,19 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
int
i
;
Elf32_Off
strtab_off32
;
Elf64_Off
strtab_off64
;
/* save String Table offset for later use */
Elf32_Word
load_alignment32
;
Elf64_Xword
load_alignment64
;
memset
(
&
elf
,
0
,
sizeof
(
elf
));
elf
.
buf
=
buf
;
elf
.
sz
=
sz
;
/* Parse Header */
if
(
parse_elf_header
(
&
elf
))
goto
bail
;
/* Parse Section and Program headers for string table offset and data
* aligment, respectively.
*/
if
(
elf
.
bits
==
32
)
{
Elf32_Shdr
shdr
;
...
...
@@ -441,6 +485,15 @@ 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) */
{
...
...
@@ -463,6 +516,15 @@ 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 */
...
...
@@ -473,7 +535,7 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
{
parse_elf_section
(
&
elf
,
i
,
&
shdr
,
NULL
);
if
(
shdr
.
sh_type
==
SHT_SYM
TAB
)
if
(
shdr
.
sh_type
==
SHT_
DYN
SYM
)
{
for
(
ofst
=
shdr
.
sh_offset
;
ofst
<
shdr
.
sh_offset
+
shdr
.
sh_size
;
...
...
@@ -520,7 +582,7 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
}
memcpy
(
&
val
,
elf
.
buf
+
dhdr
.
sh_offset
+
sym
.
st_value
,
elf
.
buf
+
(
sym
.
st_value
-
load_alignment32
)
,
sym
.
st_size
);
}
...
...
@@ -565,7 +627,7 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
{
parse_elf_section
(
&
elf
,
i
,
NULL
,
&
shdr
);
if
(
shdr
.
sh_type
==
SHT_SYM
TAB
)
if
(
shdr
.
sh_type
==
SHT_
DYN
SYM
)
{
for
(
ofst
=
shdr
.
sh_offset
;
ofst
<
shdr
.
sh_offset
+
shdr
.
sh_size
;
...
...
@@ -612,7 +674,7 @@ int parse_elf(uint8_t *buf, size_t sz, output_fmt_t mode)
}
memcpy
(
&
val
,
elf
.
buf
+
dhdr
.
sh_offset
+
sym
.
st_value
,
elf
.
buf
+
(
sym
.
st_value
-
load_alignment64
)
,
sym
.
st_size
);
}
...
...
This diff is collapsed.
Click to expand it.
libs.mk
+
26
−
3
View file @
c73eb2ff
...
...
@@ -257,12 +257,27 @@ $(filter %$(ASM).o,$(OBJS-yes)): $(BUILD_PFX)vpx_config.asm
#
# 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
($(ARCH_ARM), yes)
asm_com_offsets.asm
:
obj_int_extract
asm_com_offsets.asm
:
$(VP8_PREFIX)common/asm_com_offsets.c
.o
asm_com_offsets.asm
:
$(VP8_PREFIX)common/asm_com_offsets.c
$(OIE_EXT)
./obj_int_extract rvds
$<
$(
ADS2GAS
)
>
$@
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
$(filter %$(ASM).o,$(OBJS-yes))
:
$(BUILD_PFX)asm_com_offsets.asm
endif
...
...
@@ -270,9 +285,13 @@ ifeq ($(CONFIG_EXTERNAL_BUILD),) # Visual Studio uses obj_int_extract.bat
ifeq
($(ARCH_ARM)$(ARCH_X86)$(ARCH_X86_64), yes)
ifeq
($(CONFIG_VP8_ENCODER), yes)
asm_enc_offsets.asm
:
obj_int_extract
asm_enc_offsets.asm
:
$(VP8_PREFIX)encoder/asm_enc_offsets.c
.o
asm_enc_offsets.asm
:
$(VP8_PREFIX)encoder/asm_enc_offsets.c
$(OIE_EXT)
./obj_int_extract rvds
$<
$(
ADS2GAS
)
>
$@
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
$(filter %$(ASM).o,$(OBJS-yes))
:
$(BUILD_PFX)asm_enc_offsets.asm
endif
...
...
@@ -281,9 +300,13 @@ ifeq ($(CONFIG_EXTERNAL_BUILD),) # Visual Studio uses obj_int_extract.bat
ifeq
($(ARCH_ARM), yes)
ifeq
($(CONFIG_VP8_DECODER), yes)
asm_dec_offsets.asm
:
obj_int_extract
asm_dec_offsets.asm
:
$(VP8_PREFIX)decoder/asm_dec_offsets.c
.o
asm_dec_offsets.asm
:
$(VP8_PREFIX)decoder/asm_dec_offsets.c
$(OIE_EXT)
./obj_int_extract rvds
$<
$(
ADS2GAS
)
>
$@
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
$(filter %$(ASM).o,$(OBJS-yes))
:
$(BUILD_PFX)asm_dec_offsets.asm
endif
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment