Still can't statically link using -mcmodel=medium in 8.0

I thought the problem of not being able to statically link when using the medium memory model was fixed as of version 6.0. However I’m still getting the following errors. All the object file and all the files in the library were compiled with the -mcmodel=medium flag.

pgf90 -Bstatic -mcmodel=medium frealign_v8.o frealign_v8.a -o …/bin/frealign_v8.exe

/opt/pgi/linux86-64/8.0-4/libso/libpgf90.a(initpar.o): In function __hpf_initarg': initpar.c:(.text+0x137): relocation truncated to fit: R_X86_64_PC32 against .bss’
initpar.c:(.text+0x162): relocation truncated to fit: R_X86_64_PC32 against .bss' initpar.c:(.text+0x196): relocation truncated to fit: R_X86_64_PC32 against .bss’
initpar.c:(.text+0x1a9): relocation truncated to fit: R_X86_64_PC32 against .bss' initpar.c:(.text+0x1c8): relocation truncated to fit: R_X86_64_PC32 against .bss’
/opt/pgi/linux86-64/8.0-4/libso/libpgf90.a(initpar.o): In function __hpf_getenv': initpar.c:(.text+0x1e5): relocation truncated to fit: R_X86_64_PC32 against .bss’
/opt/pgi/linux86-64/8.0-4/libso/libpgf90.a(initpar.o): In function __hpf_initopt': initpar.c:(.text+0x24f): relocation truncated to fit: R_X86_64_PC32 against .bss’
initpar.c:(.text+0x262): relocation truncated to fit: R_X86_64_PC32 against .bss' initpar.c:(.text+0x282): relocation truncated to fit: R_X86_64_PC32 against .bss’
initpar.c:(.text+0x2e1): relocation truncated to fit: R_X86_64_PC32 against .bss' /opt/pgi/linux86-64/8.0-4/libso/libpgf90.a(initpar.o): In function __hpf_getopt’:
initpar.c:(.text+0x324): additional relocation overflows omitted from the output1

The make file looks like this:

SHELL = /bin/sh

FFLAGS = -tp=x64 -fastsse -mcmodel=medium -c

CFLAGS = -tp=x64 -fastsse -mcmodel=medium -c

COMP = pgf90

CC = pgcc

LF = -Bstatic -mcmodel=medium

PGM = frealign_v8

LIB = $(PGM).a

.PRECIOUS : $(PGM) $(LIB)

include Makefile.inc

$(PGM) : $(PGM).o $(LIB)
@echo linking $(PGM)
$(COMP) $(LF) $(PGM).o $(LIB) -o …/bin/$(PGM).exe
@\rm $(PGM).o

$(PGM).o : $(PGM).f
$(COMP) $(FFLAGS) -o $(PGM).o $(PGM).f

ioc.o : ioc.c
$(CC) $(CFLAGS) -o ioc.o ioc.c
$(AR) r $(LIB) ioc.o
@\rm ioc.o

$(LIB) : ioc.o $(ELEMENTS)
@echo all object files placed in library

.f.a:
$(COMP) $(FFLAGS) $<
$(AR) r $(LIB) $.o
@\rm $
.o

Any ideas?

-Christopher

Hi Christopher,

Sorry, this limitation is still in place. From the PGI User’s Guide:

64-bit Linux Considerations
On 64-bit Linux systems, 64-bit applications that use the -mcmodel=medium option sometimes cannot be successfully linked statically. Therefore, users with executables built with the -mcmodel=medium option may need to use shared libraries, linking dynamically. Also, runtime libraries built using the -fpic option use 32-bit offsets, so they sometimes need to reside near other runtime libs in a shared area of Linux program
memory.

It’s my understanding that this a limitation of the medium memory model and can not be removed until the large memory model is supported by the OS and the compiler.

  • Mat