I have a C driver file which declares an extern function in order to use it in my asm file. I am on a Windows 7 x64 machine.
I assembled the asm file with NASM with this command:
nasm avxmain.asm -f win64 -o avxmain.o
Then I compiled the C file like this:
gcc avxdriver.c -c -m64 -o avxdriver.o
Linking it all together, I ran:
gcc avxdriver.o avxmain.o -o final
Here are the errors I am getting:
avxmain.o:G:\Desktop\CPSC240:(.text+0x50): relocation truncated to fit: R_X86_64_32 against `.bss'
avxmain.o:G:\Desktop\CPSC240:(.text+0xb9): relocation truncated to fit: R_X86_64_32 against `.data'
avxmain.o:G:\Desktop\CPSC240:(.text+0xc2): relocation truncated to fit: R_X86_64_32 against `.data'
avxmain.o:G:\Desktop\CPSC240:(.text+0x14e): relocation truncated to fit: R_X86_64_32 against `.bss'
collect2: error: ld returned 1 exit status
avxdriver.c file:
#include <stdio.h>
#include <stdint.h>
extern double avxdemo();
int main()
{
double return_code = -99.9;
printf("%s","This program will test for the presence of AVX (Advanced Vector Extensions) also known as state component number 2.\n");
return_code = avxdemo();
printf("%s %1.12lf\n","The value returned to the driver is ", return_code);
printf("%s","The driver program will next send a zero to the operating system. Enjoy your programming.\n");
return 0;
}
avxmain.asm file:
I posted it here because it is very long due to comments provided by the professor.
I have tried running the -fPIC and -mcmodel=medium option. I still get the same errors.
I'm completely lost and confused since this is the sample project I am supposed to run for my class. This subject is brand new to me. I've spent about half my day searching these errors and trying different things. I just need to be pointed in the right direction.
default relin the asm code? - harold[rel label]everywhere use used[label]- harold