Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
external
libvpx
Commits
af1acc85
Commit
af1acc85
authored
14 years ago
by
John Koleszar
Committed by
Code Review
14 years ago
Browse files
Options
Download
Plain Diff
Merge "support obj_int_extract on cygwin"
parents
82315be7
fd7040d2
v1.14.0-linphone
1.4.X
cayuga
eider
experimental
feature/update_to_v1.9.0-linphone
feature/uwp_nuget
forest
frame_parallel
highbitdepth
indianrunnerduck
javanwhistlingduck
khakicampbell
linphone
linphone-android
linphone-old
longtailedduck
m29-baseline
m31-baseline
m49-2623
m52-2743
m54-2840
m56-2924
m66-3359
m68-3440
mandarinduck
mcw
mcw2
nextgen
nextgenv2
pcs-2013
playground
sandbox/Jingning/experimental
sandbox/Jingning/transcode
sandbox/Jingning/vpx
sandbox/aconverse@google.com/ansbench
sandbox/awatry/initial_opencl_implementation
sandbox/debargha/playground
sandbox/hkuang/frame_parallel
sandbox/hkuang@google.com/decode
sandbox/jimbankoski@google.com/proposed-aom
sandbox/jingning@google.com/decoder_test_suite
sandbox/jingning@google.com/experimental
sandbox/jkoleszar/cached-multibit
sandbox/jkoleszar/new-rate-control
sandbox/jkoleszar/new-rtcd
sandbox/jkoleszar/reuse-modemv
sandbox/jzern@google.com/test
sandbox/wangch@google.com/vp9
sandbox/yaowu@google.com/mergeaom
stable-vp9-decoder
v1.12.0-linphone
v1.6.1_linphone
v1.7.0-linphone
v1.9.0-linphone
vp9-preview
v1.9.0
v1.9.0-rc1
v1.8.2
v1.8.1
v1.8.0
v1.7.0
v1.6.1
v1.6.0
v1.5.0
v1.4.0
v1.3.0
v1.2.0
v1.1.0
v1.0.0
v0.9.7
v0.9.7-p1
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
build/make/obj_int_extract.c
+38
-172
build/make/obj_int_extract.c
with
38 additions
and
172 deletions
build/make/obj_int_extract.c
+
38
−
172
View file @
af1acc85
...
...
@@ -9,25 +9,13 @@
*/
#include
<stdarg.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
"vpx_config.h"
#if defined(_MSC_VER) || defined(__MINGW32__)
#include
<io.h>
#include
<share.h>
#include
"vpx/vpx_integer.h"
#else
#include
<stdint.h>
#include
<unistd.h>
#endif
#include
<string.h>
#include
<sys/types.h>
#include
<sys/stat.h>
#include
<fcntl.h>
#include
<stdarg.h>
typedef
enum
{
...
...
@@ -47,7 +35,6 @@ int log_msg(const char *fmt, ...)
}
#if defined(__GNUC__) && __GNUC__
#if defined(__MACH__)
#include
<mach-o/loader.h>
...
...
@@ -225,73 +212,6 @@ bail:
}
int
main
(
int
argc
,
char
**
argv
)
{
int
fd
;
char
*
f
;
struct
stat
stat_buf
;
uint8_t
*
file_buf
;
int
res
;
if
(
argc
<
2
||
argc
>
3
)
{
fprintf
(
stderr
,
"Usage: %s [output format] <obj file>
\n\n
"
,
argv
[
0
]);
fprintf
(
stderr
,
" <obj file>
\t
MachO format object file to parse
\n
"
);
fprintf
(
stderr
,
"Output Formats:
\n
"
);
fprintf
(
stderr
,
" gas - compatible with GNU assembler
\n
"
);
fprintf
(
stderr
,
" rvds - compatible with armasm
\n
"
);
goto
bail
;
}
f
=
argv
[
2
];
if
(
!
((
!
strcmp
(
argv
[
1
],
"rvds"
))
||
(
!
strcmp
(
argv
[
1
],
"gas"
))))
f
=
argv
[
1
];
fd
=
open
(
f
,
O_RDONLY
);
if
(
fd
<
0
)
{
perror
(
"Unable to open file"
);
goto
bail
;
}
if
(
fstat
(
fd
,
&
stat_buf
))
{
perror
(
"stat"
);
goto
bail
;
}
file_buf
=
malloc
(
stat_buf
.
st_size
);
if
(
!
file_buf
)
{
perror
(
"malloc"
);
goto
bail
;
}
if
(
read
(
fd
,
file_buf
,
stat_buf
.
st_size
)
!=
stat_buf
.
st_size
)
{
perror
(
"read"
);
goto
bail
;
}
if
(
close
(
fd
))
{
perror
(
"close"
);
goto
bail
;
}
res
=
parse_macho
(
file_buf
,
stat_buf
.
st_size
);
free
(
file_buf
);
if
(
!
res
)
return
EXIT_SUCCESS
;
bail:
return
EXIT_FAILURE
;
}
#elif defined(__ELF__)
#include
"elf.h"
...
...
@@ -740,96 +660,24 @@ bail:
return
1
;
}
int
main
(
int
argc
,
char
**
argv
)
{
int
fd
;
output_fmt_t
mode
;
char
*
f
;
struct
stat
stat_buf
;
uint8_t
*
file_buf
;
int
res
;
if
(
argc
<
2
||
argc
>
3
)
{
fprintf
(
stderr
,
"Usage: %s [output format] <obj file>
\n\n
"
,
argv
[
0
]);
fprintf
(
stderr
,
" <obj file>
\t
ELF format object file to parse
\n
"
);
fprintf
(
stderr
,
"Output Formats:
\n
"
);
fprintf
(
stderr
,
" gas - compatible with GNU assembler
\n
"
);
fprintf
(
stderr
,
" rvds - compatible with armasm
\n
"
);
goto
bail
;
}
f
=
argv
[
2
];
if
(
!
strcmp
(
argv
[
1
],
"rvds"
))
mode
=
OUTPUT_FMT_RVDS
;
else
if
(
!
strcmp
(
argv
[
1
],
"gas"
))
mode
=
OUTPUT_FMT_GAS
;
else
f
=
argv
[
1
];
fd
=
open
(
f
,
O_RDONLY
);
if
(
fd
<
0
)
{
perror
(
"Unable to open file"
);
goto
bail
;
}
if
(
fstat
(
fd
,
&
stat_buf
))
{
perror
(
"stat"
);
goto
bail
;
}
file_buf
=
malloc
(
stat_buf
.
st_size
);
if
(
!
file_buf
)
{
perror
(
"malloc"
);
goto
bail
;
}
if
(
read
(
fd
,
file_buf
,
stat_buf
.
st_size
)
!=
stat_buf
.
st_size
)
{
perror
(
"read"
);
goto
bail
;
}
if
(
close
(
fd
))
{
perror
(
"close"
);
goto
bail
;
}
res
=
parse_elf
(
file_buf
,
stat_buf
.
st_size
,
mode
);
free
(
file_buf
);
if
(
!
res
)
return
EXIT_SUCCESS
;
bail:
return
EXIT_FAILURE
;
}
#endif
#endif
#endif
/* defined(__GNUC__) && __GNUC__ */
#if defined(_MSC_VER) || defined(__MINGW32__)
#if defined(_MSC_VER) || defined(__MINGW32__)
|| defined(__CYGWIN__)
/* See "Microsoft Portable Executable and Common Object File Format Specification"
for reference.
*/
#define get_le32(x) ((*(x)) | (*(x+1)) << 8 |(*(x+2)) << 16 | (*(x+3)) << 24 )
#define get_le16(x) ((*(x)) | (*(x+1)) << 8)
int
parse_coff
(
u
nsigned
__
int8
*
buf
,
size_t
sz
)
int
parse_coff
(
uint8
_t
*
buf
,
size_t
sz
)
{
unsigned
int
nsections
,
symtab_ptr
,
symtab_sz
,
strtab_ptr
;
unsigned
int
sectionrawdata_ptr
;
unsigned
int
i
;
u
nsigned
__
int8
*
ptr
;
u
nsigned
__
int32
symoffset
;
uint8
_t
*
ptr
;
uint32
_t
symoffset
;
char
**
sectionlist
;
//this array holds all section names in their correct order.
//it is used to check if the symbol is in .bss or .data section.
...
...
@@ -907,7 +755,7 @@ int parse_coff(unsigned __int8 *buf, size_t sz)
for
(
i
=
0
;
i
<
symtab_sz
;
i
++
)
{
__
int16
section
=
get_le16
(
ptr
+
12
);
//section number
int16
_t
section
=
get_le16
(
ptr
+
12
);
//section number
if
(
section
>
0
&&
ptr
[
16
]
==
2
)
{
...
...
@@ -978,20 +826,21 @@ bail:
return
1
;
}
#endif
/* defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__) */
int
main
(
int
argc
,
char
**
argv
)
{
int
fd
;
output_fmt_t
mode
;
output_fmt_t
mode
=
OUTPUT_FMT_PLAIN
;
const
char
*
f
;
struct
_stat
stat_buf
;
unsigned
__int8
*
file_buf
;
uint8_t
*
file_buf
;
int
res
;
FILE
*
fp
;
long
int
file_size
;
if
(
argc
<
2
||
argc
>
3
)
{
fprintf
(
stderr
,
"Usage: %s [output format] <obj file>
\n\n
"
,
argv
[
0
]);
fprintf
(
stderr
,
" <obj file>
\t
ELF format
object file to parse
\n
"
);
fprintf
(
stderr
,
" <obj file>
\t
object file to parse
\n
"
);
fprintf
(
stderr
,
"Output Formats:
\n
"
);
fprintf
(
stderr
,
" gas - compatible with GNU assembler
\n
"
);
fprintf
(
stderr
,
" rvds - compatible with armasm
\n
"
);
...
...
@@ -1007,15 +856,22 @@ int main(int argc, char **argv)
else
f
=
argv
[
1
];
fd
=
_sopen
(
f
,
_O_BINARY
,
_SH_DENYNO
,
_S_IREAD
|
_S_IWRITE
);
fp
=
fopen
(
f
,
"rb"
);
if
(
!
fp
)
{
perror
(
"Unable to open file"
);
goto
bail
;
}
if
(
_
fs
tat
(
fd
,
&
stat_buf
))
if
(
fs
eek
(
fp
,
0
,
SEEK_END
))
{
perror
(
"stat"
);
goto
bail
;
}
file_buf
=
malloc
(
stat_buf
.
st_size
);
file_size
=
ftell
(
fp
);
file_buf
=
malloc
(
file_size
);
if
(
!
file_buf
)
{
...
...
@@ -1023,19 +879,30 @@ int main(int argc, char **argv)
goto
bail
;
}
if
(
_read
(
fd
,
file_buf
,
stat_buf
.
st_size
)
!=
stat_buf
.
st_size
)
rewind
(
fp
);
if
(
fread
(
file_buf
,
sizeof
(
char
),
file_size
,
fp
)
!=
file_size
)
{
perror
(
"read"
);
goto
bail
;
}
if
(
_
close
(
f
d
))
if
(
f
close
(
f
p
))
{
perror
(
"close"
);
goto
bail
;
}
res
=
parse_coff
(
file_buf
,
stat_buf
.
st_size
);
#if defined(__GNUC__) && __GNUC__
#if defined(__MACH__)
res
=
parse_macho
(
file_buf
,
file_size
);
#elif defined(__ELF__)
res
=
parse_elf
(
file_buf
,
file_size
,
mode
);
#endif
#endif
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
res
=
parse_coff
(
file_buf
,
file_size
);
#endif
free
(
file_buf
);
...
...
@@ -1045,4 +912,3 @@ int main(int argc, char **argv)
bail:
return
EXIT_FAILURE
;
}
#endif
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
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
Menu
Explore
Projects
Groups
Topics
Snippets