Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
d25a12fc
Commit
d25a12fc
authored
Apr 20, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net, syscall: Use native endianness for GNU/Linux netlink code.
From-SVN: r186640
parent
63d1e46d
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
67 deletions
+14
-67
libgo/Makefile.am
+0
-1
libgo/Makefile.in
+0
-2
libgo/configure
+2
-9
libgo/configure.ac
+0
-6
libgo/go/net/interface_linux.go
+6
-11
libgo/go/syscall/netlink_linux.go
+6
-37
libgo/testsuite/Makefile.in
+0
-1
No files found.
libgo/Makefile.am
View file @
d25a12fc
...
...
@@ -1559,7 +1559,6 @@ s-syscall_arch: Makefile
echo
"package syscall"
>
syscall_arch.go.tmp
echo
'const ARCH = "'
$(GOARCH)
'"'
>>
syscall_arch.go.tmp
echo
'const OS = "'
$(GOOS)
'"'
>>
syscall_arch.go.tmp
echo
'const BigEndian =
$(GO_BIGENDIAN)
'
>>
syscall_arch.go.tmp
$(SHELL)
$(srcdir)
/../move-if-change syscall_arch.go.tmp syscall_arch.go
$(STAMP)
$@
...
...
libgo/Makefile.in
View file @
d25a12fc
...
...
@@ -369,7 +369,6 @@ GOARCH = @GOARCH@
GOC
=
@GOC@
GOCFLAGS
=
$(CFLAGS)
GOOS
=
@GOOS@
GO_BIGENDIAN
=
@GO_BIGENDIAN@
GO_LIBCALL_OS_ARCH_FILE
=
@GO_LIBCALL_OS_ARCH_FILE@
GO_LIBCALL_OS_FILE
=
@GO_LIBCALL_OS_FILE@
GO_SYSCALL_OS_ARCH_FILE
=
@GO_SYSCALL_OS_ARCH_FILE@
...
...
@@ -4372,7 +4371,6 @@ s-syscall_arch: Makefile
echo
"package syscall"
>
syscall_arch.go.tmp
echo
'const ARCH = "'
$(GOARCH)
'"'
>>
syscall_arch.go.tmp
echo
'const OS = "'
$(GOOS)
'"'
>>
syscall_arch.go.tmp
echo
'const BigEndian =
$(GO_BIGENDIAN)
'
>>
syscall_arch.go.tmp
$(SHELL)
$(srcdir)
/../move-if-change syscall_arch.go.tmp syscall_arch.go
$(STAMP)
$@
...
...
libgo/configure
View file @
d25a12fc
...
...
@@ -612,7 +612,6 @@ HAVE_STRERROR_R_FALSE
HAVE_STRERROR_R_TRUE
HAVE_SYS_MMAN_H_FALSE
HAVE_SYS_MMAN_H_TRUE
GO_BIGENDIAN
PTHREAD_LIBS
PTHREAD_CFLAGS
NET_LIBS
...
...
@@ -11101,7 +11100,7 @@ else
lt_dlunknown
=
0
;
lt_dlno_uscore
=
1
;
lt_dlneed_uscore
=
2
lt_status
=
$lt_dlunknown
cat
>
conftest.
$ac_ext
<<
_LT_EOF
#line 1110
4
"configure"
#line 1110
3
"configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
...
...
@@ -11207,7 +11206,7 @@ else
lt_dlunknown
=
0
;
lt_dlno_uscore
=
1
;
lt_dlneed_uscore
=
2
lt_status
=
$lt_dlunknown
cat
>
conftest.
$ac_ext
<<
_LT_EOF
#line 112
10
"configure"
#line 112
09
"configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
...
...
@@ -14409,12 +14408,6 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
presetting ac_cv_c_bigendian=no (or yes) will help"
"
$LINENO
"
5
;;
esac
case
$ac_cv_c_bigendian
in
yes
)
GO_BIGENDIAN
=
true
;;
no
)
GO_BIGENDIAN
=
false
;;
*
)
as_fn_error
"unknown endianness"
"
$LINENO
"
5
;;
esac
...
...
libgo/configure.ac
View file @
d25a12fc
...
...
@@ -400,12 +400,6 @@ dnl Test if -lrt is required for sched_yield.
AC_SEARCH_LIBS([sched_yield], [rt])
AC_C_BIGENDIAN
case $ac_cv_c_bigendian in
yes) GO_BIGENDIAN=true ;;
no) GO_BIGENDIAN=false ;;
*) AC_MSG_ERROR([unknown endianness]) ;;
esac
AC_SUBST(GO_BIGENDIAN)
GCC_CHECK_UNWIND_GETIPINFO
...
...
libgo/go/net/interface_linux.go
View file @
d25a12fc
...
...
@@ -64,11 +64,7 @@ func newLink(ifim *syscall.IfInfomsg, attrs []syscall.NetlinkRouteAttr) Interfac
case
syscall
.
IFLA_IFNAME
:
ifi
.
Name
=
string
(
a
.
Value
[
:
len
(
a
.
Value
)
-
1
])
case
syscall
.
IFLA_MTU
:
if
syscall
.
BigEndian
{
ifi
.
MTU
=
int
(
uint32
(
a
.
Value
[
0
])
<<
24
|
uint32
(
a
.
Value
[
1
])
<<
16
|
uint32
(
a
.
Value
[
2
])
<<
8
|
uint32
(
a
.
Value
[
3
]))
}
else
{
ifi
.
MTU
=
int
(
uint32
(
a
.
Value
[
3
])
<<
24
|
uint32
(
a
.
Value
[
2
])
<<
16
|
uint32
(
a
.
Value
[
1
])
<<
8
|
uint32
(
a
.
Value
[
0
]))
}
ifi
.
MTU
=
int
(
*
(
*
uint32
)(
unsafe
.
Pointer
(
&
a
.
Value
[
:
4
][
0
])))
}
}
return
ifi
...
...
@@ -197,15 +193,14 @@ func parseProcNetIGMP(path string, ifi *Interface) []Addr {
name
=
f
[
1
]
case
len
(
f
[
0
])
==
8
:
if
ifi
==
nil
||
name
==
ifi
.
Name
{
// The Linux kernel puts the IP
// address in /proc/net/igmp in native
// endianness.
for
i
:=
0
;
i
+
1
<
len
(
f
[
0
]);
i
+=
2
{
b
[
i
/
2
],
_
=
xtoi2
(
f
[
0
][
i
:
i
+
2
],
0
)
}
var
ifma
IPAddr
if
syscall
.
BigEndian
{
ifma
=
IPAddr
{
IP
:
IPv4
(
b
[
0
],
b
[
1
],
b
[
2
],
b
[
3
])}
}
else
{
ifma
=
IPAddr
{
IP
:
IPv4
(
b
[
3
],
b
[
2
],
b
[
1
],
b
[
0
])}
}
i
:=
*
(
*
uint32
)(
unsafe
.
Pointer
(
&
b
[
:
4
][
0
]))
ifma
:=
IPAddr
{
IP
:
IPv4
(
byte
(
i
>>
24
),
byte
(
i
>>
16
),
byte
(
i
>>
8
),
byte
(
i
))}
ifmat
=
append
(
ifmat
,
ifma
.
toAddr
())
}
}
...
...
libgo/go/syscall/netlink_linux.go
View file @
d25a12fc
...
...
@@ -30,43 +30,12 @@ type NetlinkRouteRequest struct {
func
(
rr
*
NetlinkRouteRequest
)
toWireFormat
()
[]
byte
{
b
:=
make
([]
byte
,
rr
.
Header
.
Len
)
if
BigEndian
{
b
[
0
]
=
byte
(
rr
.
Header
.
Len
>>
24
)
b
[
1
]
=
byte
(
rr
.
Header
.
Len
>>
16
)
b
[
2
]
=
byte
(
rr
.
Header
.
Len
>>
8
)
b
[
3
]
=
byte
(
rr
.
Header
.
Len
)
b
[
4
]
=
byte
(
rr
.
Header
.
Type
>>
8
)
b
[
5
]
=
byte
(
rr
.
Header
.
Type
)
b
[
6
]
=
byte
(
rr
.
Header
.
Flags
>>
8
)
b
[
7
]
=
byte
(
rr
.
Header
.
Flags
)
b
[
8
]
=
byte
(
rr
.
Header
.
Seq
>>
24
)
b
[
9
]
=
byte
(
rr
.
Header
.
Seq
>>
16
)
b
[
10
]
=
byte
(
rr
.
Header
.
Seq
>>
8
)
b
[
11
]
=
byte
(
rr
.
Header
.
Seq
)
b
[
12
]
=
byte
(
rr
.
Header
.
Pid
>>
24
)
b
[
13
]
=
byte
(
rr
.
Header
.
Pid
>>
16
)
b
[
14
]
=
byte
(
rr
.
Header
.
Pid
>>
8
)
b
[
15
]
=
byte
(
rr
.
Header
.
Pid
)
b
[
16
]
=
byte
(
rr
.
Data
.
Family
)
}
else
{
b
[
0
]
=
byte
(
rr
.
Header
.
Len
)
b
[
1
]
=
byte
(
rr
.
Header
.
Len
>>
8
)
b
[
2
]
=
byte
(
rr
.
Header
.
Len
>>
16
)
b
[
3
]
=
byte
(
rr
.
Header
.
Len
>>
24
)
b
[
4
]
=
byte
(
rr
.
Header
.
Type
)
b
[
5
]
=
byte
(
rr
.
Header
.
Type
>>
8
)
b
[
6
]
=
byte
(
rr
.
Header
.
Flags
)
b
[
7
]
=
byte
(
rr
.
Header
.
Flags
>>
8
)
b
[
8
]
=
byte
(
rr
.
Header
.
Seq
)
b
[
9
]
=
byte
(
rr
.
Header
.
Seq
>>
8
)
b
[
10
]
=
byte
(
rr
.
Header
.
Seq
>>
16
)
b
[
11
]
=
byte
(
rr
.
Header
.
Seq
>>
24
)
b
[
12
]
=
byte
(
rr
.
Header
.
Pid
)
b
[
13
]
=
byte
(
rr
.
Header
.
Pid
>>
8
)
b
[
14
]
=
byte
(
rr
.
Header
.
Pid
>>
16
)
b
[
15
]
=
byte
(
rr
.
Header
.
Pid
>>
24
)
b
[
16
]
=
byte
(
rr
.
Data
.
Family
)
}
*
(
*
uint32
)(
unsafe
.
Pointer
(
&
b
[
0
:
4
][
0
]))
=
rr
.
Header
.
Len
*
(
*
uint16
)(
unsafe
.
Pointer
(
&
b
[
4
:
6
][
0
]))
=
rr
.
Header
.
Type
*
(
*
uint16
)(
unsafe
.
Pointer
(
&
b
[
6
:
8
][
0
]))
=
rr
.
Header
.
Flags
*
(
*
uint32
)(
unsafe
.
Pointer
(
&
b
[
8
:
12
][
0
]))
=
rr
.
Header
.
Seq
*
(
*
uint32
)(
unsafe
.
Pointer
(
&
b
[
12
:
16
][
0
]))
=
rr
.
Header
.
Pid
b
[
16
]
=
byte
(
rr
.
Data
.
Family
)
return
b
}
...
...
libgo/testsuite/Makefile.in
View file @
d25a12fc
...
...
@@ -86,7 +86,6 @@ GOARCH = @GOARCH@
GOC
=
@GOC@
GOCFLAGS
=
@GOCFLAGS@
GOOS
=
@GOOS@
GO_BIGENDIAN
=
@GO_BIGENDIAN@
GO_LIBCALL_OS_ARCH_FILE
=
@GO_LIBCALL_OS_ARCH_FILE@
GO_LIBCALL_OS_FILE
=
@GO_LIBCALL_OS_FILE@
GO_SYSCALL_OS_ARCH_FILE
=
@GO_SYSCALL_OS_ARCH_FILE@
...
...
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