This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

bug in sysdeps/sh/dl-machine.h


Hi,

Building glibc-2.2.5 for sh with gcc-3.1 fails because of a stupid choice
of assembler labels:

...
sh-linux-gcc rtld.c -c -O2 -Wall -Winline -Wstrict-prototypes -Wwrite-strings -g   -fPIC    -I../include -I. -I/backup/cross-build/build-glibc-sh/elf -I.. -I../libio  -I/backup/cross-build/build-glibc-sh -I../sysdeps/sh/elf -I../linuxthreads/sysdeps/unix/sysv/linux/sh -I../linuxthreads/sysdeps/unix/sysv/linux -I../linuxthreads/sysdeps/pthread -I../sysdeps/pthread -I../linuxthreads/sysdeps/unix/sysv -I../linuxthreads/sysdeps/unix -I../linuxthreads/sysdeps/sh -I../sysdeps/unix/sysv/linux/sh -I../sysdeps/unix/sysv/linux -I../sysdeps/gnu -I../sysdeps/unix/common -I../sysdeps/unix/mman -I../sysdeps/unix/inet -I../sysdeps/unix/sysv -I../sysdeps/unix/sh -I../sysdeps/unix -I../sysdeps/posix -I../sysdeps/sh -I../sysdeps/wordsize-32 -I../sysdeps/ieee754/flt-32 -I../sysdeps/ieee754/dbl-64 -I../sysdeps/ieee754 -I../sysdeps/generic/elf -I../sysdeps/generic  -nostdinc -isystem /cross/sh-linux-tools/lib/gcc-lib/sh-linux/3.1/include -isystem /cross/sh-linux/include -D_LIBC_REENTRANT -include ../include/libc-symbols.h  -DPIC -DSHARED   -o /backup/cross-build/build-glibc-sh/elf/rtld.os
rtld.c: In function `_dl_start':
rtld.c:152: warning: `start_time' might be used uninitialized in this function
/tmp/ccMWV1LO.s: Assembler messages:
/tmp/ccMWV1LO.s:5913: Error: symbol `.L2' is already defined
/tmp/ccMWV1LO.s:5918: Error: symbol `.L3' is already defined
make[2]: *** [/backup/cross-build/build-glibc-sh/elf/rtld.os] Fehler 1
make[2]: Leaving directory `/packages2/glibc-2.2.5/elf'
...

The reason is that the inline function 'elf_machine_load_address' wants to
use the labels .L1, .L2, .L3, but gcc uses them as well. Here is a fix,
that consists of adding an underscore into it (so as to avoid clashes with
gcc labels) and the gcc insn number as well (so as to avoid problem when
this functions gets inlined multiple times).


2002-06-04  Bruno Haible  <bruno@clisp.org>

	* sysdeps/sh/dl-machine.h (elf_machine_load_address): Use assembler
	labels that don't clash.

--- glibc-2.2.5/sysdeps/sh/dl-machine.h.bak	2001-09-19 05:16:59.000000000 +0200
+++ glibc-2.2.5/sysdeps/sh/dl-machine.h	2002-06-05 01:48:22.000000000 +0200
@@ -1,5 +1,5 @@
 /* Machine-dependent ELF dynamic relocation inline functions.  SH version.
-   Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
+   Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    The GNU C Library is free software; you can redistribute it and/or
@@ -53,16 +53,16 @@
 elf_machine_load_address (void)
 {
   Elf32_Addr addr;
-  asm ("mov.l .L1,r0\n\
-	mov.l .L3,r2\n\
+  asm ("mov.l .L%=_1,r0\n\
+	mov.l .L%=_3,r2\n\
 	add r12,r2\n\
 	mov.l @(r0,r12),r0\n\
-	bra .L2\n\
+	bra .L%=_2\n\
 	 sub r0,r2\n\
 	.align 2\n\
-	.L1: .long _dl_start@GOT\n\
-	.L3: .long _dl_start@GOTOFF\n\
-	.L2: mov r2,%0"
+	.L%=_1: .long _dl_start@GOT\n\
+	.L%=_3: .long _dl_start@GOTOFF\n\
+	.L%=_2: mov r2,%0"
        : "=r" (addr) : : "r0", "r1", "r2");
   return addr;
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]