Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Buildroot] augeas-1.7.0 fails with "Bad expression" #108

Closed
joerg-krause opened this issue Feb 14, 2017 · 5 comments
Closed

[Buildroot] augeas-1.7.0 fails with "Bad expression" #108

joerg-krause opened this issue Feb 14, 2017 · 5 comments
Assignees
Labels
Milestone

Comments

@joerg-krause
Copy link

We encountered an compiler error with the ARC toolchain version 2016.09 when building the package augeas in Buildroot:

fa.s: Assembler messages:
fa.s:1159: Error: Bad expression: @pcl + ,@.LANCHOR0@pcl-24.
fa.s:1159: Error: extra comma
fa.s:1159: Error: syntax error

The corresponding assembler output is:

print_char:
.LFB164:
	.cfi_startproc
	push_s blink
	.cfi_def_cfa_offset 4
	.cfi_offset 31, -4
	st.a r13,[sp,-8]	;28
	.cfi_def_cfa_offset 12
	.cfi_offset 13, -12
	st_s r14,[sp,4]		;18
	.cfi_offset 14, -8
	mov_s r13,r0	;4
	add r0,pcl,@.LANCHOR0@pcl+24		;12
	bl.d @strchr@plt;1
	mov_s r14,r1	;4
	breq_s r0, 0, @.L176
	add r1,pcl,@.LC7@pcl-pcl,@.LANCHOR0@pcl-24		;12
	add_s r0,r0,r1
	add r1,pcl,@.LC8@pcl		;12
	ldb_s r2,[r0]
	.align 2

The C code for this function:

static void print_char(FILE *out, uchar c) {
    /* We escape '/' as '\\/' since dot chokes on bare slashes in labels;
       Also, a space ' ' is shown as '\s' */
    static const char *const escape_from = " \n\t\v\b\r\f\a/\0";
    static const char *const escape_to = "sntvbrfa/0";
    char *p = strchr(escape_from, c);
    if (p != NULL) {
        int i = p - escape_from;
        fprintf(out, "\\\\%c", escape_to[i]);
    } else if (! isprint(c)) {
        fprintf(out, "\\\\0%03o", (unsigned char) c);
    } else if (c == '"') {
        fprintf(out, "\\\"");
    } else {
        fputc(c, out);
    }
}

The following build command was used to test the compilation:

$ echo "BR2_PACKAGE_AUGEAS=y" > pkg-config
$ ./support/scripts/test-pkg -c pkg-config -d ../test-pkg -p augeas

The package is not available in Buildroot, yet, but the package was build based on a patch on patchwork.

@claziss
Copy link
Member

claziss commented Feb 14, 2017

Hi, indeed the construction is wrong. Please provide the preprocessed file, command options used for uncovering the error and the compiler version used.
Thank you.

@claziss claziss self-assigned this Feb 14, 2017
@claziss claziss added the bug label Feb 14, 2017
@joerg-krause
Copy link
Author

This is the link to the preprocessed fa.i: http://code.bulix.org/cduz0s-115445.

This is the configuration step:

(cd /mnt/data/git/test-pkg/br-arcle-hs38/build/augeas-1.7.0/ && rm -rf config.cache && PATH="/mnt/data/git/test-pkg/br-arcle-hs38/host/bin:/mnt/data/git/test-pkg/br-arcle-hs38/host/sbin:/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin:/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/lib/jvm/default/bin:/usr/bin/site_perl:/usr/bin/vendor_perl:/usr/bin/core_perl
AR="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-ar
AS="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-as
LD="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-ld
NM="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-nm
CC="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-gcc
GCC="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-gcc
CPP="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-cpp
CXX="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-g++
FC="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-gfortran
F77="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-gfortran
RANLIB="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-ranlib
READELF="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-readelf
STRIP="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-strip
OBJCOPY="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-objcopy
OBJDUMP="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-objdump
AR_FOR_BUILD="/usr/bin/ar
AS_FOR_BUILD="/usr/bin/as
CC_FOR_BUILD="/usr/bin/gcc
GCC_FOR_BUILD="/usr/bin/gcc
CXX_FOR_BUILD="/usr/bin/g++
LD_FOR_BUILD="/usr/bin/ld
CPPFLAGS_FOR_BUILD="-I/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/include
CFLAGS_FOR_BUILD="-O2 -I/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/include
CXXFLAGS_FOR_BUILD="-O2 -I/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/include
LDFLAGS_FOR_BUILD="-L/mnt/data/git/test-pkg/br-arcle-hs38/host/lib -L/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/lib -Wl,-rpath,/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/lib
FCFLAGS_FOR_BUILD="
DEFAULT_ASSEMBLER="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-as
DEFAULT_LINKER="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/arc-linux-ld
CPPFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64
CFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -matomic -Os 
CXXFLAGS="-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -matomic -Os 
LDFLAGS="
FCFLAGS="-matomic -Os 
FFLAGS="-matomic -Os 
PKG_CONFIG="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/bin/pkg-config
STAGING_DIR="/mnt/data/git/test-pkg/br-arcle-hs38/host/usr/arc-buildroot-linux-uclibc/sysroot
INTLTOOL_PERL=/usr/bin/perl ac_cv_lbl_unaligned_fail=yes ac_cv_func_mmap_fixed_mapped=yes ac_cv_func_memcmp_working=yes ac_cv_have_decl_malloc=yes gl_cv_func_malloc_0_nonnull=yes ac_cv_func_malloc_0_nonnull=yes ac_cv_func_calloc_0_nonnull=yes ac_cv_func_realloc_0_nonnull=yes lt_cv_sys_lib_search_path_spec="
ac_cv_c_bigendian=no   CONFIG_SITE=/dev/null ./configure --target=arc-buildroot-linux-uclibc --host=arc-buildroot-linux-uclibc --build=x86_64-pc-linux-gnu --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --localstatedir=/var --program-prefix="
--disable-gtk-doc --disable-gtk-doc-html --disable-doc --disable-docs --disable-documentation --with-xmlto=no --with-fop=no --disable-dependency-tracking --enable-ipv6  --disable-static --enable-shared  --disable-gnulib-tests )

The compiler info:

br-arcle-hs38 ) host/usr/bin/arc-linux-gcc -v
Using built-in specs.
COLLECT_GCC=/mnt/data/git/test-pkg/br-arcle-hs38/host/opt/ext-toolchain/bin/arc-linux-gcc
COLLECT_LTO_WRAPPER=/mnt/data/git/test-pkg/br-arcle-hs38/host/opt/ext-toolchain/bin/../libexec/gcc/arc-snps-linux-uclibc/6.2.1/lto-wrapper
Target: arc-snps-linux-uclibc
Configured with: /home/akolesov/pub/jenkins_root/akolesov-lab/workspace/gnu_release/gcc/configure --target=arc-snps-linux-uclibc --with-cpu=hs38 --disable-multilib --with-pkgversion='ARCv2 ISA Linux uClibc toolchain 2016.09' --with-bugurl=https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/issues --enable-fast-install=N/A --with-endian=little --disable-werror --enable-languages=c,c++ --prefix=/home/akolesov/pub/jenkins_root/akolesov-lab/workspace/gnu_release/toolchain/../release_output/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install --enable-shared --without-newlib --disable-libgomp --with-gnu-as --with-gnu-ld --with-python=no --with-sysroot=/home/akolesov/pub/jenkins_root/akolesov-lab/workspace/gnu_release/toolchain/../release_output/arc_gnu_2016.09_prebuilt_uclibc_le_archs_linux_install/arc-snps-linux-uclibc/sysroot
Thread model: posix
gcc version 6.2.1 20160824 (ARCv2 ISA Linux uClibc toolchain 2016.09)

@claziss
Copy link
Member

claziss commented Feb 14, 2017

Thank you. I'll analyze the issue asap.

@claziss
Copy link
Member

claziss commented Feb 20, 2017

Simplified example

a() {
  char *b = "";
  char c;
  int d = &c - " \n\t\v\b\r\f\a/\0";
  e(b[d]);
}

line to have it crashed:

arc-elf32-gcc -Os -mno-sdata -fpic fa.i -c

@fbedard fbedard added this to the 2017.03 milestone Mar 1, 2017
@claziss
Copy link
Member

claziss commented Mar 2, 2017

Fixed by commits:
foss-for-synopsys-dwc-arc-processors/gcc@19e56fd
foss-for-synopsys-dwc-arc-processors/gcc@914df8f

Thank you for signalizing this issue.

@claziss claziss closed this as completed Mar 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants