Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(25)

Delta Between Two Patch Sets: src/cmd/ld/lib.c

Issue 9223046: code review 9223046: cmd/5l, cmd/6l, cmd/8l, cmd/gc, runtime: generate and u... (Closed)
Left Patch Set: Created 11 years, 11 months ago
Right Patch Set: diff -r 81ccdb178fd7 https://code.google.com/p/go/ Created 11 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« no previous file with change/comment | « src/cmd/gc/pgen.c ('k') | src/pkg/runtime/extern.go » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Derived from Inferno utils/6l/obj.c and utils/6l/span.c 1 // Derived from Inferno utils/6l/obj.c and utils/6l/span.c
2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/obj.c 2 // http://code.google.com/p/inferno-os/source/browse/utils/6l/obj.c
3 // http://code.google.com/p/inferno-os/source/browse/utils/6l/span.c 3 // http://code.google.com/p/inferno-os/source/browse/utils/6l/span.c
4 // 4 //
5 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved. 5 // Copyright © 1994-1999 Lucent Technologies Inc. All rights reserved.
6 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net) 6 // Portions Copyright © 1995-1997 C H Forsyth (forsyth@terzarima.net)
7 // Portions Copyright © 1997-1999 Vita Nuova Limited 7 // Portions Copyright © 1997-1999 Vita Nuova Limited
8 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov a.com) 8 // Portions Copyright © 2000-2007 Vita Nuova Holdings Limited (www.vitanuov a.com)
9 // Portions Copyright © 2004,2006 Bruce Ellis 9 // Portions Copyright © 2004,2006 Bruce Ellis
10 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net) 10 // Portions Copyright © 2005-2007 C H Forsyth (forsyth@terzarima.net)
(...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after
1843 print("%cl version %s\n", thechar, getgoversion()); 1843 print("%cl version %s\n", thechar, getgoversion());
1844 errorexit(); 1844 errorexit();
1845 } 1845 }
1846 1846
1847 void 1847 void
1848 genasmsym(void (*put)(Sym*, char*, int, vlong, vlong, int, Sym*)) 1848 genasmsym(void (*put)(Sym*, char*, int, vlong, vlong, int, Sym*))
1849 { 1849 {
1850 Auto *a; 1850 Auto *a;
1851 Sym *s; 1851 Sym *s;
1852 int32 off; 1852 int32 off;
1853 int32 i;
1853 1854
1854 // These symbols won't show up in the first loop below because we 1855 // These symbols won't show up in the first loop below because we
1855 // skip STEXT symbols. Normal STEXT symbols are emitted by walking textp . 1856 // skip STEXT symbols. Normal STEXT symbols are emitted by walking textp .
1856 s = lookup("text", 0); 1857 s = lookup("text", 0);
1857 if(s->type == STEXT) 1858 if(s->type == STEXT)
1858 put(s, s->name, 'T', s->value, s->size, s->version, 0); 1859 put(s, s->name, 'T', s->value, s->size, s->version, 0);
1859 s = lookup("etext", 0); 1860 s = lookup("etext", 0);
1860 if(s->type == STEXT) 1861 if(s->type == STEXT)
1861 put(s, s->name, 'T', s->value, s->size, s->version, 0); 1862 put(s, s->name, 'T', s->value, s->size, s->version, 0);
1862 1863
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 /* filenames first */ 1904 /* filenames first */
1904 for(a=s->autom; a; a=a->link) 1905 for(a=s->autom; a; a=a->link)
1905 if(a->type == D_FILE) 1906 if(a->type == D_FILE)
1906 put(nil, a->asym->name, 'z', a->aoffset, 0, 0, 0 ); 1907 put(nil, a->asym->name, 'z', a->aoffset, 0, 0, 0 );
1907 else 1908 else
1908 if(a->type == D_FILE1) 1909 if(a->type == D_FILE1)
1909 put(nil, a->asym->name, 'Z', a->aoffset, 0, 0, 0 ); 1910 put(nil, a->asym->name, 'Z', a->aoffset, 0, 0, 0 );
1910 1911
1911 put(s, s->name, 'T', s->value, s->size, s->version, s->gotype); 1912 put(s, s->name, 'T', s->value, s->size, s->version, s->gotype);
1912 1913
1913 » » /* frame, locals, args, auto and param after */ 1914 » » /* frame, locals, args, auto, param and pointers after */
1914 put(nil, ".frame", 'm', (uint32)s->text->to.offset+PtrSize, 0, 0 , 0); 1915 put(nil, ".frame", 'm', (uint32)s->text->to.offset+PtrSize, 0, 0 , 0);
1915 put(nil, ".locals", 'm', s->locals, 0, 0, 0); 1916 put(nil, ".locals", 'm', s->locals, 0, 0, 0);
1916 if(s->text->textflag & NOSPLIT) 1917 if(s->text->textflag & NOSPLIT)
1917 put(nil, ".args", 'm', ArgsSizeUnknown, 0, 0, 0); 1918 put(nil, ".args", 'm', ArgsSizeUnknown, 0, 0, 0);
1918 else 1919 else
1919 put(nil, ".args", 'm', s->args, 0, 0, 0); 1920 put(nil, ".args", 'm', s->args, 0, 0, 0);
1921 if(s->nptrs >= 0) {
1922 put(nil, ".nptrs", 'm', s->nptrs, 0, 0, 0);
1923 for(i = 0; i < s->nptrs; i += 32)
1924 put(nil, ".ptrs", 'm', s->ptrs[i / 32], 0, 0, 0) ;
1925 }
1920 1926
1921 for(a=s->autom; a; a=a->link) { 1927 for(a=s->autom; a; a=a->link) {
1922 // Emit a or p according to actual offset, even if label is wrong. 1928 // Emit a or p according to actual offset, even if label is wrong.
1923 // This avoids negative offsets, which cannot be encoded . 1929 // This avoids negative offsets, which cannot be encoded .
1924 if(a->type != D_AUTO && a->type != D_PARAM) 1930 if(a->type != D_AUTO && a->type != D_PARAM)
1925 continue; 1931 continue;
1926 ························ 1932 ························
1927 // compute offset relative to FP 1933 // compute offset relative to FP
1928 if(a->type == D_PARAM) 1934 if(a->type == D_PARAM)
1929 off = a->aoffset; 1935 off = a->aoffset;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1967 erealloc(void *p, long n) 1973 erealloc(void *p, long n)
1968 { 1974 {
1969 p = realloc(p, n); 1975 p = realloc(p, n);
1970 if(p == nil) { 1976 if(p == nil) {
1971 cursym = S; 1977 cursym = S;
1972 diag("out of memory"); 1978 diag("out of memory");
1973 errorexit(); 1979 errorexit();
1974 } 1980 }
1975 return p; 1981 return p;
1976 } 1982 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b