HACKS revision 1.11
11.11Slukem# $NetBSD: HACKS,v 1.11 2003/10/26 01:56:54 lukem Exp $ 21.1Slukem# 31.1Slukem# This file is intended to document workarounds for currently unsolved 41.1Slukem# (mostly) compiler bugs. 51.1Slukem# 61.1Slukem# Format: 71.1Slukem# hack title 81.1Slukem# cdate creation date 91.1Slukem# mdate mod date 101.1Slukem# who responsible developer 111.1Slukem# port ... 121.1Slukem# affected ports, space separated, if not "all" 131.1Slukem# file affected file : revision : line from : line to 141.1Slukem# affected files and revision and line numbers describing hack 151.1Slukem# multiple lines if necessary. 161.1Slukem# pr NNNN ... 171.1Slukem# problem reports this hack works around, if known. Space 181.1Slukem# separated. 191.1Slukem# regress src/regress/directory/where/test/found 201.1Slukem# regression test directories, if available. 211.1Slukem# descr 221.1Slukem# insert short informal description (multi-line). (Longer ones 231.1Slukem# should be in the PR database. More formal descriptions might 241.1Slukem# be in the regress tree. See above). 251.1Slukem# kcah 261.1Slukem# closing bracket. 271.1Slukem# 281.1Slukem# this is a comment. 291.1Slukem 301.1Slukemhack gcc 2.95/vax cannot handle __builtin_ffs() 311.1Slukemcdate Fri Aug 23 21:31:15 CEST 2002 321.1Slukemwho ragge 331.1Slukemport vax 341.1Slukemfile sys/lib/libkern/libkern.h : 1.42 351.1Slukemdescr 361.1Slukem __builtin_ffs() is ifdef'd away if __vax__. Matt Thomas has added 371.1Slukem this feature to GCC 3 so it can be removed when switching. 381.1Slukemkcah 391.1Slukem 401.1Slukemhack gcc 2.95.3 -O2 bug 411.1Slukemcdate Sun Jan 6 23:17:28 UTC 2002 421.1Slukemwho lukem 431.1Slukemport alpha 441.1Slukemfile sbin/newfs/mkfs.c : (all?) 451.1Slukempr 15156 461.1Slukemdescr 471.1Slukem newfs built with gcc -O2 dumps core part-way through. 481.1Slukem using -O1 avoids the problem 491.1Slukemkcah 501.1Slukem 511.1Slukemhack binutil-2.11-sparc64-pltrela 521.1Slukemmdate 14 Aug 2001 531.1Slukemwho eeh 541.1Slukemport sparc64 551.1Slukemfile libexec/ld.elf_so/reloc.c: 1.41 : 597 : 619 561.1Slukemdescr 571.1Slukem The first for PLT entries are reserved. There is some disagreement 581.1Slukem whether they should have associated relocation entries. Both the 591.1Slukem SPARC 32-bit and 64-bit ELF specifications say that they should have 601.1Slukem relocation entries, but the 32-bit SPARC binutils do not generate 611.1Slukem them, and now the 64-bit SPARC binutils have stopped generating them 621.1Slukem too. 631.1Slukem 641.1Slukem To provide binary compatibility, we will check the first entry, if it 651.1Slukem is reserved it should not be of the type JMP_SLOT. If it is JMP_SLOT, 661.1Slukem then the 4 reserved entries were not generated and our index is 4 671.1Slukem entries too far, so we frob the rela pointer. 681.1Slukemkcah 691.1Slukem 701.1Slukemhack gcc-arm32-schedule 711.1Slukemmdate 04 May 2000 721.1Slukemwho is 731.1Slukemfile lib/libc/stdlib/strtoull.c : 1.3 : 78 : 81 741.1Slukemfile lib/libc/stdlib/strtouq.c : 1.15 : 73 : 76 751.1Slukempr 9613 761.1Slukemdescr 771.1Slukem strtoull() was returning a wrong result for small numbers with bit 31 781.1Slukem set. This is a gcc/arm32 compiler bug in gcc < 2.95.2. Adding 791.1Slukem (void)&acc; works around it. 801.1Slukemkcah 811.1Slukem 821.1Slukemhack netstat ieee1394 address printing. 831.1Slukemmdate 14 Nov 2000 841.1Slukemwho matt 851.1Slukemfile lib/libc/net/getnameinfo.c : 1.32 : 497 : 503 861.1Slukemdescr 871.1Slukem Because the current implementation of IP over IEEE1394, the 881.1Slukem fw device address contains more than just the IEEE1394 EUI-64. 891.1Slukem So when printing out IEEE1394 addresses, ignore the extra stuff. 901.1Slukemkcah 911.1Slukem 921.1Slukemhack xterm vs. libterm 931.1Slukemmdate 01 Aug 2000 941.1Slukemwho jdc 951.1Slukemfile xsrc/xc/programs/xterm/main.c : 1.2 : 3609 : 3614 961.1Slukempr 10383 971.1Slukemdescr 981.1Slukem In order to extend the termcap string over 1023 bytes, a ZZ entry was 991.1Slukem introduced to point to a memory location containing the full entry. 1001.1Slukem Without this hack, xterm will export a termcap containing the ZZ 1011.1Slukem entry, which will then be ignored by libterm. As xterm modifies the 1021.1Slukem exported termcap, this would cause those modifications to be ignored. 1031.1Slukemkcah 1041.1Slukem 1051.1Slukemhack gcc-sh3-sed 1061.1Slukemmdate 23 Apr 2002 1071.1Slukemwho thorpej 1081.1Slukemfile usr.bin/sed/Makefile : 1.9 : 9 : 13 1091.1Slukemdescr 1101.1Slukem The in-tree GCC 2.95.3-based compiler ICEs when building 1111.1Slukem with optimization for SuperH. Hack is to biuld with -O0. 1121.1Slukemkcah 1131.1Slukem 1141.1Slukemhack gcc-unsigned-compare 1151.1Slukemcdate 09 Mar 2002 1161.1Slukemmdate 18 Mar 2002 1171.1Slukemwho bjh21 1181.1Slukemport arm 1191.1Slukemfile dist/bind/lib/nameser/ns_parse.c : 1.3 1201.1Slukemfile dist/dhcp/minires/ns_parse.c : 1.3 1211.1Slukemfile dist/dhcp/omapip/result.c : 1.2 1221.1Slukemfile dist/dhcp/server/failover.c : 1.3 1231.1Slukemfile gnu/dist/gawk/eval.c : 1.4 1241.1Slukemfile gnu/dist/toolchain/bfd/bfd.c : 1.2 1251.1Slukemfile gnu/dist/toolchain/bfd/format.c : 1.2 1261.1Slukemfile gnu/dist/toolchain/gdb/target.c : 1.2 1271.1Slukemfile sys/kern/vfs_subr.c : 1.172 1281.1Slukemdescr When checking that a potentially-unsigned enum is >= 0, assign it 1291.1Slukem to an int first. This is necessary to avoid "comparison is always 1301.1Slukem true" warnings with -fshort-enums. Casting to an int really should 1311.1Slukem be enough, but turns out not to be. 1321.1Slukemkcah 1331.1Slukem 1341.1Slukemhack wi-at-big-endian-bus 1351.1Slukemcdate 15 Mar 2002 1361.1Slukemwho martin 1371.1Slukemfile dev/ic/wireg.h 1381.1Slukemdescr Add an option to access the underlying bus in big endian byte order 1391.1Slukem to work around deficiencies in bus_space_{read,write}_* macros. 1401.1Slukem Those don't allow the implementation of a proper pcmcia bus space 1411.1Slukem tag. 1421.1Slukemkcah 1431.1Slukem 1441.1Slukemhack gcc 2.95.3 -O2 (-fgcse) bug 1451.1Slukemcdate Sun May 5 18:36:04 UTC 2002 1461.1Slukemwho tsutsui 1471.1Slukemport macppc 1481.1Slukemfile sys/arch/macppc/dev/adb_direct.c: 1.24 : 1895 : 1896 1491.1Slukempr 16678 1501.1Slukemdescr 1511.1Slukem gcc-2.95.3 does generates wrong code on optimization 1521.1Slukem by gcc -O2 (-fgcse), and adb_read_date_time() returns 1531.1Slukem wrong value on cuda system. 1541.1Slukem A null asm statement has been added to avoid this for workaround. 1551.1Slukemkcah 1561.1Slukem 1571.1Slukemhack gcc-vax-libbz2 1581.1Slukemmdate 27 Jun 2002 1591.1Slukemwho thorpej 1601.1Slukemport vax 1611.1Slukemfile lib/libbz2/Makefile 1621.1Slukemdescr 1631.1Slukem libbz2 is mis-compiled with optimization with GCC 2.95.3 1641.1Slukem on VAX. -O0 works around this problem. 1651.1Slukemkcah 1661.1Slukem 1671.1Slukemhack egcs-pc532-ip6_mroute 1681.1Slukemcdate 09 Jul 2002 1691.1Slukemwho simonb 1701.1Slukemport pc532 1711.1Slukemfile sys/arch/pc532/conf/Makefile.pc532 : 1.70 1721.1Slukemfile sys/arch/pc532/conf/files.pc532 : 1.47 1731.1Slukemdescr 1741.1Slukem egcs 1.1.2 gets an "internal error--insn does not satisfy its 1751.1Slukem constraints" error compiling ip6_mroute.c with -O2 or greater. 1761.1Slukem -O1 works around this problem. 1771.1Slukemkcah 1781.1Slukem 1791.1Slukemhack SuperH SH5 Toolchain Bugs 1801.1Slukemcdate 11 Jul 2002 1811.1Slukemwho scw 1821.1Slukemport sh5 1831.1Slukemfile usr.sbin/ndbootd/ndbootd.c : 1.6 1841.1Slukemfile usr.sbin/traceroute/traceroute.c : 1.48 1851.1Slukemdescr 1861.1Slukem The SuperH SH5 toolchain (2.97-sh5-010522) gets an internal 1871.1Slukem compiler error when assigning a bit-wise inverted value 1881.1Slukem under some circumstances. 1891.1Slukem Work around it by splitting the statement into two. 1901.2Shekcah 1911.2She 1921.2Shehack vax Toolchain bug 1931.2Shecdate 28 Mar 2003 1941.2Shewho he 1951.2Sheport vax 1961.2Shefile sys/arch/vax/vax/intvec.S : 1.5 1971.2Shedescr 1981.2She Workaround for PR toolchain/20924. The assembler apparently 1991.2She tries to range-check byte offsets when it doesn't have 2001.2She sufficient information to make that decision. 2011.2She Workaround uses `brw' instead of `brb' instruction. 2021.3Sjdckcah 2031.3Sjdc 2041.3Sjdchack specific knowledge of colours in curses code 2051.3Sjdccdate Sun Apr 6 11:05:24 BST 2003 2061.3Sjdcwho jdc 2071.3Sjdcport all 2081.3Sjdcfile lib/libcurses/color.c : r1.24 2091.3Sjdcdescr 2101.3Sjdc Swap red/blue and yellow/cyan colours for COLOR_OTHER. 2111.3Sjdc Fix is to enhance libtermcap to understand terminfo-style % sequences. 2121.3Sjdc See also: 2131.5Ssalo http://mail-index.NetBSD.org/tech-userlevel/2003/04/06/0000.html 2141.4Sscwkcah 2151.4Sscw 2161.4Sscwhack SuperH SH5 Toolchain Bugs 2171.4Sscwcdate 17 May 2003 2181.4Sscwwho scw 2191.4Sscwport sh5 2201.4Sscwfile lib/libpthread/pthread_lock.c : 1.7 2211.4Sscwdescr 2221.4Sscw The SuperH SH5 toolchain generates incorrect PIC code when faced 2231.4Sscw with a symbol which is declared extern, but has local scope due 2241.4Sscw to being defined within an asm() statement (without being declared 2251.4Sscw .globl in that statement). Work around it by adding the .globl. 2261.7Shekcah 2271.7She 2281.7Shehack Compensation for differing types of LINUX_USRSTACK and USRSTACK 2291.7Shecdate 21 Aug 2003 2301.7Shewho he 2311.7Shefile sys/miscfs/procfs/procfs_linux.c : 1.14 2321.7Shedescr 2331.7She Not all ports have LINUX_USRSTACK and/or USRSTACK defined as 2341.7She literals/constants, but refer to variables of a type which is 2351.7She not "unsigned long", causing compilation of procfs_linux.c to 2361.7She fail with "makes integer from pointer without a cast". This 2371.7She is observed on e.g. the sun3 port. Ideally the "types" for 2381.7She symbols should be consistent across all ports. 2391.11Slukemkcah 2401.11Slukem 2411.11Slukemhack gcc 3.3.x bug 2421.11Slukemcdate Sun Oct 26 01:50:16 UTC 2003 2431.11Slukemwho lukem 2441.11Slukemport MACHINE_ARCH == arm 2451.11Slukemfile usr.bin/newsyslog/newsyslog.c 2461.11Slukempr 22986 23002 23217 2471.11Slukemdescr 2481.11Slukem newsyslog fails with 2491.11Slukem newsyslog: config line 7: bad flags 2501.11Slukem solved when compiled with -fno-gcse-lm 2511.1Slukemkcah 252