Home | History | Annotate | Line # | Download | only in doc
HACKS revision 1.34
      1 # $NetBSD: HACKS,v 1.34 2004/05/13 15:44:04 cl Exp $
      2 #
      3 # This file is intended to document workarounds for currently unsolved
      4 # (mostly) compiler bugs.
      5 #
      6 # Format:
      7 #   hack		title
      8 #   cdate		creation date
      9 #   mdate		mod date
     10 #   who			responsible developer
     11 #   port		...
     12 #  	  affected ports, space separated, if not "all"
     13 #   file		affected file : revision : line from : line to
     14 #  	  affected files and revision and line numbers describing hack
     15 #  	  multiple lines if necessary.
     16 #   pr			NNNN ...
     17 #  	  problem reports this hack works around, if known. Space
     18 #  	  separated.
     19 #   regress		src/regress/directory/where/test/found
     20 #  	  regression test directories, if available.
     21 #   descr
     22 #  	  insert short informal description (multi-line). (Longer ones
     23 #  	  should be in the PR database. More formal descriptions might
     24 #  	  be in the regress tree. See above).
     25 #   kcah
     26 #  	  closing bracket.
     27 #
     28 # this is a comment.
     29 
     30 hack	netstat ieee1394 address printing.
     31 mdate	14 Nov 2000
     32 who	matt
     33 file	lib/libc/net/getnameinfo.c	: 1.32 : 497 : 503
     34 descr
     35 	Because the current implementation of IP over IEEE1394, the
     36 	fw device address contains more than just the IEEE1394 EUI-64.
     37 	So when printing out IEEE1394 addresses, ignore the extra stuff.
     38 kcah
     39 
     40 hack	xterm vs. libterm
     41 mdate	01 Aug 2000
     42 who	jdc
     43 file	xsrc/xc/programs/xterm/main.c	: 1.2 : 3609 : 3614
     44 pr	10383
     45 descr
     46 	In order to extend the termcap string over 1023 bytes, a ZZ entry was
     47 	introduced to point to a memory location containing the full entry.
     48 	Without this hack, xterm will export a termcap containing the ZZ
     49 	entry, which will then be ignored by libterm.  As xterm modifies the
     50 	exported termcap, this would cause those modifications to be ignored.
     51 kcah
     52 
     53 hack	wi-at-big-endian-bus
     54 cdate	15 Mar 2002
     55 who	martin
     56 file	dev/ic/wireg.h
     57 descr	Add an option to access the underlying bus in big endian byte order
     58 	to work around deficiencies in bus_space_{read,write}_* macros.
     59 	Those don't allow the implementation of a proper pcmcia bus space
     60 	tag.
     61 kcah
     62 
     63 hack	specific knowledge of colours in curses code
     64 cdate	Sun Apr  6 11:05:24 BST 2003
     65 who	jdc
     66 file	lib/libcurses/color.c : r1.24
     67 descr
     68 	Swap red/blue and yellow/cyan colours for COLOR_OTHER.
     69 	Fix is to enhance libtermcap to understand terminfo-style % sequences.
     70 	See also:
     71 	    http://mail-index.NetBSD.org/tech-userlevel/2003/04/06/0000.html
     72 kcah
     73 
     74 hack	Compensation for differing types of LINUX_USRSTACK and USRSTACK
     75 cdate	21 Aug 2003
     76 who	he
     77 file	sys/miscfs/procfs/procfs_linux.c : 1.14
     78 descr
     79 	Not all ports have LINUX_USRSTACK and/or USRSTACK defined as
     80 	literals/constants, but refer to variables of a type which is
     81 	not "unsigned long", causing compilation of procfs_linux.c to
     82 	fail with "makes integer from pointer without a cast".  This
     83 	is observed on e.g. the sun3 port.  Ideally the "types" for
     84 	symbols should be consistent across all ports.
     85 kcah
     86 
     87 hack	GCC2 isn't C99
     88 cdate	5 December 2003
     89 who	mrg
     90 file	gnu/dist/binutils/ld/ldlex.c: r1.2
     91 descr
     92 	ldlex.c is generated from ldlex.l and we get macro redefinition
     93 	errors from it if __STDC_VERSION__ is not C99 compliant.  This
     94 	hack forces NetBSD 1.6 and later systems to also include <stdint.h>
     95 	to get the relevant definitions.  This hack should be backed out
     96 	when all platforms have switched away from GCC2.
     97 kcah
     98 
     99 
    100 port	vax
    101 
    102 	hack	gcc 2.95/vax cannot handle __builtin_ffs()
    103 	cdate	Fri Aug 23 21:31:15 CEST 2002
    104 	who	ragge
    105 	file	sys/lib/libkern/libkern.h : 1.42
    106 	descr
    107 		__builtin_ffs() is ifdef'd away if __vax__. Matt Thomas has
    108 		added this feature to GCC 3 so it can be removed when switching.
    109 	kcah
    110 
    111 	hack	gcc-vax-libbz2
    112 	mdate	27 Jun 2002
    113 	who	thorpej
    114 	file	lib/libbz2/Makefile
    115 	descr
    116 		libbz2 is mis-compiled with optimization with GCC 2.95.3
    117 		on VAX.  -O0 works around this problem.
    118 	kcah
    119 
    120 	hack	gawk
    121 	mdate	8 Nov 2003
    122 	who	ragge
    123 	file	gnu/usr.bin/gawk/Makefile
    124 	descr
    125 		gawk is mis-compiled with optimization with GCC 2.95.3
    126 		on VAX.  -O0 works around this problem.
    127 	kcah
    128 
    129 	hack	vax Toolchain bug
    130 	cdate	28 Mar 2003
    131 	who	he
    132 	file	sys/arch/vax/vax/intvec.S : 1.5
    133 	descr
    134 		Workaround for PR toolchain/20924.  The assembler apparently
    135 		tries to range-check byte offsets when it doesn't have
    136 		sufficient information to make that decision.
    137 		Workaround uses `brw' instead of `brb' instruction.
    138 	kcah
    139 
    140 	hack	vax gcc 2.95.3 -Wuninitialized workarounds
    141 	cdate	6 Nov 2003
    142 	who	he
    143 	file	sys/dev/bi/if_ni.c : 1.22
    144 	file	sys/arch/vax/vax/ctu.c : 1.20
    145 	descr
    146 		Workaround for gcc 2.95.3 failing to detect that certain
    147 		variables will be initialized; so that this code compiles
    148 		with -Wuninitialized.  Should be reviewed and possibly
    149 		reverted when gcc 3.3.2 is ready for vax.
    150 	kcah
    151 
    152 	hack	vax gcc 2.95.3 structure initialization
    153 	cdat	13 May 2004
    154 	who	cl
    155 	file	sys/miscfs/kernfs/kernfs_vnops.c : 1.104
    156 	descr
    157 		Workaround for gcc 2.95.3 failing to initialize structures
    158 		and/or unions inside structures using nested designators.
    159 		Should be reverted when gcc >=3.3.3 is ready for vax.
    160 	kcah
    161 
    162 port	sparc64
    163 
    164 	hack	binutil-2.11-sparc64-pltrela
    165 	mdate	14 Aug 2001
    166 	who	eeh
    167 	file	libexec/ld.elf_so/arch/sparc64/mdreloc.c
    168 	descr
    169 		The first for PLT entries are reserved.  There is some
    170 		disagreement whether they should have associated relocation
    171 		entries.  Both the SPARC 32-bit and 64-bit ELF specifications
    172 		say that they should have relocation entries, but the 32-bit
    173 		SPARC binutils do not generate them, and now the 64-bit SPARC
    174 		binutils have stopped generating them too.
    175 
    176 		To provide binary compatibility, we will check the first entry,
    177 		if it is reserved it should not be of the type JMP_SLOT.  If it
    178 		is JMP_SLOT, then the 4 reserved entries were not generated and
    179 		our index is 4 entries too far, so we frob the rela pointer.
    180 	kcah
    181 
    182 
    183 port	arm
    184 
    185 	hack	gcc-unsigned-compare
    186 	cdate	09 Mar 2002
    187 	mdate	18 Mar 2002
    188 	who	bjh21
    189 	file	dist/bind/lib/nameser/ns_parse.c : 1.3
    190 	file	dist/dhcp/minires/ns_parse.c : 1.3
    191 	file	dist/dhcp/omapip/result.c : 1.2
    192 	file	dist/dhcp/server/failover.c : 1.3
    193 	file	gnu/dist/gawk/eval.c : 1.4
    194 	file	gnu/dist/toolchain/bfd/bfd.c : 1.2
    195 	file	gnu/dist/toolchain/bfd/format.c : 1.2
    196 	file	gnu/dist/toolchain/gdb/target.c : 1.2
    197 	file	sys/kern/vfs_subr.c : 1.172
    198 	descr	When checking that a potentially-unsigned enum is >= 0, assign
    199 		it to an int first.  This is necessary to avoid "comparison is
    200 		always true" warnings with -fshort-enums.  Casting to an int
    201 		really should be enough, but turns out not to be.
    202 	kcah
    203 
    204 	hack	gcc 3.3.2/arm sys/kern/uipc_socket.c
    205 	cdate	Tue Oct 28 18:02:16 GMT 2003
    206 	who	skrll
    207 	file	sys/conf/arm/Makefile.arm : 1.19
    208 	descr
    209 		Performing a build.sh tools on a CATS with NFS mounted 
    210 		obj and src directories results in "panic: receive 1"
    211 		The hack is to compile sys/kern/uipc_socket.c with
    212 		-fno-strict-aliasing
    213 	kcah
    214 
    215 
    216 port	pc532
    217 
    218 	hack	egcs-pc532-ip6_mroute
    219 	cdate	09 Jul 2002
    220 	who	simonb
    221 	file	sys/arch/pc532/conf/Makefile.pc532 : 1.70
    222 	file	sys/arch/pc532/conf/files.pc532 : 1.47
    223 	descr
    224 		egcs 1.1.2 gets an "internal error--insn does not satisfy its
    225 		constraints" error compiling ip6_mroute.c with -O2 or greater.
    226 		-O1 works around this problem.
    227 	kcah
    228 
    229 	hack	gcc-pc532-duffs_device
    230 	cdate	Mon Oct 27 07:23:05 UTC 2003
    231 	who	simonb
    232 	file	sys/arch/pc532/conf/Makefile.pc532 : 1.71
    233 	file	sys/arch/pc532/conf/files.pc532 : 1.52
    234 	pr	GCC PR optimization/5230
    235 	descr
    236 		gcc incorrectly gives an "unreachable code at beginning of
    237 		switch statement" for a Duff's device construct in
    238 		arch/pc532/dev/ncr.c.  There is no way to disable just this
    239 		warning, so -Wno-error is turned on for this file.
    240 	kcah
    241 
    242 	hack	gcc332-cppmacro-ice
    243 	cdate	Sun Dec  7 12:48:33 UTC 2003
    244 	who	simonb
    245 	file	gnu/usr.bin/gcc3/libcpp/Makefile : 1.2
    246 	descr
    247 		gcc 3.3.2 gets an ICE when compiling cppmacro.c with -O2.
    248 		The hack is to use -O1 for this file.  Fixed in gcc
    249 		-current mainline, unable to work out where the fix is
    250 		right now.
    251 	kcah
    252 
    253 
    254 port	sh3
    255 
    256 	hack	gcc-sh3-sed
    257 	mdate	23 Apr 2002
    258 	who	thorpej
    259 	file	usr.bin/sed/Makefile	: 1.9 : 9 : 13
    260 	descr
    261 		The in-tree GCC 2.95.3-based compiler ICEs when building
    262 		with optimization for SuperH.  Hack is to build with -O0.
    263 	kcah
    264 
    265 
    266 port	sh5
    267 
    268 	hack	SuperH SH5 Toolchain Bugs
    269 	cdate	11 Jul 2002
    270 	who	scw
    271 	file	usr.sbin/ndbootd/ndbootd.c : 1.6
    272 	file	usr.sbin/traceroute/traceroute.c : 1.48
    273 	descr
    274 		The SuperH SH5 toolchain (2.97-sh5-010522) gets an internal
    275 		compiler error when assigning a bit-wise inverted value
    276 		under some circumstances.
    277 		Work around it by splitting the statement into two.
    278 	kcah
    279 
    280 	hack	SuperH SH5 Toolchain Bugs
    281 	cdate	17 May 2003
    282 	who	scw
    283 	file	lib/libpthread/pthread_lock.c : 1.7
    284 	descr
    285 		The SuperH SH5 toolchain generates incorrect PIC code when
    286 		faced with a symbol which is declared extern, but has local
    287 		scope due to being defined within an asm() statement (without
    288 		being declared .globl in that statement). Work around it by
    289 		adding the .globl.
    290 	kcah
    291 
    292 	hack	gcc 3.3.2 on sh5 - ICE compiling reload1.c at -O2
    293 	cdate	Sun Dec  7 19:44:05 GMT 2003
    294 	who	scw
    295 	file	gnu/usr.bin/gcc3/backend/Makefile : 1.13
    296 	descr
    297 		Gcc3 for sh5 gets an ICE compiling reload1.c at -O2.
    298 		Drop to -O1 for now when building for sh5.
    299 	kcah
    300 
    301 	hack	gcc 3.3.2 on sh5 - ICE compiling elf32.c/elf64.c at -O2
    302 	cdate	Sun Dec  7 21:10:46 GMT 2003
    303 	who	scw
    304 	file	gnu/lib/libbfd/Makefile : 1.39
    305 	descr
    306 		Gcc3 for sh5 gets an ICE compiling libbfd's elf32.c
    307 		and elf64.c at -O2.
    308 		Drop to -O1 for now when building for sh5.
    309 	kcah
    310 
    311 
    312 	hack	gcc 3.3.2 on sh5 - fatal warning compiling function.c
    313 	cdate	Sun Dec  7 19:44:05 GMT 2003
    314 	who	scw
    315 	file	gnu/usr.bin/gcc3/backend/Makefile : 1.13
    316 	descr
    317 		Gcc3 for sh5 issues a warning:
    318 		.../gnu/dist/gcc/gcc/function.c:4742: warning: `and' of
    319 		    mutually exclusive equal-tests is always 0.
    320 		This causes the build to fail because of -Werror.
    321 		Work-around by defining NOGCCERROR when building for sh5.
    322 	kcah
    323 
    324 	hack	gcc 3.3.2 on sh5 - ICE compiling dist/bind/bin/named/ns_main.c
    325 	cdate	Sun Dec  7 19:44:05 GMT 2003
    326 	who	scw
    327 	file	usr.sbin/bind/named/Makefile : 1.15
    328 	descr
    329 		Gcc3 for sh5 gets an ICE compiling ns_main.c at -O2.
    330 		Drop to -O1 for now when building for sh5.
    331 	kcah
    332 
    333 
    334 port	sun2
    335 
    336 	hack	gcc 3.3.2/mdsetimage
    337 	cdate	Tue Oct 28 18:43:05 EST 2003
    338 	who	fredette
    339 	file	gnu/usr.sbin/mdsetimage/Makefile : 1.15
    340 	descr
    341 		mdsetimage.c causes cc1 to barf for as-yet unknown reasons.
    342 		this hack uses -O0 to avoid the problem.
    343 	kcah
    344 
    345 	hack	gcc 3.3.2/installboot/ffs.c
    346 	cdate	Tue Oct 28 18:43:05 EST 2003
    347 	who	fredette
    348 	file	usr.sbin/installboot/Makefile : 1.26
    349 	descr
    350 		ffs.c causes cc1 to barf for as-yet unknown reasons.  this
    351 		hack uses -O0 to avoid the problem.
    352 	kcah
    353 
    354 
    355 port	sun2, m68k
    356 
    357 	hack	gcc 3.3.2/gcc/ra-colorize.c
    358 	cdate	Wed Nov  5 11:03:13 EST 2003
    359 	who	mrg
    360 	file	gnu/usr.bin/gcc/backend/Makefile : 1.11
    361 	descr
    362 		ra-colorize.c causes a whole spew of unreferenced .L* local
    363 		symbols.  using -O0 (or even -O2 reportedly) avoids the problem.
    364 	kcah
    365 
    366 port	sparc64
    367 
    368 	hack	disable optimzations for uvm_bio.c on 32 bit kernels
    369 	cdate	Sun Mar 21 14:14:04 MET 2004
    370 	who	martin
    371 	file	sys/arch/sparc64/conf/Makefile.sparc64 : 1.53-1.54
    372 	file	sys/arch/sparc64/conf/files.sparc64 : 1.93
    373 	descr
    374 		The sparc compiler miscompiles uvm_bio.c when using
    375 		any optimization. This results in ubc_release panics.
    376 	kcah
    377