Skip to contentSkip to conversation

Error when linking

DISCUSSION Emmanuel STAPF 4 participants 9 messages Oct 20, 2001 – Nov 6, 2001

lore
Share & tools
lore
#0 lore raw

Hi,

When compiling a big system composed of about 1000 c files, I get a lot of errors such as reproduced below. Is there a solution to this problem?

Thanks,
Manu

/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x20): relocation truncated to fit: R_PPC_REL24 __libc_start_main@@GLIBC_2.0 /usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegin.o: In function `__do_global_dtors_aux':
/usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegin.o(.text+ 0x94): relocation truncated to fit: R_PPC_PLTREL24 __deregister_frame_info@@GLIBC_2.0 /usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegin.o: In function `frame_dummy':
/usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegin.o(.text+ 0x12c): relocation truncated to fit: R_PPC_PLTREL24 __register_frame_info@@GLIBC_2.0
C1/Cobj1.o: In function `Facss3c':
C1/Cobj1.o(.text+0x1480c): relocation truncated to fit: R_PPC_REL24 __sigsetjmp@@GLIBC_2.0
C2/Cobj2.o: In function `Fan1eqv':
C2/Cobj2.o(.text+0x23b78): relocation truncated to fit: R_PPC_REL24 __sigsetjmp@@GLIBC_2.0
C2/Cobj2.o: In function `Fan3cjq':
C2/Cobj2.o(.text+0x24968): relocation truncated to fit: R_PPC_REL24 __sigsetjmp@@GLIBC_2.0
C2/Cobj2.o: In function `Fan3_hc':
C2/Cobj2.o(.text+0x2519c): relocation truncated to fit: R_PPC_REL24 __sigsetjmp@@GLIBC_2.0
C5/Cobj5.o: In function `Fbbi2tl':
C5/Cobj5.o(.text+0x10638): relocation truncated to fit: R_PPC_REL24 calloc@@GLIBC_2.0
C5/Cobj5.o: In function `Fbbow77':
C5/Cobj5.o(.text+0x1074c): relocation truncated to fit: R_PPC_REL24 calloc@@GLIBC_2.0
C5/Cobj5.o: In function `Fbb883r':
C5/Cobj5.o(.text+0x10920): relocation truncated to fit: R_PPC_REL24 calloc@@GLIBC_2.0
C5/Cobj5.o: In function `Fbcj80c':
C5/Cobj5.o(.text+0x10a74): relocation truncated to fit: R_PPC_REL24 calloc@@GLIBC_2.0
C5/Cobj5.o: In function `Fbcwjs6':
C5/Cobj5.o(.text+0x10bd8): relocation truncated to fit: R_PPC_REL24 calloc@@GLIBC_2.0
.....

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#1 lore raw

From: "Emmanuel STAPF" <[email protected]>
To: <[email protected]>
Subject: Error when linking
Date: Sat, 20 Oct 2001 00:03:44 -0700

Quoted 9 lines

Hi,

When compiling a big system composed of about 1000 c files, I get a lot of errors such as reproduced below. Is there a solution to this problem?

Thanks,
Manu

Quoted 16 lines

/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x20): relocation truncated to fit: R_PPC_REL24 __libc_start_main@@GLIBC_2.0 /usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegin.o: In function `__do_global_dtors_aux':
/usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegin.o(.text+ 0x94): relocation truncated to fit: R_PPC_PLTREL24 __deregister_frame_info@@GLIBC_2.0 /usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegin.o: In function `frame_dummy':
/usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegin.o(.text+ 0x12c): relocation truncated to fit: R_PPC_PLTREL24 __register_frame_info@@GLIBC_2.0
C1/Cobj1.o: In function `Facss3c':
C1/Cobj1.o(.text+0x1480c): relocation truncated to fit: R_PPC_REL24 __sigsetjmp@@GLIBC_2.0

Glibc has those rabel.
You can check with nm command

Kaoru

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw

I should add that they occur only when I have my 1000 files. A similar project using those C function but smaller compiles without any problem.

Any idea why and what are the possible solutions?
Manu

Quoted 48 lines

-----Original Message-----
From: Kaoru Fukui [mailto:[email protected]]
Sent: Saturday, October 20, 2001 00:25
To: [email protected]
Cc: [email protected]
Subject: Re: Error when linking

From: "Emmanuel STAPF" <[email protected]>
To: <[email protected]>
Subject: Error when linking
Date: Sat, 20 Oct 2001 00:03:44 -0700

Quoted 4 lines

Hi,

When compiling a big system composed of about 1000 c files,

I get a lot

Quoted 1 line

of errors such as reproduced below. Is there a solution to

this problem?

Quoted 6 lines

Thanks,
Manu

/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x20): relocation truncated to fit:

R_PPC_REL24

Quoted 2 lines

__libc_start_main@@GLIBC_2.0

/usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegin.o: In

Quoted 2 lines

function `__do_global_dtors_aux':

/usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegi n.o(.text+

Quoted 3 lines

0x94): relocation truncated to fit: R_PPC_PLTREL24 __deregister_frame_info@@GLIBC_2.0

/usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegin.o: In

Quoted 2 lines

function `frame_dummy':

/usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegi n.o(.text+

Quoted 5 lines

0x12c): relocation truncated to fit: R_PPC_PLTREL24 __register_frame_info@@GLIBC_2.0
C1/Cobj1.o: In function `Facss3c':
C1/Cobj1.o(.text+0x1480c): relocation truncated to fit: R_PPC_REL24 __sigsetjmp@@GLIBC_2.0

Quoted 7 lines

Glibc has those rabel.
You can check with nm command

Kaoru

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#3 lore raw

I suspect the problem is that you're trying to call functions that the linker is putting farther apart than can be referenced in a 24 bit offset, which is the largest branch offset allowed with that type of call. Would your final program be bigger than 16M? Any branch with an offset more than 16M can't fit in a normal ppc branch instruction. If possible, you should make your program smaller, but if that isn't feasible, I seem to remember someone mentioning a way to make the linker do calls with absolute, 32 bit addresses. I just don't remember how to do it, and the ld manpages aren't the best in the world for architecture specific stuff. This came up once before on the mailing list, so you might try to search the archives.

Brad Boyer
[email protected]

Quoted 8 lines · Emmanuel STAPF

I should add that they occur only when I have my 1000 files. A similar project using those C function but smaller compiles without any problem.

Any idea why and what are the possible solutions?
Manu

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#4 lore raw

Indeed my problem is supposed to be around 50MB in size and as you guessed I can't make it smaller.

I looked at the mailing list archive but I could not find what I should use to make `ld' link my object files. So if anyone as the solution do not hesitate to share it.

Thanks,
Manu

Quoted 24 lines

-----Original Message-----
From: Brad Boyer [mailto:[email protected]]
Sent: Saturday, October 20, 2001 11:47 AM
To: [email protected]
Cc: 'Kaoru Fukui'; [email protected]
Subject: Re: Error when linking

I suspect the problem is that you're trying to call functions that the linker is putting farther apart than can be referenced in a 24 bit offset, which is the largest branch offset allowed with that type of call. Would your final program be bigger than 16M? Any branch with an offset more than 16M can't fit in a normal ppc branch instruction. If possible, you should make your program smaller, but if that isn't feasible, I seem to remember someone mentioning a way to make the linker do calls with absolute, 32 bit addresses. I just don't remember how to do it, and the ld manpages aren't the best in the world for architecture specific stuff. This came up once before on the mailing list, so you might try to search the archives.

Brad Boyer
[email protected]

Quoted 13 lines
Quoted 3 lines · Emmanuel STAPF

I should add that they occur only when I have my 1000

files. A similar

Quoted 1 line

project using those C function but smaller compiles without

any problem.

Quoted 4 lines

Any idea why and what are the possible solutions?
Manu

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#5 lore raw

Take a look at this thread in the archives:

http://lists.linuxppc.org/linuxppc-user/199907/msg01059.html

Similar problem (90M executable), and the solution seems to have been to use shared libraries.

Quoted 5 lines · Emmanuel STAPF

Indeed my problem is supposed to be around 50MB in size and as you guessed I can't make it smaller.

Quoted 7 lines

I looked at the mailing list archive but I could not find what I should use to make `ld' link my object files. So if anyone as the solution do not hesitate to share it.

Thanks,
Manu

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#6 lore raw

I tried to build my objects file as shared library just to see if it would have worked. But with no success, my app core dumps when I try to launch it. But in my case doing shared library is not an option since I would have about 100 shared libraries for my app so it becomes a nightmare to manage.

Does anyone know if there is a linker workaround or if there is a way to either fix gcc or ld to make sure they can handle large objects with no modification of the code. I don't see why on LinuxPPC one would have to modify code that runs on other Linux et UNIX platforms.

Thanks,
Manu

Quoted 87 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Brad Boyer
Sent: Saturday, October 20, 2001 21:27
To: [email protected]
Cc: [email protected]
Subject: Re: Error when linking

Take a look at this thread in the archives:

http://lists.linuxppc.org/linuxppc-user/199907/msg01059.html

Similar problem (90M executable), and the solution seems to have been to use shared libraries.

Quoted 5 lines · Emmanuel STAPF

Indeed my problem is supposed to be around 50MB in size and as you guessed I can't make it smaller.

Quoted 7 lines

I looked at the mailing list archive but I could not find what I should use to make `ld' link my object files. So if anyone as the solution do not hesitate to share it.

Thanks,
Manu

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Emmanuel STAPF
Sent: Saturday, October 20, 2001 00:04
To: [email protected]
Subject: Error when linking

Hi,

When compiling a big system composed of about 1000 c files, I get a lot of errors such as reproduced below. Is there a solution to this problem?

Thanks,
Manu

/usr/lib/crt1.o: In function `_start':
/usr/lib/crt1.o(.text+0x20): relocation truncated to fit:
R_PPC_REL24 __libc_start_main@@GLIBC_2.0 /usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegi n.o: In function `__do_global_dtors_aux':
/usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegi n.o(.text+
0x94): relocation truncated to fit: R_PPC_PLTREL24 __deregister_frame_info@@GLIBC_2.0 /usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegi n.o: In function `frame_dummy':
/usr/local/lib/gcc-lib/powerpc-unknown-linux-gnu/3.0.1/crtbegi n.o(.text+
0x12c): relocation truncated to fit: R_PPC_PLTREL24 __register_frame_info@@GLIBC_2.0
C1/Cobj1.o: In function `Facss3c':
C1/Cobj1.o(.text+0x1480c): relocation truncated to fit:
R_PPC_REL24 __sigsetjmp@@GLIBC_2.0
C2/Cobj2.o: In function `Fan1eqv':
C2/Cobj2.o(.text+0x23b78): relocation truncated to fit:
R_PPC_REL24 __sigsetjmp@@GLIBC_2.0
C2/Cobj2.o: In function `Fan3cjq':
C2/Cobj2.o(.text+0x24968): relocation truncated to fit:
R_PPC_REL24 __sigsetjmp@@GLIBC_2.0
C2/Cobj2.o: In function `Fan3_hc':
C2/Cobj2.o(.text+0x2519c): relocation truncated to fit:
R_PPC_REL24 __sigsetjmp@@GLIBC_2.0
C5/Cobj5.o: In function `Fbbi2tl':
C5/Cobj5.o(.text+0x10638): relocation truncated to fit:
R_PPC_REL24 calloc@@GLIBC_2.0
C5/Cobj5.o: In function `Fbbow77':
C5/Cobj5.o(.text+0x1074c): relocation truncated to fit:
R_PPC_REL24 calloc@@GLIBC_2.0
C5/Cobj5.o: In function `Fbb883r':

Quoted 12 lines

C5/Cobj5.o(.text+0x10920): relocation truncated to fit:
R_PPC_REL24 calloc@@GLIBC_2.0
C5/Cobj5.o: In function `Fbcj80c':
C5/Cobj5.o(.text+0x10a74): relocation truncated to fit:
R_PPC_REL24 calloc@@GLIBC_2.0
C5/Cobj5.o: In function `Fbcwjs6':
C5/Cobj5.o(.text+0x10bd8): relocation truncated to fit:
R_PPC_REL24 calloc@@GLIBC_2.0 .....

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#7 lore raw

Strange warning during C compilation

Hi,

I'm getting the following warning: warning: pasting "h" and "(" does not give a valid preprocessing token

Here is the piece of code that shows the problem:

#define CAT(a,b)a ## b
#define TEST_MACRO(n,c,a) (CAT(n,_done) ? CAT(n,_result) :
CAT(c,a))

extern void* h();
extern void f(void*);
extern void* h_result;
extern char h_done;

void k (void* titi)

{
        f((TEST_MACRO(h,h,())));
}

If you save this code in a test.c file and use `gcc -Wall -c test.c' here is what you get:

test.c:11:12: warning: pasting "h" and "(" does not give a valid preprocessing token

Any idea what is wrong here? My gcc version is 3.01. It was also happening on my gcc version 2.96 with a slightly different error
message: warning: pasting would not give a valid preprocessing token. I tried with an even older version (2.7.2.3) and no warnings.

Regards,
Manu

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#8 lore raw

Re: Strange warning during C compilation

Quoted 24 lines · Emmanuel STAPF

Hi,

I'm getting the following warning: warning: pasting "h" and "(" does not give a valid preprocessing token

Here is the piece of code that shows the problem:

#define CAT(a,b)a ## b
#define TEST_MACRO(n,c,a) (CAT(n,_done) ? CAT(n,_result) :
CAT(c,a))

extern void* h();
extern void f(void*);
extern void* h_result;
extern char h_done;

void k (void* titi)

{
        f((TEST_MACRO(h,h,())));
}

If you save this code in a test.c file and use `gcc -Wall -c test.c' here is what you get:

Quoted 7 lines

test.c:11:12: warning: pasting "h" and "(" does not give a valid preprocessing token

Any idea what is wrong here? My gcc version is 3.01. It was also happening on my gcc version 2.96 with a slightly different error
message: warning: pasting would not give a valid preprocessing token. I tried with an even older version (2.7.2.3) and no warnings.

h and ( are separate tokens, no need to paste them. Remember, the C preprocessor is token based, it's not a text processor.

Franz.

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/