Hello,
I am trying to link gfortran routines which call assembly routines. The linker
cannot find these assembly routines although they have been
assembled using "as" and stored in a static library using "ar".
I have used the following options when assembling:
-c --32 -a=list_file_name -o obj_file_name
When I attempt to link my test program (FF.F90) which calls UPPER_CASE (an
assembly routine) I get the following error:
C:/Program
Files/GCC/bin/../lib/gcc/i686-pc-mingw32/13.2.0/../../../../i686-pc-mingw32/bin/ld.exe:
FF.OBJ:FF.F90:(.text+0x10c): undefined reference to `upper_case_'
collect2.exe: error: ld returned 1 exit status
%LINK-E-LINKFAIL, linker failure - return code: 1
I have attached UPPER_CASE.ASM to this email for your perusal.
If you require more information, please ask.
Thank you,
Ken
################################################################################
# U P P E R _ C A S E #
# ---------------------------- #
# Subroutine to convert all lowercase characters in the passed Character #
# variable to uppercase. #
#------------------------------------------------------------------------------#
# Calling format #
# ============== #
# CALL UPPER_CASE (string1) #
# #
# Argument #
# ======== #
# string1 #
# [INOUT] A CHARACTER variable whose lowercase characters are to be #
# converted to uppercase. #
#------------------------------------------------------------------------------#
# Interface #
# ========= #
# SUBROUTINE UPPER_CASE (STRING1) #
# CHARACTER(*),INTENT(INOUT) :: STRING1 #
# END SUBROUTINE UPPER_CASE #
#------------------------------------------------------------------------------#
# Library File: SYS$LIBRARY:INTOOLSLIB.OLB #
#------------------------------------------------------------------------------#
# *********************************************************************** #
# * LIMITED RIGHTS * #
# * * #
# * This software is supplied without representation of warranty of * #
# * any kind. The author therefore assumes no responsibility and * #
# * shall have no liability of any kind arising from the supply or * #
# * use of this software. * #
# * * #
# * This software may be used only by the purchaser. This software * #
# * or any other copies thereof may not be provided or otherwise made * #
# * available to any other person. No title to and ownership of the * #
# * software is hereby transferred. * #
# * * #
# * The information in this software is subject to change without * #
# * notice and should not be construed as a commitment by the author. * #
# * * #
# * The information contained herein is proprietary to the author and * #
# * its use, disclosure, or duplication is restricted. * #
# *********************************************************************** #
#------------------------------------------------------------------------------#
# D a t e A u t h o r Description of Modification #
# ----------- ----------- --------------------------- #
# 27-JUL-1993 K.Woolridge Original. #
################################################################################
.NOLIST
.INCLUDE "C:\\SOURCE\\ASM\\INCLUDE\\ALPHABET_CHARS.INC"
.LIST
#- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.GLOBAL UPPER_CASE
UPPER_CASE:
MOV %EAX,4(%ESP) # Get String address
MOV %EBX,8(%ESP) # Get String Length
MOV %EDX,%EBX # Save length
MOV %ECX,0
UC_01: # Do
MOV %BL,(%EAX) # Next character
CMP %BL,PC_LO_A # Compare to "a"
JL UC_02 # Less than, don't change
CMP %BL,PC_LO_Z # Compare to "z"
JG UC_02 # Greater than, don't change
SUB %BL,0X20 # Convert to upper case
MOV (%EAX),%BL # Save converted character
UC_02:
ADD %EAX,1 # Increment pointer
ADD %ECX,1 # Increment counter
CMP %ECX,%EDX # Finished?
JGE RETURN # Yes, exit
JMP UC_01 # End do
RETURN:
RET