Configure tsocks with a simple heuristic.
Consider the proxy has to be in a 'local' network. It means it is directly
reachable by the local machine, even if the local machine has to hop through
one or more gates to reach the proxy (often the case in enterprise networks
where class A 10.0.0.0/8 is in fact sub-divided into smaller networks, each
one of them in a different location, eg. 10.1.0.0/16 in a place, while
10.2.0.0/16 would be on the other side of the world). Not being in the same
subnet does not mean the proxy is not available.
So we will build a mask with at most high bits set, which defines a network
that has both the local machine and the proxy. Because a machine may have
more than one interface, build a mask for each of them, removing 127.0.0.1
which is added automagically by tsocks, and removing duplicate masks.
If all of this does not work, then it means the local machine can NOT in fact
reach the proxy, which in turn means the user mis-configured something (most
probably a typo...).
/trunk/scripts/crosstool.sh | 61 52 9 0 +++++++++++++++++++++++++++++++++++++++++++--------
1 file changed, 52 insertions(+), 9 deletions(-)
1 diff -durN gcc-3.4.6.orig/gcc/config/arm/coff.h gcc-3.4.6/gcc/config/arm/coff.h
2 --- gcc-3.4.6.orig/gcc/config/arm/coff.h 2004-02-24 15:25:22.000000000 +0100
3 +++ gcc-3.4.6/gcc/config/arm/coff.h 2007-08-15 23:10:54.000000000 +0200
5 #define TARGET_VERSION fputs (" (ARM/coff)", stderr)
8 -#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
9 +#define TARGET_DEFAULT \
10 + ( ARM_FLAG_SOFT_FLOAT \
12 + | ARM_FLAG_APCS_32 \
13 + | ARM_FLAG_APCS_FRAME \
14 + | ARM_FLAG_MMU_TRAPS )
16 #ifndef MULTILIB_DEFAULTS
17 #define MULTILIB_DEFAULTS \
18 - { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork" }
19 + { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork" }
22 /* This is COFF, but prefer stabs. */
23 diff -durN gcc-3.4.6.orig/gcc/config/arm/elf.h gcc-3.4.6/gcc/config/arm/elf.h
24 --- gcc-3.4.6.orig/gcc/config/arm/elf.h 2004-02-24 15:25:22.000000000 +0100
25 +++ gcc-3.4.6/gcc/config/arm/elf.h 2007-08-15 23:10:54.000000000 +0200
28 #ifndef SUBTARGET_ASM_FLOAT_SPEC
29 #define SUBTARGET_ASM_FLOAT_SPEC "\
30 -%{mapcs-float:-mfloat} %{msoft-float:-mfpu=softfpa}"
31 +%{mapcs-float:-mfloat} \
32 +%{mhard-float:-mfpu=fpa} \
33 +%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
40 #ifndef TARGET_DEFAULT
41 -#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
42 +#define TARGET_DEFAULT \
43 + ( ARM_FLAG_SOFT_FLOAT \
45 + | ARM_FLAG_APCS_32 \
46 + | ARM_FLAG_APCS_FRAME \
47 + | ARM_FLAG_MMU_TRAPS )
50 #ifndef MULTILIB_DEFAULTS
51 #define MULTILIB_DEFAULTS \
52 - { "marm", "mlittle-endian", "msoft-float", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
53 + { "marm", "mlittle-endian", "mapcs-32", "mno-thumb-interwork", "fno-leading-underscore" }
56 #define TARGET_ASM_FILE_START_APP_OFF true
57 diff -durN gcc-3.4.6.orig/gcc/config/arm/linux-elf.h gcc-3.4.6/gcc/config/arm/linux-elf.h
58 --- gcc-3.4.6.orig/gcc/config/arm/linux-elf.h 2007-08-15 23:07:00.000000000 +0200
59 +++ gcc-3.4.6/gcc/config/arm/linux-elf.h 2007-08-15 23:10:54.000000000 +0200
61 #define TARGET_LINKER_EMULATION "armelf_linux"
64 -/* Default is to use APCS-32 mode. */
66 + * Default is to use APCS-32 mode with soft-vfp.
67 + * The old Linux default for floats can be achieved with -mhard-float
68 + * or with the configure --with-float=hard option.
69 + * If -msoft-float or --with-float=soft is used then software float
70 + * support will be used just like the default but with the legacy
71 + * big endian word ordering for double float representation instead.
74 -#define TARGET_DEFAULT \
75 - ( ARM_FLAG_APCS_32 | \
76 - ARM_FLAG_MMU_TRAPS | \
77 - TARGET_ENDIAN_DEFAULT )
78 +#define TARGET_DEFAULT \
79 + ( ARM_FLAG_APCS_32 \
80 + | ARM_FLAG_SOFT_FLOAT \
81 + | TARGET_ENDIAN_DEFAULT \
83 + | ARM_FLAG_MMU_TRAPS )
85 +#undef SUBTARGET_EXTRA_ASM_SPEC
86 +#define SUBTARGET_EXTRA_ASM_SPEC "\
87 +%{mhard-float:-mfpu=fpa} \
88 +%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
90 #define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm6
94 #undef MULTILIB_DEFAULTS
95 #define MULTILIB_DEFAULTS \
96 - { "marm", TARGET_ENDIAN_OPTION, "mhard-float", "mapcs-32", "mno-thumb-interwork" }
97 + { "marm", TARGET_ENDIAN_OPTION, "mapcs-32", "mno-thumb-interwork" }
99 #define CPP_APCS_PC_DEFAULT_SPEC "-D__APCS_32__"
103 %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
105 -#define LIBGCC_SPEC "%{msoft-float:-lfloat} -lgcc"
106 +#define LIBGCC_SPEC "-lgcc"
108 /* Provide a STARTFILE_SPEC appropriate for GNU/Linux. Here we add
109 the GNU/Linux magical crtbegin.o file (see crtstuff.c) which
110 diff -durN gcc-3.4.6.orig/gcc/config/arm/t-linux gcc-3.4.6/gcc/config/arm/t-linux
111 --- gcc-3.4.6.orig/gcc/config/arm/t-linux 2003-09-20 23:09:07.000000000 +0200
112 +++ gcc-3.4.6/gcc/config/arm/t-linux 2007-08-15 23:10:54.000000000 +0200
114 LIBGCC2_DEBUG_CFLAGS = -g0
116 LIB1ASMSRC = arm/lib1funcs.asm
117 -LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx
118 +LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx \
119 + _negdf2 _addsubdf3 _muldivdf3 _cmpdf2 _unorddf2 _fixdfsi _fixunsdfsi \
120 + _truncdfsf2 _negsf2 _addsubsf3 _muldivsf3 _cmpsf2 _unordsf2 \
121 + _fixsfsi _fixunssfsi
123 # MULTILIB_OPTIONS = mhard-float/msoft-float
124 # MULTILIB_DIRNAMES = hard-float soft-float
125 diff -durN gcc-3.4.6.orig/gcc/config/arm/unknown-elf.h gcc-3.4.6/gcc/config/arm/unknown-elf.h
126 --- gcc-3.4.6.orig/gcc/config/arm/unknown-elf.h 2004-02-24 15:25:22.000000000 +0100
127 +++ gcc-3.4.6/gcc/config/arm/unknown-elf.h 2007-08-15 23:10:54.000000000 +0200
130 /* Default to using APCS-32 and software floating point. */
131 #ifndef TARGET_DEFAULT
132 -#define TARGET_DEFAULT (ARM_FLAG_SOFT_FLOAT | ARM_FLAG_APCS_32 | ARM_FLAG_APCS_FRAME | ARM_FLAG_MMU_TRAPS)
133 +#define TARGET_DEFAULT \
134 + ( ARM_FLAG_SOFT_FLOAT \
136 + | ARM_FLAG_APCS_32 \
137 + | ARM_FLAG_APCS_FRAME \
138 + | ARM_FLAG_MMU_TRAPS )
141 /* Now we define the strings used to build the spec file. */
142 diff -durN gcc-3.4.6.orig/gcc/config/arm/xscale-elf.h gcc-3.4.6/gcc/config/arm/xscale-elf.h
143 --- gcc-3.4.6.orig/gcc/config/arm/xscale-elf.h 2003-07-02 01:26:43.000000000 +0200
144 +++ gcc-3.4.6/gcc/config/arm/xscale-elf.h 2007-08-15 23:10:54.000000000 +0200
146 endian, regardless of the endian-ness of the memory
149 -#define SUBTARGET_EXTRA_ASM_SPEC "%{!mcpu=*:-mcpu=xscale} \
150 - %{mhard-float:-mfpu=fpa} \
151 - %{!mhard-float: %{msoft-float:-mfpu=softfpa;:-mfpu=softvfp}}"
152 +#define SUBTARGET_EXTRA_ASM_SPEC "\
153 +%{!mcpu=*:-mcpu=xscale} \
154 +%{mhard-float:-mfpu=fpa} \
155 +%{!mhard-float: %{msoft-float:-mfpu=softfpa} %{!msoft-float:-mfpu=softvfp}}"
157 #ifndef MULTILIB_DEFAULTS
158 #define MULTILIB_DEFAULTS \
159 - { "mlittle-endian", "mno-thumb-interwork", "marm", "msoft-float" }
160 + { "mlittle-endian", "mno-thumb-interwork", "marm" }