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