NetBSD-Bugs archive

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

Re: toolchain/59746: gcc precompiled header support should be updated for ASLR



The following reply was made to PR toolchain/59746; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: Greg Troxel <gdt%lexort.com@localhost>
Subject: Re: toolchain/59746: gcc precompiled header support should be updated
 for ASLR
Date: Mon, 3 Nov 2025 23:53:59 +0000 (UTC)

 On Mon, 3 Nov 2025, martin%NetBSD.org@localhost wrote:
 
 >> Description:
 >
 > The gcc PCH implementation used to be buggy and not deal with ASLR well.
 > This has been fixed:	https://gcc.gnu.org/bugzilla/show_bug.cgi?71934
 > but the NetBSD hook is not there (see note about being unable to
 > test in the ticket).
 >
 
 I'm probably missing something, but, this seems to be an issue only on GCC 10.x?
 
 NetBSD-10.1_STABLE
 
 ```
 qemu$ gcc --version
 gcc (nb3 20231008) 10.5.0
 Copyright (C) 2020 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 qemu$ tail -n+1 Makefile test.?
 ==> Makefile <==
 all:
          g++ -c -x c++-header -o test.gch test.h
          g++ -Winvalid-pch -include test -o prog test.c
 
 clean:
          rm -f prog
 
 ==> test.c <==
 int main(void) { return 0; }
 
 ==> test.h <==
 #define test 1
 qemu$ make
 g++ -c -x c++-header -o test.gch test.h
 g++ -Winvalid-pch -include test -o prog test.c
 cc1plus: warning: ./test.gch: had text segment at different address
 cc1plus: error: one or more PCH files were found, but they were invalid
 cc1plus: fatal error: test: No such file or directory
 compilation terminated.
 *** Error code 1
 
 Stop.
 make: stopped in /tmp/pch-aslr
 qemu$
 ```
 
 NetBSD-11.0_BETA
 
 ```
 qemu$ uname -a
 NetBSD qemu.local 11.0_BETA NetBSD 11.0_BETA (GENERIC) #0: Tue Oct 28 15:00:36 UTC 2025  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
 qemu$ gcc --version
 gcc (nb1 20250721) 12.5.0
 Copyright (C) 2022 Free Software Foundation, Inc.
 This is free software; see the source for copying conditions.  There is NO
 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
 qemu$ make
 g++ -c -x c++-header -o test.gch test.h
 g++ -Winvalid-pch -include test -o prog test.c
 qemu$
 ```
 
 -RVP
 


Home | Main Index | Thread Index | Old Index