pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/60439: lang/gcc12 fails to build on NetBSD/macppc 11.0_RC6 but succeeds on 10.0



Some further experimentation:

Using the half-built gcc12 to build conftest.s, and then using
the in-tree gcc to build conftest reproduces the problem with an
executable which simply aborts.  So the problem is already there
with the generated assembly code.

Looking at the diff between the half-built gcc12 and the in-tree
gcc generated assembly reveals:

--- conftest.in-tree-gcc.s      2026-07-12 22:12:44.823348638 +0200
+++ conftest-gcc12.s    2026-07-12 22:15:40.699217075 +0200
@@ -20,6 +20,8 @@
        .section        .text.startup,"ax",@progbits
        .align 2
        .globl main
+.LCL0:
+       .long .LCTOC1-.LCF0
        .type   main, @function
 main:
 .LFB3:
@@ -31,25 +33,25 @@
        .cfi_def_cfa_offset 16
        mflr 0
        .cfi_register 65, 0
-       bcl 20,31,.L4
-.L4:
+       bcl 20,31,.LCF0
+.LCF0:
        stw 30,8(1)
        .cfi_offset 30, -8
        mflr 30
-       addis 30,30,.LCTOC1-.L4@ha
        stw 0,20(1)
-       addi 30,30,.LCTOC1-.L4@l
        .cfi_offset 65, 4
+       lwz 0,.LCL0-.LCF0(30)
+       add 30,0,30
        .loc 1 5 11 view .LVU3
        lwz 4,.LC1-.LCTOC1(30)
        lwz 3,.LC3-.LCTOC1(30)
-       bl fopen+32768@plt
+       bl fopen@plt
 .LVL0:
        .loc 1 6 2 is_stmt 1 view .LVU4
        .loc 1 6 20 is_stmt 0 view .LVU5
        lhz 9,12(3)
        andi. 9,9,0x40
-       beq- 0,.L8
+       beq- 0,.L7
        li 10,1
 .LVL1:
 .L1:
@@ -65,10 +67,10 @@
        .cfi_restore 65
        blr
 .LVL2:
-.L8:
+.L7:
        .cfi_restore_state
        .loc 1 6 23 discriminator 2 view .LVU7
-       bl fclose+32768@plt
+       bl fclose@plt
 .LVL3:
        .loc 1 6 20 discriminator 2 view .LVU8
        addic 10,3,-1

and also

-.LASF34:
-       .string "GNU C17 12.5.0 -msecure-plt -msoft-float -mstrict-align -g -O2 -fPIC"
-.LASF4:
+.LASF0:
        .string "unsigned int"
 .LASF28:
        .string "_lb_unused"
+.LASF34:
+       .string "GNU C17 12.5.0 -msoft-float -mstrict-align -g -O2 -fPIC"

and

@@ -875,10 +866,10 @@
        .string "_lbfsize"
 .LASF17:
        .string "_file"
-.LASF0:
+.LASF3:
        .string "signed char"
 .LASF26:
        .string "_nbuf"
 .LASF12:
        .string "_base"
-       .ident  "GCC: (nb3 20260326) 12.5.0"
+       .ident  "GCC: (GNU) 12.5.0"

So ... The "half-built gcc12" doesn't by default use
-msecure-plt, which is documented as

       -msecure-plt
           Generate code that allows ld and ld.so to build executables and
           shared libraries with non-executable ".plt" and ".got" sections.
           This is a PowerPC 32-bit SYSV ABI option.

which seems to fit well with what I'm observing.

I'm still puzzled about what changed between 10.1 and 11.0_RC6 in
NetBSD/macppc to cause this problem to occur with the latter but
not with the former.



Home | Main Index | Thread Index | Old Index