Function keeps getting embedded into object!
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Configure log (config.log):
Code: Select all
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
configure:614: checking host system type
configure:635: checking target system type
configure:653: checking build system type
configure:708: checking for a BSD compatible install
configure:761: checking whether ln works
configure:785: checking whether ln -s works
configure:1856: checking for gcc
configure:1969: checking whether the C compiler (gcc ) works
configure:1985: gcc -o conftest conftest.c 1>&5
configure:2011: checking whether the C compiler (gcc ) is a cross-compiler
configure:2016: checking whether we are using GNU C
configure:2044: checking whether gcc accepts -g
configure:2111: checking for gnatbind
configure:2176: checking whether compiler driver understands Ada
configure:2208: checking how to compare bootstrapped objects
configure:2306: checking for correct version of gmp.h
configure:2319: gcc -c -g -O2 conftest.c 1>&5
configure:2309:17: gmp.h: No such file or directory
configure: In function `main':
configure:2313: error: `choke' undeclared (first use in this function)
configure:2313: error: (Each undeclared identifier is reported only once
configure:2313: error: for each function it appears in.)
configure:2313: error: parse error before "me"
configure: failed program was:
#line 2308 "configure"
#include "confdefs.h"
#include "gmp.h"
int main() {
#if __GNU_MP_VERSION < 3
choke me
#endif
; return 0; }
configure:3451: checking for bison
configure:3491: checking for bison
configure:3530: checking for gm4
configure:3569: checking for flex
configure:3609: checking for flex
configure:3648: checking for makeinfo
configure:3701: checking for expect
configure:3742: checking for runtest
configure:3790: checking for i686-pc-cygwin-ar
configure:3865: checking for i686-pc-cygwin-as
configure:3940: checking for i686-pc-cygwin-dlltool
configure:4015: checking for i686-pc-cygwin-ld
configure:4090: checking for i686-pc-cygwin-lipo
configure:4121: checking for lipo
configure:4165: checking for i686-pc-cygwin-nm
configure:4240: checking for i686-pc-cygwin-ranlib
configure:4310: checking for i686-pc-cygwin-strip
configure:4380: checking for i686-pc-cygwin-windres
configure:4455: checking for i686-pc-cygwin-objcopy
configure:4530: checking for i686-pc-cygwin-objdump
configure:4642: checking for i586-elf-cc
configure:4642: checking for i586-elf-gcc
configure:4733: checking for i586-elf-c++
configure:4733: checking for i586-elf-g++
configure:4733: checking for i586-elf-cxx
configure:4733: checking for i586-elf-gxx
configure:4824: checking for i586-elf-gcc
configure:4910: checking for i586-elf-gcj
configure:5001: checking for i586-elf-gfortran
configure:5157: checking for ar
configure:5211: checking for i586-elf-ar
configure:5310: checking for as
configure:5364: checking for i586-elf-as
configure:5463: checking for dlltool
configure:5517: checking for i586-elf-dlltool
configure:5616: checking for ld
configure:5670: checking for i586-elf-ld
configure:5769: checking for lipo
configure:5823: checking for i586-elf-lipo
configure:5922: checking for nm
configure:5976: checking for i586-elf-nm
configure:6075: checking for objdump
configure:6129: checking for i586-elf-objdump
configure:6228: checking for ranlib
configure:6282: checking for i586-elf-ranlib
configure:6381: checking for strip
configure:6435: checking for i586-elf-strip
configure:6534: checking for windres
configure:6588: checking for i586-elf-windres
configure:6667: checking where to find the target ar
configure:6700: checking where to find the target as
configure:6733: checking where to find the target cc
configure:6766: checking where to find the target c++
configure:6802: checking where to find the target c++ for libstdc++
configure:6838: checking where to find the target dlltool
configure:6871: checking where to find the target gcc
configure:6904: checking where to find the target gcj
configure:6940: checking where to find the target gfortran
configure:6976: checking where to find the target ld
configure:7009: checking where to find the target lipo
configure:7032: checking where to find the target nm
configure:7065: checking where to find the target objdump
configure:7098: checking where to find the target ranlib
configure:7131: checking where to find the target strip
configure:7164: checking where to find the target windres
configure:7225: checking whether to enable maintainer-specific portions of Makefiles
configure:7274: checking whether -fkeep-inline-functions is supported
configure:7283: gcc -c -g -O2 -fkeep-inline-functions conftest.c 1>&5
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
Oops. I have GMP. bison, byacc installed.
Complete configure command line:
Complete configure command line:
Code: Select all
../binutils-20060817-1/configure --prefix=$PREFIX --target=$TARGET --disable-nls
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
(EDIT: You might need the flex command.. Try getting that package..)pcmattman wrote:Oops. I have GMP. bison, byacc installed.
Complete configure command line:Code: Select all
../binutils-20060817-1/configure --prefix=$PREFIX --target=$TARGET --disable-nls
Why don't you try compiling binutils 2.17? And then get the latest GCC (Or 3x etc..) from their "official" locations.
Good luck..
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
(Why not build a cross-compiler in MinGW? A quick "googling" seems to show a few tutorials..)
**After searching OSDev there is something about having to set Cygwin to treat all files as binary? Think it's something asked during installation?
http://www.osdev.org/phpBB2/viewtopic.php?p=95615#95615
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
I already have flex.
All files are treated as binary![Confused :?](./images/smilies/icon_confused.gif)
I have the worst luck... Can't get a cross-compiler to build, can't get virtual mode to work (everyone else can
), have all sorts of other problems.
Maybe I should just go back to Windows programming. At least it always works the way I expect it to.
All files are treated as binary
![Confused :?](./images/smilies/icon_confused.gif)
I have the worst luck... Can't get a cross-compiler to build, can't get virtual mode to work (everyone else can
![Crying or Very sad :cry:](./images/smilies/icon_cry.gif)
Maybe I should just go back to Windows programming. At least it always works the way I expect it to.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
You could always try using a better development OS.. loll..pcmattman wrote:I already have flex.
All files are treated as binary
I have the worst luck... Can't get a cross-compiler to build, can't get virtual mode to work (everyone else can), have all sorts of other problems.
Maybe I should just go back to Windows programming. At least it always works the way I expect it to.
![Wink :wink:](./images/smilies/icon_wink.gif)
Under Step 1, Bootstrap:pcmattman wrote:Complete configure command line:Code: Select all
../binutils-20060817-1/configure --prefix=$PREFIX --target=$TARGET --disable-nls
"We need the binutils and the GCC packages from http://ftp.gnu.org/gnu/.
What you are trying to do is to compile the Cygwin source package.
Every good solution is obvious once you've found it.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
News: OK, I have now gotten my cross-compiler to work without any problems. This error still appears though!
The problem is here:
Any ideas? It appears it only occurs on large structures... I'm stuck, to say the least. And I do have a memcpy, but when I make it ' extern "C" ' I get all sorts of link errors (same as above
)
Edit: OK, I tried this in my header file:
And this for my memcpy:
Cleaned the directory, rebuilt from scratch, didn't work:
Everything compiles, but doesn't link. Weird... objdump outputs:
Something is not right, maybe be I forgot to make sure that memcpy is definitely extern "C" in both the header and the implementation?
Edit 2: why am I not surprised? Stupid mistakes... It works now![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)
Code: Select all
devman.cc:(.gnu.linkonce.t._ZN11CLinkedListI6DeviceE3GetEi+0x6d): undefined refe
rence to `memcpy'
Code: Select all
// device structure
struct Device {
//------- Device Details -------//
char name[64]; /** used in 'open' calls **/
int VendorID; /** makes printing information easier **/
int DeviceID; /** see above **/
int osid; /** the operating system's ID for the device **/
//------- Functions -------//
int (*ioctl_int)(int,int,int);
int (*ioctl_ptr)(int,int,void*);
int (*read)(int,void*,uint_t);
int (*write)(int,void*,uint_t);
int (*lseek)(int,uint_t,int);
};
// global linked list of all devices
CLinkedList<struct Device> DeviceList;
/*** ... code ... **/
// returns a new file descriptor for the device
int open( const char* pathname, int flags )
{
// find in the list
for( int i = 0; i < DeviceList.Size(); i++ )
{
// compare
if( strcmp( const_cast< char* >( pathname ), DeviceList.Get(i).name, strlen( DeviceList.Get(i).name ) ) )
{
// return the descriptor
return i;
}
}
// none found
return INVALID_DEV;
}
![Confused :?](./images/smilies/icon_confused.gif)
Edit: OK, I tried this in my header file:
Code: Select all
extern "C" void *memcpy( void *dest, const void *src, int n );
Code: Select all
static inline void *memcpy( void *dest, const void *src, int n ) {
char *dst=(char*)dest,*source=(char*)src;
for( ; n ; n-- )
*dst++ = *source++;
return dest;
}
Code: Select all
Linking
./console/console.o: In function `Console::Output(char const*)':
console.cc:(.text+0x1d3): undefined reference to `memcpy'
./devman/devman.o: In function `CLinkedList<Device>::Get(int)':
devman.cc:(.gnu.linkonce.t._ZN11CLinkedListI6DeviceE3GetEi+0x6d): undefined refe
rence to `memcpy'
devman.cc:(.gnu.linkonce.t._ZN11CLinkedListI6DeviceE3GetEi+0x8a): undefined refe
rence to `memcpy'
./fs/fat32.o: In function `PadFilename(unsigned char*)':
fat32.cc:(.text+0x10ce): undefined reference to `memcpy'
./winman/winman.o: In function `CreateWindow(unsigned int, char const*, unsigned
int, unsigned int, unsigned int, unsigned int, bool (*)(unsigned int, unsigned
int, unsigned int, unsigned int))':
winman.cc:(.text+0x399): undefined reference to `memcpy'
make: *** [kernel.bin] Error 1
Code: Select all
syscore/mem.o: file format elf32-i386
syscore/mem.o
architecture: i386, flags 0x00000011:
HAS_RELOC, HAS_SYMS
start address 0x00000000
Sections:
Idx Name Size VMA LMA File off Algn
0 .text 000000f7 00000000 00000000 00000034 2**2
CONTENTS, ALLOC, LOAD, RELOC, READONLY, CODE
1 .data 00000000 00000000 00000000 0000012c 2**2
CONTENTS, ALLOC, LOAD, DATA
2 .bss 00000004 00000000 00000000 0000012c 2**2
ALLOC
3 .comment 00000012 00000000 00000000 0000012c 2**0
CONTENTS, READONLY
SYMBOL TABLE:
00000000 l df *ABS* 00000000 mem.cc
00000000 l d .text 00000000 .text
00000000 l d .data 00000000 .data
00000000 l d .bss 00000000 .bss
00000034 l F .text 0000003b _Z6memcpyPvPKvi
00000000 l d .comment 00000000 .comment
00000000 g F .text 00000033 _Z6memsetPvhi
00000070 g F .text 0000000d _Z3brkj
00000000 g O .bss 00000004 HeapTop
0000007e g F .text 00000020 _Z4sbrkj
0000009e g F .text 00000010 _Z6mallocj
000000ae g F .text 00000027 _Z7reallocPvjj
000000d6 g F .text 0000001b _Z11init_memmanP14multiboot_info
00000000 *UND* 00000000 end
000000f2 g F .text 00000005 _Z4freePv
RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
00000077 R_386_32 HeapTop
00000085 R_386_32 HeapTop
0000008d R_386_32 HeapTop
00000095 R_386_32 HeapTop
000000a5 R_386_PC32 _Z4sbrkj
000000b8 R_386_PC32 _Z4sbrkj
000000dd R_386_32 end
000000e8 R_386_PC32 _Z3brkj
Edit 2: why am I not surprised? Stupid mistakes... It works now
![Rolling Eyes :roll:](./images/smilies/icon_rolleyes.gif)