summaryrefslogtreecommitdiff
path: root/cross/i386-netbsdpe/patches/binutils-af
blob: 93f483d19daa0201966b0b5aa4cdb83b3b92e314 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
$NetBSD: binutils-af,v 1.4 2006/07/03 04:23:38 kent Exp $

--- binutils/dlltool.c.orig	2005-10-05 07:07:08.000000000 +0900
+++ binutils/dlltool.c
@@ -1363,6 +1363,8 @@ match_exclude (const char *string)
   for (excl_item = excludes; excl_item; excl_item = excl_item->next)
     if (strcmp (string, excl_item->string) == 0)
       return TRUE;
+  if (string[0] != '_')
+      return TRUE;
   return FALSE;
 }
 
@@ -2169,6 +2171,7 @@ make_one_lib_file (export_type *exp, int
   asymbol *  exp_label;
   asymbol *  iname = 0;
   asymbol *  iname2;
+  asymbol *  iname_nm = 0;
   asymbol *  iname_lab;
   asymbol ** iname_lab_pp;
   asymbol ** iname_pp;
@@ -2180,7 +2183,7 @@ make_one_lib_file (export_type *exp, int
 #ifndef EXTRA
 #define EXTRA    0
 #endif
-  asymbol *  ptrs[NSECS + 4 + EXTRA + 1];
+  asymbol *  ptrs[NSECS + 5 + EXTRA + 1];
   flagword   applicable;
   char *     outname = xmalloc (strlen (TMP_STUB) + 10);
   int        oidx = 0;
@@ -2278,6 +2281,15 @@ make_one_lib_file (export_type *exp, int
   iname2->flags = BSF_GLOBAL;
   iname2->value = 0;
 
+  if (exp->data)
+    {
+      iname_nm = bfd_make_empty_symbol (abfd);
+      iname_nm->name = make_imp_label ("__nm_", exp->name);
+      iname_nm->section = secdata[IDATA6].sec;
+      iname_nm->flags = BSF_GLOBAL;
+      iname_nm->value = 0;
+    }
+ 
   iname_lab = bfd_make_empty_symbol (abfd);
 
   iname_lab->name = head_label;
@@ -2289,6 +2301,8 @@ make_one_lib_file (export_type *exp, int
   if (create_compat_implib)
     ptrs[oidx++] = iname;
   ptrs[oidx++] = iname2;
+  if (exp->data)
+    ptrs[oidx++] = iname_nm;
 
   iname_lab_pp = ptrs + oidx;
   ptrs[oidx++] = iname_lab;
@@ -2595,7 +2609,7 @@ make_head (void)
   fprintf (f, "\t%sdoesn't load DLLs when this is set.\n", ASM_C);
   fprintf (f, "\t%s\t0\t%s loaded time\n", ASM_LONG, ASM_C);
   fprintf (f, "\t%s\t0\t%s Forwarder chain\n", ASM_LONG, ASM_C);
-  fprintf (f, "\t%s__%s_iname%s\t%s imported dll's name\n",
+  fprintf (f, "\t%s_%s_iname%s\t%s imported dll's name\n",
 	   ASM_RVA_BEFORE,
 	   imp_name_lab,
 	   ASM_RVA_AFTER,
@@ -2676,8 +2690,8 @@ make_tail (void)
   fprintf (f, "\t.section	.idata$7\n");
 #endif
 
-  fprintf (f, "\t%s\t__%s_iname\n", ASM_GLOBAL, imp_name_lab);
-  fprintf (f, "__%s_iname:\t%s\t\"%s\"\n",
+  fprintf (f, "\t%s\t_%s_iname\n", ASM_GLOBAL, imp_name_lab);
+  fprintf (f, "_%s_iname:\t%s\t\"%s\"\n",
 	   imp_name_lab, ASM_TEXT, dll_name);
 
   fclose (f);