R
Richard Hayden
Hi,
I've just upgraded my gcc and I'm currently trying to compile some code for
my own operating system kernel, but I am getting an error of "Undefined
reference to `memcpy`" when I try to link it using the GNU linker. I do not
reference the symbol memcpy explicitly anywhere in the offending function.
I have narrowed the offending code down to the initialisation of an array
of pointers to char (i.e. an array of strings), which is given below. It
seems that for some reason gcc is inserting calls to the standard library
in some attempt to optimise my code. How do I stop it from doing this? I'm
running version 3.3.1 and am compiling with the --freestanding flag, which
I thought should be enough to prevent this kind of behaviour (it certainly
was on previous versions; either that or gcc did not try and perform this
action then).
char* CPUstrings[] = {
"UNKNOWN Processor",
"Generic 386",
"NexGen 586",
"Cyrix M1 or IBM Bluelightning",
"Generic 486",
"Intel 386",
"Intel 486DX",
"Intel 486SX",
"Intel 486DX2",
"Intel 486SL",
"Intel 486SX2",
"Intel 486DX2 WB",
"Intel 486DX4",
"Intel 486DX4 WB",
"Intel 486",
"Intel Pentium Early P5",
"Intel Pentium 80501",
"Intel Pentium P54C 80502",
"Intel Pentium P24T (overdrive for 486 socket)",
"Intel Pentium MMX P55C",
"Intel Pentium P54C",
"Intel Pentium MMX P55",
"Intel Pentium P5",
"Intel Pentium Pro (Sample)",
"Intel Pentium Pro",
"Intel Pentium II (Klamath)",
"Intel Pentium II (Deschutes)/Xeon/Celeron",
"Intel Celeron A/Pentium II",
"Intel Pentium III (Katmai)",
"Intel Pentium III (Coppermine)",
"Intel Pentium III Xeon (Cascades)",
"Intel Pentium P6",
"Intel Pentium IV",
"UMC 486DX",
"UMC 486SX"
"UMC 486",
"AMD 486DX2, or DX4 in 2x WT mode",
"AMD 486DX2, or DX4 in 2x WB mode",
"AMD 486DX4, or 5x86 in 3x WT mode",
"AMD 486DX4 SV8B, 3x WB mode",
"AMD 5x86, 4x WT mode",
"AMD 5x86, 4x WB mode",
"AMD 486",
"AMD K5 Model 0",
"AMD K5 Model 1",
"AMD K5 Model 2",
"AMD K5 Model 3",
"AMD K6 Model 6",
"AMD K6 Model 7",
"AMD K6-II Model 8",
"AMD K6-III Model 9 (Sharptooth)",
"AMD K6-II+/K6-III+",
"AMD K5/K6",
"AMD Athlon 0.25u (external L2 cache)",
"AMD Athlon 0.18u (external L2 cache)",
"AMD Duron",
"AMD Athlon 0.18u (integrated L2 cache)",
"AMD K7 Athlon/Duron",
"Rise mP6 iDragon .25u",
"Rise mP6 iDragon .18u",
"Rise mP6 iDragon II .25u",
"Rise mP6 iDragon II .18u",
"Rise mP6",
"TransMeta Crusoe"
};
Thanks!
Richard Hayden.
I've just upgraded my gcc and I'm currently trying to compile some code for
my own operating system kernel, but I am getting an error of "Undefined
reference to `memcpy`" when I try to link it using the GNU linker. I do not
reference the symbol memcpy explicitly anywhere in the offending function.
I have narrowed the offending code down to the initialisation of an array
of pointers to char (i.e. an array of strings), which is given below. It
seems that for some reason gcc is inserting calls to the standard library
in some attempt to optimise my code. How do I stop it from doing this? I'm
running version 3.3.1 and am compiling with the --freestanding flag, which
I thought should be enough to prevent this kind of behaviour (it certainly
was on previous versions; either that or gcc did not try and perform this
action then).
char* CPUstrings[] = {
"UNKNOWN Processor",
"Generic 386",
"NexGen 586",
"Cyrix M1 or IBM Bluelightning",
"Generic 486",
"Intel 386",
"Intel 486DX",
"Intel 486SX",
"Intel 486DX2",
"Intel 486SL",
"Intel 486SX2",
"Intel 486DX2 WB",
"Intel 486DX4",
"Intel 486DX4 WB",
"Intel 486",
"Intel Pentium Early P5",
"Intel Pentium 80501",
"Intel Pentium P54C 80502",
"Intel Pentium P24T (overdrive for 486 socket)",
"Intel Pentium MMX P55C",
"Intel Pentium P54C",
"Intel Pentium MMX P55",
"Intel Pentium P5",
"Intel Pentium Pro (Sample)",
"Intel Pentium Pro",
"Intel Pentium II (Klamath)",
"Intel Pentium II (Deschutes)/Xeon/Celeron",
"Intel Celeron A/Pentium II",
"Intel Pentium III (Katmai)",
"Intel Pentium III (Coppermine)",
"Intel Pentium III Xeon (Cascades)",
"Intel Pentium P6",
"Intel Pentium IV",
"UMC 486DX",
"UMC 486SX"
"UMC 486",
"AMD 486DX2, or DX4 in 2x WT mode",
"AMD 486DX2, or DX4 in 2x WB mode",
"AMD 486DX4, or 5x86 in 3x WT mode",
"AMD 486DX4 SV8B, 3x WB mode",
"AMD 5x86, 4x WT mode",
"AMD 5x86, 4x WB mode",
"AMD 486",
"AMD K5 Model 0",
"AMD K5 Model 1",
"AMD K5 Model 2",
"AMD K5 Model 3",
"AMD K6 Model 6",
"AMD K6 Model 7",
"AMD K6-II Model 8",
"AMD K6-III Model 9 (Sharptooth)",
"AMD K6-II+/K6-III+",
"AMD K5/K6",
"AMD Athlon 0.25u (external L2 cache)",
"AMD Athlon 0.18u (external L2 cache)",
"AMD Duron",
"AMD Athlon 0.18u (integrated L2 cache)",
"AMD K7 Athlon/Duron",
"Rise mP6 iDragon .25u",
"Rise mP6 iDragon .18u",
"Rise mP6 iDragon II .25u",
"Rise mP6 iDragon II .18u",
"Rise mP6",
"TransMeta Crusoe"
};
Thanks!
Richard Hayden.