binutils-gdb/ld/deffile.h

128 lines
4.2 KiB
C
Raw Normal View History

1999-05-03 09:29:11 +02:00
/* deffile.h - header for .DEF file parser
Copyright (C) 1998-2020 Free Software Foundation, Inc.
1999-05-03 09:29:11 +02:00
Written by DJ Delorie dj@cygnus.com
2007-07-06 16:09:45 +02:00
This file is part of the GNU Binutils.
1999-05-03 09:29:11 +02:00
2007-07-06 16:09:45 +02:00
This program is free software; you can redistribute it and/or modify
1999-05-03 09:29:11 +02:00
it under the terms of the GNU General Public License as published by
2007-07-06 16:09:45 +02:00
the Free Software Foundation; either version 3, or (at your option)
1999-05-03 09:29:11 +02:00
any later version.
2007-07-06 16:09:45 +02:00
The program is distributed in the hope that it will be useful,
1999-05-03 09:29:11 +02:00
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with GLD; see the file COPYING. If not, write to the Free
2005-05-12 09:32:09 +02:00
Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
02110-1301, USA. */
1999-05-03 09:29:11 +02:00
#ifndef DEFFILE_H
#define DEFFILE_H
1999-05-03 09:29:11 +02:00
/* DEF storage definitions. Note that any ordinal may be zero, and
any pointer may be NULL, if not defined by the DEF file. */
1999-05-03 09:29:11 +02:00
typedef struct def_file_section {
char *name; /* always set */
char *class; /* may be NULL */
char flag_read, flag_write, flag_execute, flag_shared;
} def_file_section;
typedef struct def_file_export {
char *name; /* always set */
char *internal_name; /* always set, may == name */
char *its_name; /* optional export table name referred to. */
int ordinal; /* -1 if not specified */
int hint;
char flag_private, flag_constant, flag_noname, flag_data, flag_forward;
} def_file_export;
typedef struct def_file_module {
struct def_file_module *next;
void *user_data;
char name[1]; /* extended via malloc */
} def_file_module;
typedef struct def_file_import {
char *internal_name; /* always set */
def_file_module *module; /* always set */
char *name; /* may be NULL; either this or ordinal will be set */
char *its_name; /* optional import table name referred to. */
int ordinal; /* may be -1 */
int data; /* = 1 if data */
} def_file_import;
==> bfd/ChangeLog <== 2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com> * cofflink.c (process_embedded_commands): Ignore "-aligncomm". ==> gas/ChangeLog <== 2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com> * NEWS: Mention new feature. * config/obj-coff.c (obj_coff_common_parse): New function. (obj_coff_comm): Likewise. (coff_pseudo_table): Override default ".comm" definition on PE. * doc/as.texinfo: Document new feature. ==> gas/testsuite/ChangeLog <== 2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com> * gas/pe/: New directory for PE format-specific tests. * gas/pe/aligncomm-a.d: New test pattern file. * gas/pe/aligncomm-a.s: New test source file. * gas/pe/aligncomm-b.d: New test pattern file. * gas/pe/aligncomm-b.s: New test source file. * gas/pe/aligncomm-c.d: New test pattern file. * gas/pe/aligncomm-c.s: New test source file. * gas/pe/aligncomm-d.d: New test pattern file. * gas/pe/aligncomm-d.s: New test source file. * gas/pe/pe.exp: New test control script. * lib/gas-defs.exp (is_pecoff_format): New function. ==> ld/ChangeLog <== 2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com> * NEWS: Mention new feature. * deffile.h (def_file_aligncomm): Add new struct definition. (def_file): Add new def_file_aligncomm member. * deffilep.y (%token): Add new ALIGNCOMM token. (command): Add production rule for ALIGNCOMM. (def_file_free): Free any chained def_file_aligncomm structs. (diropts[]): Add entry for '-aligncomm' .drectve command. (def_aligncomm): New grammar function. * ld.texinfo: Document new feature. * pe-dll.c (process_def_file): Rename from this ... (process_def_file_and_drectve): ... to this, updating all callers, and process any aligncomms chained to the def file after scanning all .drectve sections. (generate_edata): Updated to match. (pe_dll_build_sections): Likewise. ==> ld/testsuite/ChangeLog <== 2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com> * ld-pe/aligncomm-1.c: New test source file. * ld-pe/aligncomm-2.c: Likewise. * ld-pe/aligncomm-3.c: Likewise. * ld-pe/aligncomm-4.c: Likewise. * ld-pe/aligncomm.d: New test pattern file. * ld-pe/direct.exp: Deleted, and content moved into ... * ld-pe/pe-run.exp: ... New common file for all PE run tests. * ld-pe/vers-script.exp: Deleted, and content merged into ... * ld-pe/pe-compile.exp: ... New common file for PE tests needing a compiler, adding aligned common tests. * ld-pe/pe.exp: Update header comment.
2009-05-19 18:08:08 +02:00
typedef struct def_file_aligncomm {
struct def_file_aligncomm *next; /* Chain pointer. */
char *symbol_name; /* Name of common symbol. */
unsigned int alignment; /* log-2 alignment. */
} def_file_aligncomm;
typedef struct def_file {
/* From the NAME or LIBRARY command. */
char *name;
int is_dll; /* -1 if NAME/LIBRARY not given */
bfd_vma base_address; /* (bfd_vma)(-1) if unspecified */
/* From the DESCRIPTION command. */
char *description;
/* From the STACK/HEAP command, -1 if unspecified. */
int stack_reserve, stack_commit;
int heap_reserve, heap_commit;
/* From the SECTION/SEGMENT commands. */
int num_section_defs;
def_file_section *section_defs;
/* From the EXPORTS commands. */
int num_exports;
def_file_export *exports;
/* Used by imports for module names. */
def_file_module *modules;
/* From the IMPORTS commands. */
int num_imports;
def_file_import *imports;
/* From the VERSION command, -1 if not specified. */
int version_major, version_minor;
==> bfd/ChangeLog <== 2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com> * cofflink.c (process_embedded_commands): Ignore "-aligncomm". ==> gas/ChangeLog <== 2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com> * NEWS: Mention new feature. * config/obj-coff.c (obj_coff_common_parse): New function. (obj_coff_comm): Likewise. (coff_pseudo_table): Override default ".comm" definition on PE. * doc/as.texinfo: Document new feature. ==> gas/testsuite/ChangeLog <== 2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com> * gas/pe/: New directory for PE format-specific tests. * gas/pe/aligncomm-a.d: New test pattern file. * gas/pe/aligncomm-a.s: New test source file. * gas/pe/aligncomm-b.d: New test pattern file. * gas/pe/aligncomm-b.s: New test source file. * gas/pe/aligncomm-c.d: New test pattern file. * gas/pe/aligncomm-c.s: New test source file. * gas/pe/aligncomm-d.d: New test pattern file. * gas/pe/aligncomm-d.s: New test source file. * gas/pe/pe.exp: New test control script. * lib/gas-defs.exp (is_pecoff_format): New function. ==> ld/ChangeLog <== 2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com> * NEWS: Mention new feature. * deffile.h (def_file_aligncomm): Add new struct definition. (def_file): Add new def_file_aligncomm member. * deffilep.y (%token): Add new ALIGNCOMM token. (command): Add production rule for ALIGNCOMM. (def_file_free): Free any chained def_file_aligncomm structs. (diropts[]): Add entry for '-aligncomm' .drectve command. (def_aligncomm): New grammar function. * ld.texinfo: Document new feature. * pe-dll.c (process_def_file): Rename from this ... (process_def_file_and_drectve): ... to this, updating all callers, and process any aligncomms chained to the def file after scanning all .drectve sections. (generate_edata): Updated to match. (pe_dll_build_sections): Likewise. ==> ld/testsuite/ChangeLog <== 2009-05-19 Dave Korn <dave.korn.cygwin@gmail.com> * ld-pe/aligncomm-1.c: New test source file. * ld-pe/aligncomm-2.c: Likewise. * ld-pe/aligncomm-3.c: Likewise. * ld-pe/aligncomm-4.c: Likewise. * ld-pe/aligncomm.d: New test pattern file. * ld-pe/direct.exp: Deleted, and content moved into ... * ld-pe/pe-run.exp: ... New common file for all PE run tests. * ld-pe/vers-script.exp: Deleted, and content merged into ... * ld-pe/pe-compile.exp: ... New common file for PE tests needing a compiler, adding aligned common tests. * ld-pe/pe.exp: Update header comment.
2009-05-19 18:08:08 +02:00
/* Only expected from .drectve sections, not .DEF files. */
def_file_aligncomm *aligncomms;
} def_file;
1999-05-03 09:29:11 +02:00
2003-06-28 07:28:54 +02:00
extern def_file *def_file_empty (void);
1999-05-03 09:29:11 +02:00
/* The second arg may be NULL. If not, this .def is appended to it. */
2003-06-28 07:28:54 +02:00
extern def_file *def_file_parse (const char *, def_file *);
extern void def_file_free (def_file *);
extern def_file_export *def_file_add_export (def_file *, const char *,
const char *, int,
const char *, int *);
2003-06-28 07:28:54 +02:00
extern def_file_import *def_file_add_import (def_file *, const char *,
const char *, int, const char *,
const char *, int *);
extern int def_file_add_import_from (def_file *fdef,
int num_imports,
const char *name,
const char *module,
int ordinal,
const char *internal_name,
const char *its_name);
extern def_file_import *def_file_add_import_at (def_file *, int, const char *,
const char *, int, const char *,
const char *);
2003-06-28 07:28:54 +02:00
extern void def_file_add_directive (def_file *, const char *, int);
extern def_file_module *def_get_module (def_file *, const char *);
1999-05-03 09:29:11 +02:00
#ifdef DEF_FILE_PRINT
2003-06-28 07:28:54 +02:00
extern void def_file_print (FILE *, def_file *);
1999-05-03 09:29:11 +02:00
#endif
#endif /* DEFFILE_H */