* emultempl/aix.em: Formatting fixes.

This commit is contained in:
Alan Modra
2001-08-18 15:42:26 +00:00
parent b3327aadfd
commit fab80407fe
2 changed files with 369 additions and 333 deletions

View File

@ -1,3 +1,7 @@
2001-08-18 Alan Modra <amodra@bigpond.net.au>
* emultempl/aix.em: Formatting fixes.
2001-08-18 Alan Modra <amodra@bigpond.net.au> 2001-08-18 Alan Modra <amodra@bigpond.net.au>
* ldlang.c (insert_pad): Make use of an existing pad statement if * ldlang.c (insert_pad): Make use of an existing pad statement if

View File

@ -287,15 +287,19 @@ gld${EMULATION_NAME}_parse_args (argc, argv)
The AIX linker uses : to separate the option from the argument; The AIX linker uses : to separate the option from the argument;
changing it to = lets us treat it as a getopt option. */ changing it to = lets us treat it as a getopt option. */
indx = optind; indx = optind;
if (indx == 0) { if (indx == 0)
{
indx = 1; indx = 1;
} }
if (indx < argc && strncmp (argv[indx], "-b", 2) == 0) { if (indx < argc && strncmp (argv[indx], "-b", 2) == 0)
{
char *s; char *s;
for (s = argv[indx]; *s != '\0'; s++) { for (s = argv[indx]; *s != '\0'; s++)
if (*s == ':') { {
if (*s == ':')
{
*s = '='; *s = '=';
break; break;
} }
@ -362,7 +366,8 @@ gld${EMULATION_NAME}_parse_args (argc, argv)
case OPTION_IGNORE: case OPTION_IGNORE:
break; break;
case OPTION_INITFINI: { case OPTION_INITFINI:
{
/* /*
* The aix linker init fini has the format : * The aix linker init fini has the format :
* *
@ -380,18 +385,23 @@ gld${EMULATION_NAME}_parse_args (argc, argv)
char *t, *i, *f; char *t, *i, *f;
i = t = optarg; i = t = optarg;
while (*t && ':' != *t) t++; while (*t && ':' != *t)
if (*t) *t++ = 0; t++;
if (*t)
*t++ = 0;
if (0 != strlen(i)) { if (0 != strlen (i))
{
link_info.init_function = i; link_info.init_function = i;
} }
f = t; f = t;
while (*t && ':' != *t) t++; while (*t && ':' != *t)
t++;
*t = 0; *t = 0;
if (0 != strlen(f)) { if (0 != strlen (f))
{
link_info.fini_function = f; link_info.fini_function = f;
} }
} }
@ -435,8 +445,7 @@ gld${EMULATION_NAME}_parse_args (argc, argv)
case OPTION_MAXDATA: case OPTION_MAXDATA:
val = strtoull (optarg, &end, 0); val = strtoull (optarg, &end, 0);
if (*end != '\0') if (*end != '\0')
einfo ("%P: warning: ignoring invalid -bmaxdata number %s\n", einfo ("%P: warning: ignoring invalid -bmaxdata number %s\n", optarg);
optarg);
else else
maxdata = val; maxdata = val;
break; break;
@ -444,8 +453,7 @@ gld${EMULATION_NAME}_parse_args (argc, argv)
case OPTION_MAXSTACK: case OPTION_MAXSTACK:
val = strtoull (optarg, &end, 0); val = strtoull (optarg, &end, 0);
if (*end != '\0') if (*end != '\0')
einfo ("%P: warning: ignoring invalid -bmaxstack number %s\n", einfo ("%P: warning: ignoring invalid -bmaxstack number %s\n", optarg);
optarg);
else else
maxstack = val; maxstack = val;
break; break;
@ -625,7 +633,8 @@ gld${EMULATION_NAME}_before_allocation ()
/* Handle the import and export files, if any. */ /* Handle the import and export files, if any. */
for (fl = import_files; fl != NULL; fl = fl->next) for (fl = import_files; fl != NULL; fl = fl->next)
gld${EMULATION_NAME}_read_file (fl->name, true); gld${EMULATION_NAME}_read_file (fl->name, true);
for (el = export_symbols; el != NULL; el = el->next) { for (el = export_symbols; el != NULL; el = el->next)
{
struct bfd_link_hash_entry *h; struct bfd_link_hash_entry *h;
h = bfd_link_hash_lookup (link_info.hash, el->name, false, false, false); h = bfd_link_hash_lookup (link_info.hash, el->name, false, false, false);
@ -681,7 +690,8 @@ gld${EMULATION_NAME}_before_allocation ()
/* Look through the special sections, and put them in the right /* Look through the special sections, and put them in the right
place in the link ordering. This is especially magic. */ place in the link ordering. This is especially magic. */
for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++) { for (i = 0; i < XCOFF_NUMBER_OF_SPECIAL_SECTIONS; i++)
{
asection *sec; asection *sec;
lang_output_section_statement_type *os; lang_output_section_statement_type *os;
lang_statement_union_type **pls; lang_statement_union_type **pls;
@ -702,27 +712,32 @@ gld${EMULATION_NAME}_before_allocation ()
sec->output_section->name); sec->output_section->name);
} }
for (pls = &os->children.head; *pls != NULL; pls = &(*pls)->next) { for (pls = &os->children.head; *pls != NULL; pls = &(*pls)->header.next)
{
if ((*pls)->header.type == lang_input_section_enum && if ((*pls)->header.type == lang_input_section_enum &&
(*pls)->input_section.section == sec) { (*pls)->input_section.section == sec)
{
is = (lang_input_section_type *) *pls; is = (lang_input_section_type *) *pls;
*pls = (*pls)->next; *pls = (*pls)->header.next;
break; break;
} }
if ((*pls)->header.type == lang_wild_statement_enum) { if ((*pls)->header.type == lang_wild_statement_enum)
{
lang_statement_union_type **pwls; lang_statement_union_type **pwls;
for (pwls = &(*pls)->wild_statement.children.head; for (pwls = &(*pls)->wild_statement.children.head;
*pwls != NULL; *pwls != NULL;
pwls = &(*pwls)->next) { pwls = &(*pwls)->header.next)
{
if ((*pwls)->header.type == lang_input_section_enum && if ((*pwls)->header.type == lang_input_section_enum &&
(*pwls)->input_section.section == sec) { (*pwls)->input_section.section == sec)
{
is = (lang_input_section_type *) *pwls; is = (lang_input_section_type *) *pwls;
*pwls = (*pwls)->next; *pwls = (*pwls)->header.next;
break; break;
} }
} }
@ -732,13 +747,15 @@ gld${EMULATION_NAME}_before_allocation ()
} }
} }
if (is == NULL) { if (is == NULL)
{
einfo ("%P%F: can't find %s in output section\n", einfo ("%P%F: can't find %s in output section\n",
bfd_get_section_name (sec->owner, sec)); bfd_get_section_name (sec->owner, sec));
} }
/* Now figure out where the section should go. */ /* Now figure out where the section should go. */
switch (i) { switch (i)
{
default: /* to avoid warnings */ default: /* to avoid warnings */
case XCOFF_SPECIAL_SECTION_TEXT: case XCOFF_SPECIAL_SECTION_TEXT:
@ -775,10 +792,13 @@ gld${EMULATION_NAME}_before_allocation ()
os = lang_output_section_find (oname); os = lang_output_section_find (oname);
if (start) { if (start)
{
is->header.next = os->children.head; is->header.next = os->children.head;
os->children.head = (lang_statement_union_type *) is; os->children.head = (lang_statement_union_type *) is;
} else { }
else
{
is->header.next = NULL; is->header.next = NULL;
lang_statement_append (&os->children, lang_statement_append (&os->children,
(lang_statement_union_type *) is, (lang_statement_union_type *) is,
@ -804,12 +824,14 @@ static int change_symbol_mode (char *input)
unsigned int bit; unsigned int bit;
char *string; char *string;
for (bit = 0; ; bit++) { for (bit = 0; ; bit++)
{
string = symbol_mode_string[bit]; string = symbol_mode_string[bit];
if (NULL == string) if (NULL == string)
return 0; return 0;
if (0 == strcmp(input, string)) { if (0 == strcmp (input, string))
{
symbol_mode = (1 << bit); symbol_mode = (1 << bit);
return 1; return 1;
} }
@ -841,17 +863,23 @@ static int is_syscall(char *input)
NULL NULL
}; };
for (bit = 0; ;bit++) { for (bit = 0; ;bit++)
{
string = syscall_string[bit]; string = syscall_string[bit];
if (NULL == string) { if (NULL == string)
{
return -1; return -1;
} }
if (0 == strcmp(input, string)) { if (0 == strcmp (input, string))
if (1 << bit & ${SYSCALL_MASK}) { {
if (1 << bit & ${SYSCALL_MASK})
{
return 1; return 1;
} else { }
else
{
return 0; return 0;
} }
} }
@ -925,11 +953,11 @@ gld${EMULATION_NAME}_read_file (filename, import)
s = (char *) obstack_base (o); s = (char *) obstack_base (o);
while (isspace ((unsigned char) *s)) while (isspace ((unsigned char) *s))
++s; ++s;
if (*s == '\0' || if (*s == '\0'
*s == '*' || || *s == '*'
change_symbol_mode (s) || || change_symbol_mode (s)
(*s == '#' && s[1] == ' ') || || (*s == '#' && s[1] == ' ')
(! import && *s == '#' && s[1] == '!')) || (! import && *s == '#' && s[1] == '!'))
{ {
obstack_free (o, obstack_base (o)); obstack_free (o, obstack_base (o));
continue; continue;
@ -1008,8 +1036,8 @@ gld${EMULATION_NAME}_read_file (filename, import)
continue; continue;
} }
if (symbol_mode & ${SYMBOL_MODE_MASK}) { if (symbol_mode & ${SYMBOL_MODE_MASK})
{
/* This is a symbol to be imported or exported. */ /* This is a symbol to be imported or exported. */
symname = s; symname = s;
syscall = false; syscall = false;
@ -1039,13 +1067,15 @@ gld${EMULATION_NAME}_read_file (filename, import)
filename, lineno); filename, lineno);
} }
if (s != se) { if (s != se)
{
int status; int status;
char *end; char *end;
status = is_syscall (s); status = is_syscall (s);
switch (status) { switch (status)
{
case 1: case 1:
/* this is a system call */ /* this is a system call */
syscall = true; syscall = true;
@ -1058,8 +1088,10 @@ gld${EMULATION_NAME}_read_file (filename, import)
default: default:
/* not a system call, check for address */ /* not a system call, check for address */
address = strtoul (s, &end, 0); address = strtoul (s, &end, 0);
if (*end != '\0') { if (*end != '\0')
einfo ("%s:%d: warning: syntax error in import/export file\n", filename, lineno); {
einfo ("%s:%d: warning: syntax error in import/export file\n",
filename, lineno);
} }
} }