+2001-09-05 Tom Rix <trix@redhat.com>
+
+ * xcofflink.c (bfd_xcoff_import_symbol): Handle import file XMC_XO
+ and syscall symbols.
+ (write_global_symbol) : Same.
+ (bfd_xcoff_export_symbol): Remove unused syscall param.
+ * libxcoff.h: Change prototype of bfd_xcoff_export symbol and
+ bfd_xcoff_import_symbol.
+ * bfd-in.h: Same.
+ * bfd-in2.h : Regenerate.
+
2001-09-04 Richard Henderson <rth@redhat.com>
* elf64-alpha.c (SKIP_HOWTO): New.
bfd_size_type));
extern boolean bfd_xcoff_import_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_vma, const char *, const char *, const char *));
+ bfd_vma, const char *, const char *, const char *, unsigned int));
extern boolean bfd_xcoff_export_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- boolean));
+ PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
extern boolean bfd_xcoff_link_count_reloc
PARAMS ((bfd *, struct bfd_link_info *, const char *));
extern boolean bfd_xcoff_record_link_assignment
bfd_size_type));
extern boolean bfd_xcoff_import_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_vma, const char *, const char *, const char *));
+ bfd_vma, const char *, const char *, const char *, unsigned int));
extern boolean bfd_xcoff_export_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- boolean));
+ PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
extern boolean bfd_xcoff_link_count_reloc
PARAMS ((bfd *, struct bfd_link_info *, const char *));
extern boolean bfd_xcoff_record_link_assignment
bfd_size_type));
extern boolean bfd_xcoff_import_symbol
PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- bfd_vma, const char *, const char *, const char *));
+ bfd_vma, const char *, const char *, const char *, unsigned int));
extern boolean bfd_xcoff_export_symbol
- PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *,
- boolean));
+ PARAMS ((bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *));
extern boolean bfd_xcoff_link_count_reloc
PARAMS ((bfd *, struct bfd_link_info *, const char *));
extern boolean bfd_xcoff_record_link_assignment
boolean
bfd_xcoff_import_symbol (output_bfd, info, harg, val, imppath, impfile,
- impmember)
+ impmember, syscall_flag)
bfd *output_bfd;
struct bfd_link_info *info;
struct bfd_link_hash_entry *harg;
const char *imppath;
const char *impfile;
const char *impmember;
+ unsigned int syscall_flag;
{
struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
h = hds;
}
- h->flags |= XCOFF_IMPORT;
+ h->flags |= (XCOFF_IMPORT | syscall_flag);
if (val != (bfd_vma) -1)
{
/* Export a symbol. */
boolean
-bfd_xcoff_export_symbol (output_bfd, info, harg, syscall)
+bfd_xcoff_export_symbol (output_bfd, info, harg)
bfd *output_bfd;
struct bfd_link_info *info;
struct bfd_link_hash_entry *harg;
- boolean syscall ATTRIBUTE_UNUSED;
{
struct xcoff_link_hash_entry *h = (struct xcoff_link_hash_entry *) harg;
if (((h->flags & XCOFF_DEF_REGULAR) == 0 &&
(h->flags & XCOFF_DEF_DYNAMIC) != 0) ||
(h->flags & XCOFF_IMPORT) != 0) {
- ldsym->l_smtype |= L_IMPORT;
+ /* Clear l_smtype
+ Import symbols are defined so the check above will make the l_smtype
+ XTY_SD. But this is not correct, it should be cleared. */
+ ldsym->l_smtype = L_IMPORT;
}
if (((h->flags & XCOFF_DEF_REGULAR) != 0 &&
ldsym->l_smclas = h->smclas;
+ if (ldsym->l_smtype & L_IMPORT)
+ {
+ if ((h->root.type == bfd_link_hash_defined ||
+ h->root.type == bfd_link_hash_defweak) &&
+ (h->root.u.def.value != 0))
+ {
+ ldsym->l_smclas = XMC_XO;
+ }
+ else if ((h->flags & (XCOFF_SYSCALL32 | XCOFF_SYSCALL64)) ==
+ (XCOFF_SYSCALL32 | XCOFF_SYSCALL64))
+ {
+ ldsym->l_smclas = XMC_SV3264;
+ }
+ else if (h->flags & XCOFF_SYSCALL32)
+ {
+ ldsym->l_smclas = XMC_SV;
+ }
+ else if (h->flags & XCOFF_SYSCALL64)
+ {
+ ldsym->l_smclas = XMC_SV64;
+ }
+ }
+
if (ldsym->l_ifile == (bfd_size_type) -1) {
ldsym->l_ifile = 0;
+2001-09-05 Tom Rix <trix@redhat.com>
+
+ * xcoff.h : Add XCOFF_SYSCALL32 and XCOFF_SYSCALL64 hash table flags.
+
2001-08-27 Andreas Jaeger <aj@suse.de>
* xcoff.h (struct __rtinit): Make proper prototype for rtl.
/* 14 ??? */
#define XMC_TC0 15 /* Read-write TOC anchor */
#define XMC_TD 16 /* Read-write data in TOC */
+#define XMC_SV64 17 /* Read-only 64 bit supervisor call */
+#define XMC_SV3264 18 /* Read-only 32 or 64 bit supervisor call */
/* The ldhdr structure. This appears at the start of the .loader
section. */
* XCOFF_RTINIT
* Symbol is the __rtinit symbol
*
+ * XCOFF_SYSCALL32
+ * Symbol is an imported 32 bit syscall
+ *
+ * XCOFF_SYSCALL64
+ * Symbol is an imported 64 bit syscall
*/
#define XCOFF_REF_REGULAR 0x00000001
#define XCOFF_DESCRIPTOR 0x00001000
#define XCOFF_MULTIPLY_DEFINED 0x00002000
#define XCOFF_RTINIT 0x00004000
-
+#define XCOFF_SYSCALL32 0x00008000
+#define XCOFF_SYSCALL64 0x00010000
/* The XCOFF linker hash table. */
* ld.texinfo (Options, --stack): Correct default value for stack
reserve.
+2001-09-05 Tom Rix <trix@redhat.com>
+
+ * emultempl/aix.em : Handle import file XMC_XO and syscall symbols.
+
2001-09-03 Andreas Jaeger <aj@suse.de>
* emultempl/beos.em: Declare prototypes for comparions functions,
{
struct export_symbol_list *next;
const char *name;
- boolean syscall;
};
static struct export_symbol_list *export_symbols;
h = bfd_link_hash_lookup (link_info.hash, el->name, false, false, false);
if (h == NULL)
einfo ("%P%F: bfd_link_hash_lookup of export symbol failed: %E\n");
- if (! bfd_xcoff_export_symbol (output_bfd, &link_info, h, el->syscall))
+ if (! bfd_xcoff_export_symbol (output_bfd, &link_info, h))
einfo ("%P%F: bfd_xcoff_export_symbol failed: %E\n");
}
return 0;
}
-
-static int is_syscall (char *input)
+static int is_syscall(char *input, unsigned int *flag)
{
/*
* 1 : yes
*/
unsigned int bit;
char *string;
-
- char *syscall_string[] = {
- "svc", /* 0x01 */
- "svc32", /* 0x02 */
- "svc3264", /* 0x04 */
- "svc64", /* 0x08 */
- "syscall", /* 0x10 */
- "syscall32", /* 0x20 */
- "syscall3264", /* 0x40 */
- "syscall64", /* 0x80 */
- NULL
+
+ struct sc {
+ char *syscall_string;
+ unsigned int flag;
+ } s [] = {
+ { "svc" /* 0x01 */, XCOFF_SYSCALL32 },
+ { "svc32" /* 0x02 */, XCOFF_SYSCALL32 },
+ { "svc3264" /* 0x04 */, XCOFF_SYSCALL32 | XCOFF_SYSCALL64 },
+ { "svc64" /* 0x08 */, XCOFF_SYSCALL64 },
+ { "syscall" /* 0x10 */, XCOFF_SYSCALL32 },
+ { "syscall32" /* 0x20 */, XCOFF_SYSCALL32 },
+ { "syscall3264" /* 0x40 */, XCOFF_SYSCALL32 | XCOFF_SYSCALL64 },
+ { "syscall64" /* 0x80 */, XCOFF_SYSCALL64 },
+ { NULL, 0 },
};
- for (bit = 0; ;bit++)
- {
+ *flag = 0;
- string = syscall_string[bit];
- if (NULL == string)
- {
- return -1;
- }
+ for (bit = 0; ;bit++) {
+
+ string = s[bit].syscall_string;
+ if (NULL == string) {
+ return -1;
+ }
- if (0 == strcmp (input, string))
- {
- if (1 << bit & ${SYSCALL_MASK})
- {
- return 1;
- }
- else
- {
- return 0;
- }
- }
+ if (0 == strcmp(input, string)) {
+ if (1 << bit & ${SYSCALL_MASK}) {
+ *flag = s[bit].flag;
+ return 1;
+ } else {
+ return 0;
+ }
}
+ }
/* should not be here */
return -1;
}
-
/* Read an import or export file. For an import file, this is called
by the before_allocation emulation routine. For an export file,
this is called by the parse_args emulation routine. */
{
char *s;
char *symname;
- boolean syscall;
+ unsigned int syscall_flag = 0;
bfd_vma address;
struct bfd_link_hash_entry *h;
{
/* This is a symbol to be imported or exported. */
symname = s;
- syscall = false;
+ syscall_flag = 0;
address = (bfd_vma) -1;
while (! isspace ((unsigned char) *s) && *s != '\0')
int status;
char *end;
- status = is_syscall (s);
-
- switch (status)
- {
- case 1:
- /* this is a system call */
- syscall = true;
- break;
-
- case 0:
- /* ignore this system call */
- break;
-
- default:
- /* not a system call, check for address */
- address = strtoul (s, &end, 0);
- if (*end != '\0')
- {
- einfo ("%s:%d: warning: syntax error in import/export file\n",
- filename, lineno);
-
- }
- }
+ status = is_syscall(s, &syscall_flag);
+
+ if (0 > status) {
+ /* not a system call, check for address */
+ address = strtoul (s, &end, 0);
+
+ /* not a system call, check for address */
+ address = strtoul (s, &end, 0);
+ if (*end != '\0')
+ {
+ einfo ("%s:%d: warning: syntax error in import/export file\n",
+ filename, lineno);
+
+ }
+ }
}
}
xmalloc (sizeof (struct export_symbol_list)));
n->next = export_symbols;
n->name = xstrdup (symname);
- n->syscall = syscall;
export_symbols = n;
}
else
{
if (! bfd_xcoff_import_symbol (output_bfd, &link_info, h,
address, imppath, impfile,
- impmember))
+ impmember, syscall_flag))
einfo ("%X%s:%d: failed to import symbol %s: %E\n",
filename, lineno, symname);
}