> I tried > -int g_edi=INIT_EDI, g_esi=INIT_ESI, g_ebx=INIT_EBX; > -int g_ebp, g_ebp_save, g_esp, g_esp_save; > +int g_edi __attribute__((externally_visible)) =INIT_EDI; > +int g_esi __attribute__((externally_visible)) =INIT_ESI; > +int g_ebx __attribute__((externally_visible)) = INIT_EBX; > +int g_ebp __attribute__((externally_visible)); > +int g_esp __attribute__((externally_visible)); > +int g_ebp_save __attribute__((externally_visible)); > +int g_esp_save __attribute__((externally_visible)); Weird, for me it seems to work as expected:
evans:/abuild/jh/trunk-3/build-inst2/gcc/:[1]# cat t.c __attribute__ ((externally_visible)) int a; main() { asm("movl %eax, a"); } evans:/abuild/jh/trunk-3/build-inst2/gcc/:[0]# ./xgcc -B ./ -O2 t.c -flto evans:/abuild/jh/trunk-3/build-inst2/gcc/:[0]# cat t2.c int a; main() { asm("movl %eax, a"); } evans:/abuild/jh/trunk-3/build-inst2/gcc/:[0]# ./xgcc -B ./ -O2 t2.c -flto /abuild/jh/trunk-install/x86_64-unknown-linux-gnu/bin/ld: /tmp/ccP7Lfjk.ltrans0.ltrans.o: in function main:ccP7Lfjk.ltrans0.o(.text.startup+0x3): error: undefined reference to 'a' collect2: ld returned 1 exit status Perhaps some extra var needs annotation? > int n_error; > > int > > and it doesn't make a difference. > > > I think this testcase is "yours", so perhaps you can fix it? > > Was there some reason to use the ASMNAME hack instead of memory output > > constraint? > > We want to verify the contents of registers. Still, I think the cleanest way is: evans:/abuild/jh/trunk-3/build-inst2/gcc/:[0]# cat t3.c int a; main() { asm __volatile__ ("movl %%eax, %0":"=m"(a)); } evans:/abuild/jh/trunk-3/build-inst2/gcc/:[0]# ./xgcc -B ./ -O2 t3.c -flto evans:/abuild/jh/trunk-3/build-inst2/gcc/:[0]# It avoids the ASMNAME hack and makes outputs explicit.