Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
f16c280f
Commit
f16c280f
authored
Dec 08, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gopack: allow ELF/Mach-O objects in .a files without clearing allobj
R=iant CC=golang-dev
https://golang.org/cl/3503041
parent
8132f1d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
+14
-0
ar.c
src/cmd/gopack/ar.c
+14
-0
No files found.
src/cmd/gopack/ar.c
View file @
f16c280f
...
...
@@ -593,12 +593,26 @@ scanobj(Biobuf *b, Arfile *ap, long size)
vlong
offset
;
Dir
*
d
;
static
int
lastobj
=
-
1
;
uchar
buf
[
4
];
if
(
!
allobj
)
/* non-object file encountered */
return
;
offset
=
Boffset
(
b
);
obj
=
objtype
(
b
,
0
);
if
(
obj
<
0
)
{
/* not an object file */
/* maybe a foreign object file */
Bseek
(
b
,
offset
,
0
);
memset
(
buf
,
0
,
sizeof
buf
);
Bread
(
b
,
buf
,
4
);
/* maybe a foreign object file? that's okay */
if
((
buf
[
0
]
==
0x7F
&&
buf
[
1
]
==
'E'
&&
buf
[
2
]
==
'L'
&&
buf
[
3
]
==
'F'
)
||
// ELF
(
buf
[
0
]
==
0xFE
&&
buf
[
1
]
==
0xED
&&
buf
[
2
]
==
0xFA
&&
(
buf
[
3
]
&~
1
)
==
0xCE
)
||
// Mach-O big-endian
(
buf
[
3
]
==
0xFE
&&
buf
[
2
]
==
0xED
&&
buf
[
1
]
==
0xFA
&&
(
buf
[
0
]
&~
1
)
==
0xCE
))
{
// Mach-O little-endian
Bseek
(
b
,
offset
,
0
);
return
;
}
if
(
!
gflag
||
strcmp
(
file
,
pkgdef
)
!=
0
)
{
/* don't clear allobj if it's pkg defs */
fprint
(
2
,
"gopack: non-object file %s
\n
"
,
file
);
errors
++
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment