Ticket #220: emxomf-no-export-locals.diff
File emxomf-no-export-locals.diff, 4.2 KB (added by , 14 years ago) |
---|
-
emxomf.h
30 30 void *xrealloc (void *ptr, size_t n); 31 31 char *xstrdup (const char *s); 32 32 extern const struct nlist *find_symbol (const char *name); 33 extern const struct nlist *find_symbol_ex (const char *name, int not_entry, int fext );33 extern const struct nlist *find_symbol_ex (const char *name, int not_entry, int fext, int fpub_only); 34 34 extern void set_hll_type (int index, int hll_type); 35 35 36 36 /* These variables are defined in emxomf.c. */ -
stabshll.c
598 598 599 599 if (!psym) 600 600 { 601 psym = find_symbol_ex (name, -1, ext );601 psym = find_symbol_ex (name, -1, ext, 0); 602 602 if (!psym) 603 603 { 604 604 char *psz = alloca (len + 2); 605 605 *psz = '_'; 606 606 memcpy(psz + 1, name, len + 1); 607 psym = find_symbol_ex (psz, -1, ext );607 psym = find_symbol_ex (psz, -1, ext, 0); 608 608 } 609 609 } 610 610 if (psym) … … 3565 3565 && *index >= 1 3566 3566 && symbol[-1].n_type == 0xfe) 3567 3567 { 3568 sym2 = find_symbol_ex (symbol[-1].n_un.n_strx + str_ptr, *index - 1, 1 );3568 sym2 = find_symbol_ex (symbol[-1].n_un.n_strx + str_ptr, *index - 1, 1, 0); 3569 3569 if (!sym2) 3570 3570 { 3571 3571 warning ("Cannot find address of communal/external variable %s", name); -
emxomf.c
540 540 array pointed to by sym_ptr) is returned. If the symbol is not 541 541 found, NULL is returned. 542 542 NOT_ENTRY is an entry index which is not to be found. 543 FEXT is an indicator on whether or not we can find external symbols or 544 not. */ 545 const struct nlist *find_symbol_ex (const char *name, int not_entry, int fext) 543 FEXT is an indicator on whether or not we can find external symbols. 544 FPUBONLY is an indicator of whether or not the search is restricted to 545 public symbols defined in this module. */ 546 const struct nlist *find_symbol_ex (const char *name, int not_entry, int fext, 547 int fpub_only) 546 548 { 547 549 int i, j, n, len, t; 548 550 const byte *s; … … 564 566 for (j = 0; j < n; ++j) 565 567 if (sym_ptr[j].n_un.n_strx == sym_ofs && j != not_entry) 566 568 { 569 if (fpub_only && !(sym_ptr[j].n_type & N_EXT)) 570 continue; 567 571 t = sym_ptr[j].n_type & ~N_EXT; 568 572 if ( t == N_TEXT || t == N_DATA || t == N_BSS 569 573 || (fext && sym_ptr[j].n_type == N_EXT) … … 583 587 found, NULL is returned. */ 584 588 const struct nlist *find_symbol (const char *name) 585 589 { 586 return find_symbol_ex (name, -1, 0 );590 return find_symbol_ex (name, -1, 0, 0); 587 591 } 588 592 589 593 … … 764 768 765 769 766 770 /* Calculates the hash for a string using the original djb2 aglorithm. */ 767 771 768 772 static unsigned hash_string(const char *pch, size_t cch) 769 773 { 770 774 unsigned uHash; … … 774 778 } 775 779 776 780 /* Formats a 64-bit number with a fixed with. The purpose is to encode 777 a unique number as tiny as possible while keeping within what any 778 linker should accept. The width is fixed, and the string is clipped 781 a unique number as tiny as possible while keeping within what any 782 linker should accept. The width is fixed, and the string is clipped 779 783 or padded with zeros to satisfy that. The return value is psz + cchWidth. */ 780 784 781 785 static char *format_u64(uint64_t u64, char *psz, unsigned uRadix, int cchWidth) … … 1005 1009 if (*pstarted) 1006 1010 { 1007 1011 size_t cchEncodedName = strlen(name); 1008 if ( cchEncodedName > SYMBOL_MAX_LENGTH 1012 if ( cchEncodedName > SYMBOL_MAX_LENGTH 1009 1013 && !strstr(name + SYMBOL_MAX_LENGTH - SYMBOL_WEAK_LENGTH, "$w$")) 1010 1014 cchEncodedName = SYMBOL_MAX_LENGTH + SYMBOL_HASH_LENGTH; 1011 1015 if (!fits(cchEncodedName + 3 + (type > 127))) … … 2703 2707 memcpy(pszSym, pszSymbol, cchSymbol); 2704 2708 pszSym[cchSymbol] = '\0'; 2705 2709 2706 pSym = find_symbol (pszSym);2710 pSym = find_symbol_ex(pszSym, -1, 0, 1); 2707 2711 if (pSym) 2708 2712 { 2709 2713 /*