Bug 2756 - m68k-linux still has #APP/#NO_APP issue
Summary: m68k-linux still has #APP/#NO_APP issue
Alias: None
Product: binutils
Classification: Unclassified
Component: gas (show other bugs)
Version: 2.17
: P2 normal
Target Milestone: ---
Assignee: unassigned
Depends on:
Reported: 2006-06-12 12:15 UTC by Lior Balkohen
Modified: 2006-07-24 16:30 UTC (History)
2 users (show)

See Also:
Host: i686-linux
Target: m68k-linux
Build: i686-linux
Last reconfirmed:


Note You need to log in before you can comment on or make changes to this bug.
Description Lior Balkohen 2006-06-12 12:15:10 UTC

while building glibc, the GNU assembler complains about

m68k-unknown-linux-gnu-gcc localealias.c -c -std=gnu99 -O -Wall -Winline
-Wwrite-strings -fmerge-all-constants -pipe -Wstrict-prototypes     
-I../include -I/home/lior/builds/m68k/src/build/intl
-I/home/lior/builds/m68k/src/build -I../ports/sysdeps/m68k/elf
-I../sysdeps/m68k/elf -I../ports/sysdeps/unix/sysv/linux/m68k
-I../linuxthreads/sysdeps/unix/sysv/linux/m68k -I../sysdeps/unix/sysv/linux/m68k
-I../ports/sysdeps/unix/sysv/linux -I../linuxthreads/sysdeps/unix/sysv/linux
-I../linuxthreads/sysdeps/pthread -I../sysdeps/pthread
-I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common
-I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../ports/sysdeps/unix/sysv
-I../linuxthreads/sysdeps/unix/sysv -I../sysdeps/unix/sysv
-I../ports/sysdeps/unix -I../linuxthreads/sysdeps/unix -I../sysdeps/unix
-I../sysdeps/posix -I../ports/sysdeps/m68k/m68020 -I../sysdeps/m68k/m68020
-I../ports/sysdeps/m68k/fpu -I../sysdeps/m68k/fpu -I../ports/sysdeps/m68k
-I../sysdeps/wordsize-32 -I../sysdeps/ieee754/ldbl-96
-I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754/flt-32
-I../linuxthreads/sysdeps/m68k -I../sysdeps/m68k -I../sysdeps/ieee754
-I../sysdeps/generic/elf -I../sysdeps/generic -I../ports -I../linuxthreads  -I..
-I../libio -I. -nostdinc -isystem
/home/lior/builds/m68k/cdk/lib/gcc/m68k-unknown-linux-gnu/4.1.1/include -isystem
/home/lior/builds/m68k/src/linux-2.6.16/include -D_LIBC_REENTRANT -include
../include/libc-symbols.h       -D'LOCALEDIR="/share/locale"'
-D'LOCALE_ALIAS_PATH="/share/locale"' -o
/home/lior/builds/m68k/src/build/intl/localealias.o -MD -MP -MF
/home/lior/builds/m68k/src/build/intl/localealias.o.dt -MT
{standard input}: Assembler messages:
{standard input}:504: Error: junk at end of line, first unrecognized character
is `,'
make[2]: *** [/home/lior/builds/m68k/src/build/intl/localealias.o] Error 1
make[2]: Leaving directory `/home/lior/builds/m68k/src/libc/intl'
make[1]: *** [intl/subdir_lib] Error 2
make[1]: Leaving directory `/home/lior/builds/m68k/src/libc'
make: *** [all] Error 2

After a little googleing I found a long diskussion and a patch from Andreas
Schwab that never went upstream.

This patch from Andreas works well for me:

diff -Naur binutils- binutils-
--- binutils-	2006-05-26 18:34:06.000000000 +0200
+++ binutils-	2006-06-12 13:42:08.000000000 +0200
@@ -1008,10 +1008,14 @@
 	      unsigned int new_length;
 	      char *tmp_buf = 0;
-	      bump_line_counters ();
 	      s = input_line_pointer;
 	      if (strncmp (s, "APP\n", 4))
-		continue;	/* We ignore it */
+		{
+		  /* We ignore it */
+		  ignore_rest_of_line ();
+		  continue;
+		}
+	      bump_line_counters ();
 	      s += 4;
 	      sb_new (&sbuf);
@@ -1110,7 +1114,7 @@
-	  /* Report unknown char as ignored.  */
+	  /* Report unknown char as error.  */
 	  demand_empty_rest_of_line ();
Comment 1 Nick Clifton 2006-06-22 15:45:11 UTC
Hi Lior,

  Please could you supply a small test case that reproduces the problem ?

  I do not want to change a generic part of the assembler without being sure
that it will not break other ports.

Comment 2 Lior Balkohen 2006-06-23 14:27:23 UTC
Here is a very stripped down localealias.c:

#define __make_section_unallocated(section_string) \
  asm (".section " section_string "\n\t.previous");

#define __sec_comment "\"\n\t#\""

#define libc_freeres_ptr(decl) \
  __make_section_unallocated ("__libc_freeres_ptrs, \"aw\", %nobits") \
  decl __attribute__ ((section ("__libc_freeres_ptrs" __sec_comment)))

extern void *realloc(void *ptr, int size);

struct alias_map
  const char *alias;
  const char *value;

libc_freeres_ptr (static struct alias_map *map);
libc_freeres_ptr (static char *string_space);

static int string_space_max;

read_alias_file (fname, fname_len)
     const char *fname;
     int fname_len;
  int  added = 0;
  int alias_len = 0;
  int value_len = 0;
  int new_size = (string_space_max + (alias_len + value_len > 1024 ? alias_len +
value_len : 1024));
  char *new_pool = (char *) realloc (string_space, new_size);
  int i;

  for (i = 0; i < 10; i++)
    map[i].alias += new_pool - string_space;
    map[i].value += new_pool - string_space;
  return added;

const char *
_nl_expand_alias (name)
    const char *name;
  int added = 0;
  static const char *locale_alias_path = "/share/locale";

      while (added == 0 && locale_alias_path[0] != '\0')
	  const char *start;

	  while (locale_alias_path[0] == ':')
	  start = locale_alias_path;

	  if (start < locale_alias_path)
	    added = read_alias_file (start, locale_alias_path - start);
	return '\0';

$ m68k-unknown-linux-gnu-gcc -v
Using built-in specs.
Target: m68k-unknown-linux-gnu
Configured with: ../gcc-4.1.1/configure --prefix=/home/lior/builds/m68k/cdk
--disable-nls --target=m68k-unknown-linux-gnu --disable-shared --disable-threads
--disable-libmudflap --disable-libssp --enable-languages=c
Thread model: single
gcc version 4.1.1

$ m68k-unknown-linux-gnu-as --version
GNU assembler 20060526
Copyright 2005 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
This assembler was configured for a target of `m68k-unknown-linux-gnu'.

$ m68k-unknown-linux-gnu-gcc -Wall -O -c localealias.c
/tmp/ccF8XX4h.s: Assembler messages:
/tmp/ccF8XX4h.s:72: Error: junk at end of line, first unrecognized character is `"'
Comment 3 Lior Balkohen 2006-07-12 09:26:05 UTC
Comment 4 Nick Clifton 2006-07-24 16:30:37 UTC
Hi Lior,

  Please accept my apologese for taking so long to get back to you on this
problem.  I have now tried your test case - it does indeed reproduce the
problem, and the patch is acceptable, so I have applied to the sources.