The following program, when compiled with -fPIC option (on by default on Darwin) gives me duplicate label in assembler output: extern int printf(const char *, ...); struct { int a[5];} jmp_buf; void f(void) { void g(void) { } if (__builtin_setjmp(&jmp_buf)) goto l; g(); printf("failed\n"); l:; } int main(void) { f(); return 0; } I can see duplicate label "L00000000001$pb" in the assemble output. Note that I have not set up full cross-compile environmet, I just configured gcc for i686-apple-darwin target. The build failed, but cc1 is built. This is a reduced test case. Original problem appeared in GNU Pascal in native compiler on i686-apple-darwin host. The problem is also present in gcc-3.3.6 (the label is called L1$pb) and in gcc-3.4.4.
Confirmed, good to know I did not cause this when I changed the how the PIC label is done on darwin. What needs to be done is something like what is done for ppc-darwin.
This most likely also breaks Ada also until the default exception handling is changed to dwarf-2. Note you might get better response if you file this with Apple.
The bug is solved by recently proposed Darwin x86 fixes <http://gcc.gnu.org/ml/gcc-patches/2005-11/msg02158.html>.
It is not fully fixed: FAIL: gcc.c-torture/compile/20011029-1.c -O0 (test for excess errors) Excess errors: /var/tmp//cc4yx2Rb.s:23:non-relocatable subtraction expression, "L4" minus "L00000000001$pb" /var/tmp//cc4yx2Rb.s:23:symbol: "L4" can't be undefined in a subtraction expression /var/tmp//cc4yx2Rb.s:unknown:Undefined local symbol L4
FAIL: gcc.c-torture/execute/builtins/memcpy-chk.c compilation, -O0 UNRESOLVED: gcc.c-torture/execute/builtins/memcpy-chk.c execution, -O0 Executing on host: /Volumes/HD/ltmp/ssen/gcc-build/gcc/xgcc -B/Volumes/HD/ltmp/ssen/gcc-build/gcc/ /ltmp/ssen/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk.c /ltmp/ssen/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/memcpy-chk-lib.c /ltmp/ssen/gcc/gcc/testsuite/gcc.c-torture/execute/builtins/lib/main.c -w -O1 -fno-show-column -lm -o /ltmp/ssen/gcc-build/gcc/testsuite/memcpy-chk.x1 (timeout = 300) /var/tmp//cc5w2nYV.s:2461:non-relocatable subtraction expression, "L179" minus "L00000000006$pb"^M /var/tmp//cc5w2nYV.s:2461:symbol: "L179" can't be undefined in a subtraction expression^M /var/tmp//cc5w2nYV.s:2430:non-relocatable subtraction expression, "L174" minus "L00000000006$pb"^M /var/tmp//cc5w2nYV.s:2430:symbol: "L174" can't be undefined in a subtraction expression^M /var/tmp//cc5w2nYV.s:2403:non-relocatable subtraction expression, "L169" minus "L00000000006$pb"^M /var/tmp//cc5w2nYV.s:2403:symbol: "L169" can't be undefined in a subtraction expression^M /var/tmp//cc5w2nYV.s:unknown:Undefined local symbol L169^M /var/tmp//cc5w2nYV.s:unknown:Undefined local symbol L174^M /var/tmp//cc5w2nYV.s:unknown:Undefined local symbol L179^M
FAIL: gcc.c-torture/execute/built-in-setjmp.c compilation, -O0 UNRESOLVED: gcc.c-torture/execute/built-in-setjmp.c execution, -O0 Executing on host: /Volumes/HD/ltmp/ssen/gcc-build/gcc/xgcc -B/Volumes/HD/ltmp/ssen/gcc-build/gcc/ /ltmp/ssen/gcc/gcc/testsuite/gcc.c-torture/execute/built-in-setjmp.c -w -O1 -fno-show-column -lm -o /ltmp/ssen/gcc-build/gcc/testsuite/built-in-setjmp.x1 (timeout = 300) /var/tmp//ccJXYNJy.s:43:non-relocatable subtraction expression, "L6" minus "L00000000002$pb"^M /var/tmp//ccJXYNJy.s:43:symbol: "L6" can't be undefined in a subtraction expression^M /var/tmp//ccJXYNJy.s:unknown:Undefined local symbol L6^M compiler exited with status 1
Ok, I think I will be able to fix this fully, working on it for now.
Created attachment 10635 [details] patch which needs testing but works for simple testing ChangeLog: * i386.md (builtin_setjmp_receiver): Don't emit the label. * i386.c (output_set_got): Output the label if we have one.
Patch posted: http://gcc.gnu.org/ml/gcc-patches/2006-01/msg00685.html
Subject: Bug 22099 Author: pinskia Date: Thu Jan 19 17:28:53 2006 New Revision: 109974 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=109974 Log: 2006-01-19 Andrew Pinski <pinskia@physics.uc.edu> PR target/22099 * config/i386/i386.md (builtin_setjmp_receiver): Don't emit the label. * config/i386/i386.c (output_set_got): Output the label if we have one for the TARGET_DEEP_BRANCH_PREDICTION case. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c trunk/gcc/config/i386/i386.md
Fixed in 4.2.0 and above.