wnaspi32: Make winaspi.dll into a stand-alone 16-bit module.
[wine] / tools / winebuild / spec32.c
1 /*
2  * 32-bit spec files
3  *
4  * Copyright 1993 Robert J. Amstadt
5  * Copyright 1995 Martin von Loewis
6  * Copyright 1995, 1996, 1997 Alexandre Julliard
7  * Copyright 1997 Eric Youngdale
8  * Copyright 1999 Ulrich Weigand
9  *
10  * This library is free software; you can redistribute it and/or
11  * modify it under the terms of the GNU Lesser General Public
12  * License as published by the Free Software Foundation; either
13  * version 2.1 of the License, or (at your option) any later version.
14  *
15  * This library is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
18  * Lesser General Public License for more details.
19  *
20  * You should have received a copy of the GNU Lesser General Public
21  * License along with this library; if not, write to the Free Software
22  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
23  */
24
25 #include "config.h"
26 #include "wine/port.h"
27
28 #include <assert.h>
29 #include <ctype.h>
30 #include <stdarg.h>
31 #include <string.h>
32
33 #include "windef.h"
34 #include "winbase.h"
35 #include "wine/exception.h"
36 #include "build.h"
37
38
39 /* check if entry point needs a relay thunk */
40 static inline int needs_relay( const ORDDEF *odp )
41 {
42     /* skip nonexistent entry points */
43     if (!odp) return 0;
44     /* skip non-functions */
45     if ((odp->type != TYPE_STDCALL) && (odp->type != TYPE_CDECL)) return 0;
46     /* skip norelay and forward entry points */
47     if (odp->flags & (FLAG_NORELAY|FLAG_FORWARD)) return 0;
48     return 1;
49 }
50
51 /* check if dll will output relay thunks */
52 int has_relays( DLLSPEC *spec )
53 {
54     int i;
55
56     if (target_cpu != CPU_x86 && target_cpu != CPU_x86_64) return 0;
57
58     for (i = spec->base; i <= spec->limit; i++)
59     {
60         ORDDEF *odp = spec->ordinals[i];
61         if (needs_relay( odp )) return 1;
62     }
63     return 0;
64 }
65
66 /*******************************************************************
67  *         output_relay_debug
68  *
69  * Output entry points for relay debugging
70  */
71 static void output_relay_debug( DLLSPEC *spec )
72 {
73     int i;
74     unsigned int j, args, flags;
75
76     /* first the table of entry point offsets */
77
78     output( "\t%s\n", get_asm_rodata_section() );
79     output( "\t.align %d\n", get_alignment(4) );
80     output( ".L__wine_spec_relay_entry_point_offsets:\n" );
81
82     for (i = spec->base; i <= spec->limit; i++)
83     {
84         ORDDEF *odp = spec->ordinals[i];
85
86         if (needs_relay( odp ))
87             output( "\t.long .L__wine_spec_relay_entry_point_%d-__wine_spec_relay_entry_points\n", i );
88         else
89             output( "\t.long 0\n" );
90     }
91
92     /* then the table of argument types */
93
94     output( "\t.align %d\n", get_alignment(4) );
95     output( ".L__wine_spec_relay_arg_types:\n" );
96
97     for (i = spec->base; i <= spec->limit; i++)
98     {
99         ORDDEF *odp = spec->ordinals[i];
100         unsigned int mask = 0;
101
102         if (needs_relay( odp ))
103         {
104             for (j = 0; j < 16 && odp->u.func.arg_types[j]; j++)
105             {
106                 if (odp->u.func.arg_types[j] == 't') mask |= 1<< (j*2);
107                 if (odp->u.func.arg_types[j] == 'W') mask |= 2<< (j*2);
108             }
109         }
110         output( "\t.long 0x%08x\n", mask );
111     }
112
113     /* then the relay thunks */
114
115     output( "\t.text\n" );
116     output( "__wine_spec_relay_entry_points:\n" );
117     output( "\tnop\n" );  /* to avoid 0 offset */
118
119     for (i = spec->base; i <= spec->limit; i++)
120     {
121         ORDDEF *odp = spec->ordinals[i];
122
123         if (!needs_relay( odp )) continue;
124
125         output( "\t.align %d\n", get_alignment(4) );
126         output( ".L__wine_spec_relay_entry_point_%d:\n", i );
127
128         args = strlen(odp->u.func.arg_types);
129         flags = 0;
130
131         switch (target_cpu)
132         {
133         case CPU_x86:
134             if (odp->flags & FLAG_REGISTER)
135                 output( "\tpushl %%eax\n" );
136             else
137                 output( "\tpushl %%esp\n" );
138
139             if (odp->flags & FLAG_RET64) flags |= 1;
140             output( "\tpushl $%u\n", (flags << 24) | (args << 16) | (i - spec->base) );
141
142             if (UsePIC)
143             {
144                 output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") );
145                 output( "1:\tleal .L__wine_spec_relay_descr-1b(%%eax),%%eax\n" );
146             }
147             else output( "\tmovl $.L__wine_spec_relay_descr,%%eax\n" );
148             output( "\tpushl %%eax\n" );
149
150             if (odp->flags & FLAG_REGISTER)
151             {
152                 output( "\tcall *8(%%eax)\n" );
153             }
154             else
155             {
156                 output( "\tcall *4(%%eax)\n" );
157                 if (odp->type == TYPE_STDCALL)
158                     output( "\tret $%u\n", args * get_ptr_size() );
159                 else
160                     output( "\tret\n" );
161             }
162             break;
163
164         case CPU_x86_64:
165             output( "\tmovq %%rcx,8(%%rsp)\n" );
166             output( "\tmovq %%rdx,16(%%rsp)\n" );
167             output( "\tmovq %%r8,24(%%rsp)\n" );
168             output( "\tmovq %%r9,32(%%rsp)\n" );
169             output( "\tmovq %%rsp,%%r8\n" );
170             output( "\tmovq $%u,%%rdx\n", (flags << 24) | (args << 16) | (i - spec->base) );
171             output( "\tleaq .L__wine_spec_relay_descr(%%rip),%%rcx\n" );
172             output( "\tsubq $40,%%rsp\n" );
173             output( "\tcallq *%u(%%rcx)\n", (odp->flags & FLAG_REGISTER) ? 16 : 8 );
174             output( "\taddq $40,%%rsp\n" );
175             output( "\tret\n" );
176             break;
177
178         default:
179             assert(0);
180         }
181     }
182 }
183
184 /*******************************************************************
185  *         output_exports
186  *
187  * Output the export table for a Win32 module.
188  */
189 void output_exports( DLLSPEC *spec )
190 {
191     int i, fwd_size = 0;
192     int nr_exports = spec->base <= spec->limit ? spec->limit - spec->base + 1 : 0;
193
194     if (!nr_exports) return;
195
196     output( "\n/* export table */\n\n" );
197     output( "\t.data\n" );
198     output( "\t.align %d\n", get_alignment(4) );
199     output( ".L__wine_spec_exports:\n" );
200
201     /* export directory header */
202
203     output( "\t.long 0\n" );                       /* Characteristics */
204     output( "\t.long 0\n" );                       /* TimeDateStamp */
205     output( "\t.long 0\n" );                       /* MajorVersion/MinorVersion */
206     output( "\t.long .L__wine_spec_exp_names-.L__wine_spec_rva_base\n" ); /* Name */
207     output( "\t.long %u\n", spec->base );          /* Base */
208     output( "\t.long %u\n", nr_exports );          /* NumberOfFunctions */
209     output( "\t.long %u\n", spec->nb_names );      /* NumberOfNames */
210     output( "\t.long .L__wine_spec_exports_funcs-.L__wine_spec_rva_base\n" ); /* AddressOfFunctions */
211     if (spec->nb_names)
212     {
213         output( "\t.long .L__wine_spec_exp_name_ptrs-.L__wine_spec_rva_base\n" ); /* AddressOfNames */
214         output( "\t.long .L__wine_spec_exp_ordinals-.L__wine_spec_rva_base\n" );  /* AddressOfNameOrdinals */
215     }
216     else
217     {
218         output( "\t.long 0\n" );  /* AddressOfNames */
219         output( "\t.long 0\n" );  /* AddressOfNameOrdinals */
220     }
221
222     /* output the function pointers */
223
224     output( "\n.L__wine_spec_exports_funcs:\n" );
225     for (i = spec->base; i <= spec->limit; i++)
226     {
227         ORDDEF *odp = spec->ordinals[i];
228         if (!odp) output( "\t%s 0\n", get_asm_ptr_keyword() );
229         else switch(odp->type)
230         {
231         case TYPE_EXTERN:
232         case TYPE_STDCALL:
233         case TYPE_VARARGS:
234         case TYPE_CDECL:
235             if (odp->flags & FLAG_FORWARD)
236             {
237                 output( "\t%s .L__wine_spec_forwards+%u\n", get_asm_ptr_keyword(), fwd_size );
238                 fwd_size += strlen(odp->link_name) + 1;
239             }
240             else if (odp->flags & FLAG_EXT_LINK)
241             {
242                 output( "\t%s %s_%s\n",
243                          get_asm_ptr_keyword(), asm_name("__wine_spec_ext_link"), odp->link_name );
244             }
245             else
246             {
247                 output( "\t%s %s\n", get_asm_ptr_keyword(), asm_name(odp->link_name) );
248             }
249             break;
250         case TYPE_STUB:
251             output( "\t%s %s\n", get_asm_ptr_keyword(),
252                      asm_name( get_stub_name( odp, spec )) );
253             break;
254         default:
255             assert(0);
256         }
257     }
258
259     if (spec->nb_names)
260     {
261         /* output the function name pointers */
262
263         int namepos = strlen(spec->file_name) + 1;
264
265         output( "\n.L__wine_spec_exp_name_ptrs:\n" );
266         for (i = 0; i < spec->nb_names; i++)
267         {
268             output( "\t.long .L__wine_spec_exp_names+%u-.L__wine_spec_rva_base\n", namepos );
269             namepos += strlen(spec->names[i]->name) + 1;
270         }
271
272         /* output the function ordinals */
273
274         output( "\n.L__wine_spec_exp_ordinals:\n" );
275         for (i = 0; i < spec->nb_names; i++)
276         {
277             output( "\t%s %d\n",
278                      get_asm_short_keyword(), spec->names[i]->ordinal - spec->base );
279         }
280         if (spec->nb_names % 2)
281         {
282             output( "\t%s 0\n", get_asm_short_keyword() );
283         }
284     }
285
286     /* output the export name strings */
287
288     output( "\n.L__wine_spec_exp_names:\n" );
289     output( "\t%s \"%s\"\n", get_asm_string_keyword(), spec->file_name );
290     for (i = 0; i < spec->nb_names; i++)
291         output( "\t%s \"%s\"\n",
292                  get_asm_string_keyword(), spec->names[i]->name );
293
294     /* output forward strings */
295
296     if (fwd_size)
297     {
298         output( "\n.L__wine_spec_forwards:\n" );
299         for (i = spec->base; i <= spec->limit; i++)
300         {
301             ORDDEF *odp = spec->ordinals[i];
302             if (odp && (odp->flags & FLAG_FORWARD))
303                 output( "\t%s \"%s\"\n", get_asm_string_keyword(), odp->link_name );
304         }
305     }
306     output( "\t.align %d\n", get_alignment(get_ptr_size()) );
307     output( ".L__wine_spec_exports_end:\n" );
308
309     /* output relays */
310
311     if (!has_relays( spec ))
312     {
313         output( "\t%s 0\n", get_asm_ptr_keyword() );
314         return;
315     }
316
317     output( ".L__wine_spec_relay_descr:\n" );
318     output( "\t%s 0xdeb90001\n", get_asm_ptr_keyword() );  /* magic */
319     output( "\t%s 0,0\n", get_asm_ptr_keyword() );         /* relay funcs */
320     output( "\t%s 0\n", get_asm_ptr_keyword() );           /* private data */
321     output( "\t%s __wine_spec_relay_entry_points\n", get_asm_ptr_keyword() );
322     output( "\t%s .L__wine_spec_relay_entry_point_offsets\n", get_asm_ptr_keyword() );
323     output( "\t%s .L__wine_spec_relay_arg_types\n", get_asm_ptr_keyword() );
324
325     output_relay_debug( spec );
326 }
327
328
329 /*******************************************************************
330  *         output_asm_constructor
331  *
332  * Output code for calling a dll constructor.
333  */
334 static void output_asm_constructor( const char *constructor )
335 {
336     if (target_platform == PLATFORM_APPLE)
337     {
338         /* Mach-O doesn't have an init section */
339         output( "\n\t.mod_init_func\n" );
340         output( "\t.align %d\n", get_alignment(4) );
341         output( "\t.long %s\n", asm_name(constructor) );
342     }
343     else
344     {
345         output( "\n\t.section \".init\",\"ax\"\n" );
346         switch(target_cpu)
347         {
348         case CPU_x86:
349         case CPU_x86_64:
350             output( "\tcall %s\n", asm_name(constructor) );
351             break;
352         case CPU_SPARC:
353             output( "\tcall %s\n", asm_name(constructor) );
354             output( "\tnop\n" );
355             break;
356         case CPU_ALPHA:
357             output( "\tjsr $26,%s\n", asm_name(constructor) );
358             break;
359         case CPU_POWERPC:
360             output( "\tbl %s\n", asm_name(constructor) );
361             break;
362         }
363     }
364 }
365
366
367 /*******************************************************************
368  *         output_module
369  *
370  * Output the module data.
371  */
372 void output_module( DLLSPEC *spec )
373 {
374     int machine = 0;
375     unsigned int page_size = get_page_size();
376
377     /* Reserve some space for the PE header */
378
379     switch (target_platform)
380     {
381     case PLATFORM_APPLE:
382         output( "\t.text\n" );
383         output( "\t.align %d\n", get_alignment(page_size) );
384         output( "__wine_spec_pe_header:\n" );
385         output( "\t.space 65536\n" );
386         break;
387     case PLATFORM_SOLARIS:
388         output( "\n\t.section \".text\",\"ax\"\n" );
389         output( "__wine_spec_pe_header:\n" );
390         output( "\t.skip %u\n", 65536 + page_size );
391         break;
392     default:
393         output( "\n\t.section \".init\",\"ax\"\n" );
394         switch(target_cpu)
395         {
396         case CPU_x86:
397         case CPU_x86_64:
398         case CPU_ALPHA:
399         case CPU_SPARC:
400             output( "\tjmp 1f\n" );
401             break;
402         case CPU_POWERPC:
403             output( "\tb 1f\n" );
404             break;
405         }
406         output( "__wine_spec_pe_header:\n" );
407         output( "\t.skip %u\n", 65536 + page_size );
408         output( "1:\n" );
409         break;
410     }
411
412     /* Output the NT header */
413
414     output( "\n\t.data\n" );
415     output( "\t.align %d\n", get_alignment(get_ptr_size()) );
416     output( "%s\n", asm_globl("__wine_spec_nt_header") );
417     output( ".L__wine_spec_rva_base:\n" );
418
419     output( "\t.long 0x%04x\n", IMAGE_NT_SIGNATURE );    /* Signature */
420     switch(target_cpu)
421     {
422     case CPU_x86:     machine = IMAGE_FILE_MACHINE_I386; break;
423     case CPU_x86_64:  machine = IMAGE_FILE_MACHINE_AMD64; break;
424     case CPU_POWERPC: machine = IMAGE_FILE_MACHINE_POWERPC; break;
425     case CPU_ALPHA:   machine = IMAGE_FILE_MACHINE_ALPHA; break;
426     case CPU_SPARC:   machine = IMAGE_FILE_MACHINE_UNKNOWN; break;
427     }
428     output( "\t%s 0x%04x\n",              /* Machine */
429              get_asm_short_keyword(), machine );
430     output( "\t%s 0\n",                   /* NumberOfSections */
431              get_asm_short_keyword() );
432     output( "\t.long 0\n" );              /* TimeDateStamp */
433     output( "\t.long 0\n" );              /* PointerToSymbolTable */
434     output( "\t.long 0\n" );              /* NumberOfSymbols */
435     output( "\t%s %d\n",                  /* SizeOfOptionalHeader */
436              get_asm_short_keyword(),
437              get_ptr_size() == 8 ? IMAGE_SIZEOF_NT_OPTIONAL64_HEADER : IMAGE_SIZEOF_NT_OPTIONAL32_HEADER );
438     output( "\t%s 0x%04x\n",              /* Characteristics */
439              get_asm_short_keyword(), spec->characteristics );
440     output( "\t%s 0x%04x\n",              /* Magic */
441              get_asm_short_keyword(),
442              get_ptr_size() == 8 ? IMAGE_NT_OPTIONAL_HDR64_MAGIC : IMAGE_NT_OPTIONAL_HDR32_MAGIC );
443     output( "\t.byte 0\n" );              /* MajorLinkerVersion */
444     output( "\t.byte 0\n" );              /* MinorLinkerVersion */
445     output( "\t.long 0\n" );              /* SizeOfCode */
446     output( "\t.long 0\n" );              /* SizeOfInitializedData */
447     output( "\t.long 0\n" );              /* SizeOfUninitializedData */
448     /* note: we expand the AddressOfEntryPoint field on 64-bit by overwriting the BaseOfCode field */
449     output( "\t%s %s\n",                  /* AddressOfEntryPoint */
450             get_asm_ptr_keyword(), spec->init_func ? asm_name(spec->init_func) : "0" );
451     if (get_ptr_size() == 4)
452     {
453         output( "\t.long 0\n" );          /* BaseOfCode */
454         output( "\t.long 0\n" );          /* BaseOfData */
455     }
456     output( "\t%s __wine_spec_pe_header\n",         /* ImageBase */
457              get_asm_ptr_keyword() );
458     output( "\t.long %u\n", page_size );  /* SectionAlignment */
459     output( "\t.long %u\n", page_size );  /* FileAlignment */
460     output( "\t%s 1,0\n",                 /* Major/MinorOperatingSystemVersion */
461              get_asm_short_keyword() );
462     output( "\t%s 0,0\n",                 /* Major/MinorImageVersion */
463              get_asm_short_keyword() );
464     output( "\t%s %u,%u\n",               /* Major/MinorSubsystemVersion */
465              get_asm_short_keyword(), spec->subsystem_major, spec->subsystem_minor );
466     output( "\t.long 0\n" );                          /* Win32VersionValue */
467     output( "\t.long %s-.L__wine_spec_rva_base\n",    /* SizeOfImage */
468              asm_name("_end") );
469     output( "\t.long %u\n", page_size );  /* SizeOfHeaders */
470     output( "\t.long 0\n" );              /* CheckSum */
471     output( "\t%s 0x%04x\n",              /* Subsystem */
472              get_asm_short_keyword(), spec->subsystem );
473     output( "\t%s 0x%04x\n",              /* DllCharacteristics */
474             get_asm_short_keyword(), spec->dll_characteristics );
475     output( "\t%s %u,%u\n",               /* SizeOfStackReserve/Commit */
476              get_asm_ptr_keyword(), (spec->stack_size ? spec->stack_size : 1024) * 1024, page_size );
477     output( "\t%s %u,%u\n",               /* SizeOfHeapReserve/Commit */
478              get_asm_ptr_keyword(), (spec->heap_size ? spec->heap_size : 1024) * 1024, page_size );
479     output( "\t.long 0\n" );              /* LoaderFlags */
480     output( "\t.long 16\n" );             /* NumberOfRvaAndSizes */
481
482     if (spec->base <= spec->limit)   /* DataDirectory[IMAGE_DIRECTORY_ENTRY_EXPORT] */
483         output( "\t.long .L__wine_spec_exports-.L__wine_spec_rva_base,"
484                  ".L__wine_spec_exports_end-.L__wine_spec_exports\n" );
485     else
486         output( "\t.long 0,0\n" );
487
488     if (has_imports())   /* DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT] */
489         output( "\t.long .L__wine_spec_imports-.L__wine_spec_rva_base,"
490                  ".L__wine_spec_imports_end-.L__wine_spec_imports\n" );
491     else
492         output( "\t.long 0,0\n" );
493
494     if (spec->nb_resources)   /* DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE] */
495         output( "\t.long .L__wine_spec_resources-.L__wine_spec_rva_base,"
496                  ".L__wine_spec_resources_end-.L__wine_spec_resources\n" );
497     else
498         output( "\t.long 0,0\n" );
499
500     output( "\t.long 0,0\n" );  /* DataDirectory[3] */
501     output( "\t.long 0,0\n" );  /* DataDirectory[4] */
502     output( "\t.long 0,0\n" );  /* DataDirectory[5] */
503     output( "\t.long 0,0\n" );  /* DataDirectory[6] */
504     output( "\t.long 0,0\n" );  /* DataDirectory[7] */
505     output( "\t.long 0,0\n" );  /* DataDirectory[8] */
506     output( "\t.long 0,0\n" );  /* DataDirectory[9] */
507     output( "\t.long 0,0\n" );  /* DataDirectory[10] */
508     output( "\t.long 0,0\n" );  /* DataDirectory[11] */
509     output( "\t.long 0,0\n" );  /* DataDirectory[12] */
510     output( "\t.long 0,0\n" );  /* DataDirectory[13] */
511     output( "\t.long 0,0\n" );  /* DataDirectory[14] */
512     output( "\t.long 0,0\n" );  /* DataDirectory[15] */
513
514     output( "\n\t%s\n", get_asm_string_section() );
515     output( "%s\n", asm_globl("__wine_spec_file_name") );
516     output( ".L__wine_spec_file_name:\n" );
517     output( "\t%s \"%s\"\n", get_asm_string_keyword(), spec->file_name );
518     if (target_platform == PLATFORM_APPLE)
519         output( "\t.lcomm %s,4\n", asm_name("_end") );
520
521     output_asm_constructor( "__wine_spec_init_ctor" );
522 }
523
524
525 /*******************************************************************
526  *         BuildSpec32File
527  *
528  * Build a Win32 C file from a spec file.
529  */
530 void BuildSpec32File( DLLSPEC *spec )
531 {
532     resolve_imports( spec );
533     output_standard_file_header();
534     output_module( spec );
535     output_stubs( spec );
536     output_exports( spec );
537     output_imports( spec );
538     output_resources( spec );
539     output_gnu_stack_note();
540 }
541
542
543 /*******************************************************************
544  *         BuildDef32File
545  *
546  * Build a Win32 def file from a spec file.
547  */
548 void BuildDef32File( DLLSPEC *spec )
549 {
550     const char *name;
551     int i, total;
552
553     if (spec_file_name)
554         output( "; File generated automatically from %s; do not edit!\n\n",
555                  spec_file_name );
556     else
557         output( "; File generated automatically; do not edit!\n\n" );
558
559     output( "LIBRARY %s\n\n", spec->file_name);
560     output( "EXPORTS\n");
561
562     /* Output the exports and relay entry points */
563
564     for (i = total = 0; i < spec->nb_entry_points; i++)
565     {
566         const ORDDEF *odp = &spec->entry_points[i];
567         int is_data = 0;
568
569         if (!odp) continue;
570
571         if (odp->name) name = odp->name;
572         else if (odp->export_name) name = odp->export_name;
573         else continue;
574
575         if (!(odp->flags & FLAG_PRIVATE)) total++;
576
577         if (odp->type == TYPE_STUB) continue;
578
579         output( "  %s", name );
580
581         switch(odp->type)
582         {
583         case TYPE_EXTERN:
584             is_data = 1;
585             /* fall through */
586         case TYPE_VARARGS:
587         case TYPE_CDECL:
588             /* try to reduce output */
589             if(strcmp(name, odp->link_name) || (odp->flags & FLAG_FORWARD))
590                 output( "=%s", odp->link_name );
591             break;
592         case TYPE_STDCALL:
593         {
594             int at_param = strlen(odp->u.func.arg_types) * get_ptr_size();
595             if (!kill_at && target_cpu == CPU_x86) output( "@%d", at_param );
596             if  (odp->flags & FLAG_FORWARD)
597             {
598                 output( "=%s", odp->link_name );
599             }
600             else if (strcmp(name, odp->link_name)) /* try to reduce output */
601             {
602                 output( "=%s", odp->link_name );
603                 if (!kill_at && target_cpu == CPU_x86) output( "@%d", at_param );
604             }
605             break;
606         }
607         default:
608             assert(0);
609         }
610         output( " @%d", odp->ordinal );
611         if (!odp->name || (odp->flags & FLAG_ORDINAL)) output( " NONAME" );
612         if (is_data) output( " DATA" );
613         if (odp->flags & FLAG_PRIVATE) output( " PRIVATE" );
614         output( "\n" );
615     }
616     if (!total) warning( "%s: Import library doesn't export anything\n", spec->file_name );
617 }