Mercurial > hg > index.cgi
annotate extra/README @ 577:e49d24f4a9a5
Correct bug in the object file output code leading to stack corruption
It turns out leaving a pointer to a stack allocated temporary in a
persistent data structure is not conducive to correct program operation.
Undo the export check setup in the object file output sequence so a
pointer to stack allocated memory is not left hanging when the function
returns. This seems to correct at least one mysterious crash bug, and
possibly others.
Thanks to Boisy Pitre for reporting the crash bug that led to this
discovery, as well as a previous crash bug that likely has the same
root cause.
Additional thanks to Ciaran Anscomb whose debugger wielding wizardry
revealed the exact location of this particular bit of unbrilliance.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sat, 03 Aug 2024 14:30:06 -0600 |
parents | 3832a68d83ef |
children |
rev | line source |
---|---|
72
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
1 These files are extra utility type scripts that can be used for various |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
2 purposes. |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
3 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
4 as |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
5 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
6 This is a sort of front-end script that makes lwasm look approximately like |
182 | 7 gnu as which is useful for using lwasm as a backend to gcc. You may need to |
8 edit it to make it work fully. | |
72
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
9 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
10 ld |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
11 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
12 Similar to the "as" script above except for lwlink. |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
13 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
14 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
15 ar |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
16 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
17 Similar to the "as" script above except for lwar. |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
18 |
396
d0c0fede5021
Update to gcc6809lw patch which may help compilation of some sources
William Astle <lost@l-w.ca>
parents:
340
diff
changeset
|
19 gcc6809lw-*.patch |
182 | 20 |
21 These are patches to the main gcc source distribution for specific releases. | |
340
b0fb675d1ed4
Add gcc 4.6.4 version of gcc6809
William Astle <lost@l-w.ca>
parents:
196
diff
changeset
|
22 The last number after the dash is a patch level for the specific patch. It |
b0fb675d1ed4
Add gcc 4.6.4 version of gcc6809
William Astle <lost@l-w.ca>
parents:
196
diff
changeset
|
23 is worth noting that a patch for a particular minor version of GCC may work |
b0fb675d1ed4
Add gcc 4.6.4 version of gcc6809
William Astle <lost@l-w.ca>
parents:
196
diff
changeset
|
24 with later minor versions in the same release sequence. That is, a patch |
b0fb675d1ed4
Add gcc 4.6.4 version of gcc6809
William Astle <lost@l-w.ca>
parents:
196
diff
changeset
|
25 for 4.6.1 might work with 4.6.4. These are different to the official |
b0fb675d1ed4
Add gcc 4.6.4 version of gcc6809
William Astle <lost@l-w.ca>
parents:
196
diff
changeset
|
26 gcc6809 releases in the following ways. First, all the source for as-6809 |
b0fb675d1ed4
Add gcc 4.6.4 version of gcc6809
William Astle <lost@l-w.ca>
parents:
196
diff
changeset
|
27 is removed. Also, the special "helper" makefile and directory is removed. |
b0fb675d1ed4
Add gcc 4.6.4 version of gcc6809
William Astle <lost@l-w.ca>
parents:
196
diff
changeset
|
28 Also, as of this writing, the latest "official" release was for gcc 4.3.4 |
b0fb675d1ed4
Add gcc 4.6.4 version of gcc6809
William Astle <lost@l-w.ca>
parents:
196
diff
changeset
|
29 which does not build on 64 bit linux. |
182 | 30 |
196
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
31 In the event you have used the "official" gcc6809 with the default as6809 |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
32 assembler that comes with it, you should be aware that while lwasm is mostly |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
33 compatible with it syntax wise, there are differences, particularly in |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
34 pseudo operations and source line syntax (most notably that you must have |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
35 whitespace preceeding assembler directives and instructions). You will |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
36 likely not run into these unless you are using inline asm. Refer to the |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
37 lwtools documentation for the specific line format required by lwasm. |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
38 |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
39 It is worth noting that neither gcc6809 nor lwtools comes with a standard C |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
40 library. |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
41 |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
42 It is also worth noting that for many projects, it will be more flexible to |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
43 invoke lwlink directly rather than using the ld script or gcc as a front |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
44 end. See the lwtools documentation for details on using lwlink. |
72
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
45 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
46 To use these scripts, you really need to understand how to build a gcc as a |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
47 cross compiler. The basics are that you put the as, ld, and ar scripts |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
48 whereever you plan to put your cross-development binaries. Then, when |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
49 building the cross compiler, you tell it where the scripts are. |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
50 |
196
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
51 Please note that the following recipe is an example only. If you are |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
52 planning to install multiple instances of gcc6809 for different targets, you |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
53 will most certainly need to modify the steps below. Providing a complete |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
54 understanding of building a gcc toolchain for cross compilation is well |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
55 beyond the scope of this document. |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
56 |
83bb31ca8b6a
Elaborated the readme for the gcc6809 patch
William Astle <lost@l-w.ca>
parents:
182
diff
changeset
|
57 The following works for a single installation. |
72
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
58 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
59 1. Install the ar, as, and ld scripts named m6809-unknown-{as,ar,ld} in a |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
60 directory in your path, say /usr/local/coco/bin/. |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
61 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
62 2. Make symbolic links to /bin/true for similarly named nm, objdump, ranlib, |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
63 and strip in the same directory Some of these may not be necessary. |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
64 |
182 | 65 3. Unpack gcc and apply the gcc6809 patch. The gcc6809lw* patch file |
66 in this directory is known to work with these instructions. | |
72
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
67 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
68 4. Make sure /usr/local/coco/bin is in your PATH |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
69 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
70 5. Make sure "." is NOT in your path or is at the END of PATH. If you have |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
71 gazillions of errors pop up compiling "gemodes.c", this is your problem. |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
72 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
73 6. In a directory (other than the gcc source, say "gcc-build" at the same |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
74 level as the main gcc directory, do (assuming gcc 4.3.4): |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
75 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
76 configure --enable-languages=c --target=m6809-unknown \ |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
77 --program-prefix=m6809-unknown- --enable-obsolete \ |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
78 --srcdir=../gcc-4.3.4 --disable-threads --disable-nls \ |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
79 --disable-libssp --prefix=/usr/local/coco \ |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
80 --with-as=/usr/local/coco/bin/m6809-unknown-as \ |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
81 --with-ld=/usr/local/coco/bin/m6809-unknown-ld \ |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
82 --with-ar=/usr/local/coco/bin/m6809-unknown-ar |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
83 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
84 NOTE: the last three are required to prevent selection of the wrong binutils |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
85 programs at runtime. |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
86 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
87 --with-sysroot might be useful if you have a C library involved. |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
88 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
89 7. Run "make". If errors appear, troubleshoot. |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
90 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
91 8. Run "make install". Note that you will have to have your PATH variable |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
92 for "root" set up correctly if your install prefix requires root privileges. |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
93 |
84eb35251849
Added extra scripts that can be used to run gcc6809 with lwtools as its binutils
lost@l-w.ca
parents:
diff
changeset
|
94 The above is WOMM certified. YMMV. |
396
d0c0fede5021
Update to gcc6809lw patch which may help compilation of some sources
William Astle <lost@l-w.ca>
parents:
340
diff
changeset
|
95 |
d0c0fede5021
Update to gcc6809lw patch which may help compilation of some sources
William Astle <lost@l-w.ca>
parents:
340
diff
changeset
|
96 NOTES ABOUT SPECIFIC PATCHES |
d0c0fede5021
Update to gcc6809lw patch which may help compilation of some sources
William Astle <lost@l-w.ca>
parents:
340
diff
changeset
|
97 ============================ |
d0c0fede5021
Update to gcc6809lw patch which may help compilation of some sources
William Astle <lost@l-w.ca>
parents:
340
diff
changeset
|
98 |
418
3832a68d83ef
Fix internal compiler error on "var2 = var1 + 1" patterns
William Astle <lost@l-w.ca>
parents:
417
diff
changeset
|
99 Old gcc6809 patches have been removed to avoid confusion. |
409
c8ae69cdb5a9
Update gcc6809 patch to work with pragma=newsource
William Astle <lost@l-w.ca>
parents:
396
diff
changeset
|
100 |
418
3832a68d83ef
Fix internal compiler error on "var2 = var1 + 1" patterns
William Astle <lost@l-w.ca>
parents:
417
diff
changeset
|
101 The -6 patch fixes a code generation ICE. The previous -4 patch fixed a code |
3832a68d83ef
Fix internal compiler error on "var2 = var1 + 1" patterns
William Astle <lost@l-w.ca>
parents:
417
diff
changeset
|
102 generation error that could have a substantial impact. The -3 patch fixed |
3832a68d83ef
Fix internal compiler error on "var2 = var1 + 1" patterns
William Astle <lost@l-w.ca>
parents:
417
diff
changeset
|
103 some compatibilty with new lwtools versions. The -2 patch fixed a major set |
3832a68d83ef
Fix internal compiler error on "var2 = var1 + 1" patterns
William Astle <lost@l-w.ca>
parents:
417
diff
changeset
|
104 of ICEs by completely removing the "soft registers" business. They're |
3832a68d83ef
Fix internal compiler error on "var2 = var1 + 1" patterns
William Astle <lost@l-w.ca>
parents:
417
diff
changeset
|
105 apparently not needed with gcc 4.6.x at all and it's not clear they were |
3832a68d83ef
Fix internal compiler error on "var2 = var1 + 1" patterns
William Astle <lost@l-w.ca>
parents:
417
diff
changeset
|
106 even needed with gcc 4.3.x. They also had the side effect of causing things |
3832a68d83ef
Fix internal compiler error on "var2 = var1 + 1" patterns
William Astle <lost@l-w.ca>
parents:
417
diff
changeset
|
107 to break even if they weren't in use so they had to go. In other words, the |
3832a68d83ef
Fix internal compiler error on "var2 = var1 + 1" patterns
William Astle <lost@l-w.ca>
parents:
417
diff
changeset
|
108 -6 patch is the current best version to use so there's no point including |
3832a68d83ef
Fix internal compiler error on "var2 = var1 + 1" patterns
William Astle <lost@l-w.ca>
parents:
417
diff
changeset
|
109 the old ones. |
416
b4d0eafc5bfe
Fix code generation error in gcc6809
William Astle <lost@l-w.ca>
parents:
415
diff
changeset
|
110 |