From d98377ca72e8d96aa2f6318a56689140b0dcb3c6 Mon Sep 17 00:00:00 2001 From: Ben Huntsman Date: Sat, 30 Nov 2024 13:27:53 -0800 Subject: [PATCH] AIX: Update libafs CFLAGS for Open XL C 17.1+ When building the libafs kernel module, we pass various flags to the compiler and linker, some of which no longer work with the clang-based Open XL C 17.1 and newer: On XL C 16.1 and below, the -M argument causes a file to be generated with a listing of all the files upon which the .o is dependent. This file is created with the same name as the .o file, but with a .u extension. With the Open XL C 17.1+ compilers, the -M file acts similarly, but if -o is specified, the dependency file is created with the name specified by the -o argument. This causes the dependency file to be created but not the actual object code file. Because the compiler invocation succeeds, this repeats until it is time to link, which fails because the .o files are not actually code, but ascii files containing the dependency information. We don't actually use the .u files for anything, so to avoid this issue, remove the -M flag. The -H8 flag is a linker argument that aligns the text, data, and loader sections of the output file so that each section begins on a file offset that is a multiple of 8. On XL C 16.1 and below, the compiler passes unrecognized arguments to the linker, and so giving -H8 to the compiler works fine. But with XL C 17.1+, the compiler does not pass unrecognized arguments to the linker, and throws an error instead. To avoid this, move -H8 from KDEFS to LDFLAGS, so it's given only to the linker and not to the compiler. The -q64 flag no longer exists with XL C 17.1+, and is replaced by -m64. Use ${XCFLAGS64} instead of -q64, which will choose the correct flag to use, like we did in commit aa82a8894f (export: Use XCFLAGS64 for -q64). Change-Id: I2527a604000507ec27adb37338d98a6852ad3131 Reviewed-on: https://gerrit.openafs.org/15974 Reviewed-by: Ben Huntsman Tested-by: BuildBot Reviewed-by: Mark Vitale Reviewed-by: Andrew Deason --- src/libafs/MakefileProto.AIX.in | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libafs/MakefileProto.AIX.in b/src/libafs/MakefileProto.AIX.in index acb963438c..619222962d 100644 --- a/src/libafs/MakefileProto.AIX.in +++ b/src/libafs/MakefileProto.AIX.in @@ -59,14 +59,14 @@ IMPORTS32 = -bI:${TOP_LIBDIR}/export.exp IMPORTS64 = -bI:${TOP_LIBDIR}/export64.exp KDEFS = -U_IBMR2 -D_POWER -D_AIX -DNLS -D_NLS -DMSG -D__STR31__ -Daiws \ -D_POWER_RS -D_POWER_PC -D_POWER_RS1 -D_POWER_RS2 -D_POWER_RSC \ - -D_POWER_601 -D_POWER_603 -D_POWER_604 -D_THREADS -M -D_KERNEL \ + -D_POWER_601 -D_POWER_603 -D_POWER_604 -D_THREADS -D_KERNEL \ -D_POWER_MP -UKOFF -DAFSDEBUG -DVICE -DNFS -DUFS -DINET -DQUOTA \ - -DGETMOUNT -H8 -DAFS -DAFS_COMMON -D_VOPS -D_SUN -DKERNEL + -DGETMOUNT -DAFS -DAFS_COMMON -D_VOPS -D_SUN -DKERNEL LDSTUFF= -b"binder:/usr/lib/bind glink:/usr/lib/glink.o" -bnoentry -b h:4 \ -D0 -T512 LDSTUFF64= -b"binder:/usr/lib/bind glink:/usr/lib/glink64.o" -bnoentry -b h:4 \ -D0 -T512 -LDFLAGS = -m -eafs_config -bexport:${TOP_LIBDIR}/afs.exp ${IMPORTS} \ +LDFLAGS = -m -eafs_config -H8 -bexport:${TOP_LIBDIR}/afs.exp ${IMPORTS} \ -lsys -lcsys ${KLDOPTS} CFLAGS=-I. -I.. -I${TOP_OBJDIR}/src/config ${FSINCLUDES} $(KDEFS) $(KOPTS) ${DBUG} @@ -116,7 +116,7 @@ ${COMPDIRS} ${INSTDIRS} ${DESTDIRS}: KASOPTS="32" ; \ TARG="afs.ext.32" ; \ elif [ "$$m" = "64" ] ; then \ - KOPTS="-q64 -DAFS_64BIT_KERNEL -D__64BIT_KERNEL" ; \ + KOPTS="${XCFLAGS64} -DAFS_64BIT_KERNEL -D__64BIT_KERNEL" ; \ KLDOPTS="-b64" ; \ KASOPTS="64" ; \ TARG="afs.ext.64" ; \