This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: Versioning mess proved!!!
Ulrich,
I hope I did this right. I changed tA-22.c to
int main(void)
{
extern void foo (void) __attribute__ ((weak));
void (*foop) (void) = foo;
asm volatile ("" : "=r" (foop) : "0" (foop));
printf ("%p\n", foop);
if (foop)
foop();
return 0;
}
which using 'gcc -S tA-22.c -L213 -ltB -o tA' created the following in tA
.file "tA-22.c"
gcc2_compiled.:
.section ".rodata"
.align 2
.LC0:
.string "%p\n"
.section ".text"
.align 2
.globl main
.type main,@function
main:
stwu 1,-48(1)
mflr 0
stw 29,36(1)
stw 30,40(1)
stw 31,44(1)
stw 0,52(1)
mr 31,1
lis 9,foo@ha
la 0,foo@l(9)
stw 0,8(31)
lwz 9,8(31)
mr 0,9
mr 9,0
stw 9,8(31)
lis 9,.LC0@ha
la 3,.LC0@l(9)
lwz 4,8(31)
crxor 6,6,6
bl printf
lwz 0,8(31)
cmpwi 0,0,0
bc 12,2,.L3
lwz 29,8(31)
mtlr 29
blrl
.L3:
li 3,0
b .L2
.L2:
lwz 11,0(1)
lwz 0,4(11)
mtlr 0
lwz 29,-12(11)
lwz 30,-8(11)
lwz 31,-4(11)
mr 1,11
blr
.Lfe1:
.size main,.Lfe1-main
.weak foo
.ident "GCC: (GNU) 2.95.3 19991030 (prerelease/franzo/20000629)"
This code still segfaults when I run...
LD_LIBRARY_PATH=./22/ LD_BIND_NOW=1 ./tA
0x10010828
Segmentation fault (core dumped)
Ulrich Drepper wrote:
> Franz Sirl <Franz.Sirl-kernel@lauterbach.com> writes:
>
> > int main(void)
> > {
> > extern void foo (void) __attribute__ ((weak));
> > void (*foop) (void) = foo;
> > printf ("%p\n", foop);
> > if (foop)
> > foop();
> > return 0;
> > }
>
> What if you change this to
>
> extern void foo (void) __attribute__ ((weak));
> void (*foop) (void) = foo;
> asm volatile ("" : "=r" (foop) : "0" (foop));
> printf ("%p\n", foop);
> if (foop)
> foop();
> return 0;
>
> (note the asm). If this fails, please show me the generated asm code.
>
> --
> ---------------. ,-. 1325 Chesapeake Terrace
> Ulrich Drepper \ ,-------------------' \ Sunnyvale, CA 94089 USA
> Red Hat `--' drepper at redhat.com `------------------------
--
------------------------------------------------------------------------------
Jack W. Howarth, Ph.D. 231 Bethesda Avenue
NMR Facility Director Cincinnati, Ohio 45267-0524
Dept. of Molecular Genetics phone: (513) 558-4420
Univ. of Cincinnati College of Medicine fax: (513) 558-8474