* Compiler/linker oddness?
@ 2000-03-02 15:58 pchapman
2000-03-06 15:14 ` pchapman
0 siblings, 1 reply; 10+ messages in thread
From: pchapman @ 2000-03-02 15:58 UTC (permalink / raw)
To: axp-list
Hi,
I'm building a big-and-ugly piece of software and have come across an
odd problem. Here's the story:
I finally got the thing to compile yesterday, and it cored immediately
on execution. No surprises there; I wasn't expecting it to work
properly first time around. I aimed ladebug at it, and discovered to my
surprise that it's coring in XtVaAppInitialize(), which is the first
line of the program that really does anything:
--------
main(int argc, char *argv[])
{
Arg args[20];
Display *display;
int i,j, screen_num, rside, status;
unsigned int scr_width, scr_height;
Dimension h1,h2,h3;
XtIntervalId Id;
Widget wForm, wMenuBar;
printf("Starting xscan..\n");
fflush(stdout);
/*------------- Special SGI : permet de mettre RECL en byte ----*/
#ifdef _OldRecl
f77vms_flag_[OLD_RL] = 1;
#endif
/*------------- Special SGI : permet de mettre RECL en byte ----*/
StrCurrentProcessing=(char *)malloc(200*sizeof(char));
if (StrCurrentProcessing == NULL )
{
printf("Erreur Allocation de StrCurrentProcessing\n");
}
gZoomSelect=False;
gwOldRadio=NULL;
/*------------------------- create the top widget ----------------------*/
gwTop = XtVaAppInitialize (&app_context, "xscan.rc",
NULL , (Cardinal)0,
&argc, (String *)argv,
(String *)fallback_resources, NULL);
(etc)
--------
Cutting and pasting this into a new file (and adding the globals that
aren't declared in this snippet) results in something that compiles and
runs without error. Ladebug shows all of the arguments to
XtVaAppInitialize to be sensible. Changing optimization and
compiler (gcc <--> ccc) doesn't make any difference to either.
I can only assume that I've found a linker or loader bug. The program
is quite big (binary is ~3 megs), and is a combination of Fortran 90
and C. I've been using the Compaq fortran compiler for the fortran and
switching between gcc and ccc for the C. It dies long before it gets
to any fortran, though. The build process also creates some libraries
along the way (using ar cq), which are then linked into the final
program.
I'm running Red Hat 6.1 on a 164UX system, egcs-2.91.66 and the latest
compilers from Compaq. Has anyone seen any behaviour like this before?
Any help would be greatly appreciated!
Thanks,
-Paul Chapman
pchapman@fury.bio.dfo.ca
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compiler/linker oddness?
2000-03-02 15:58 Compiler/linker oddness? pchapman
@ 2000-03-06 15:14 ` pchapman
2000-03-06 17:40 ` W Bauske
0 siblings, 1 reply; 10+ messages in thread
From: pchapman @ 2000-03-06 15:14 UTC (permalink / raw)
To: axp-list
On 2 Mar, To: axp-list@redhat.com wrote:
> Hi,
...
Replying to my own message here. I thought it might be a linker
problem, so I built binutils-2.9.5.0.29, whose linker produces this
(word wrapped for your convenience):
-----
ccc main00.o plot01.o plot02.o palette.o method01.o method02.o sample01.o
sample02.o sample03.o sample04.o startup.o main.o perf.o interactif.o io.o
scalar01.o scalar02.o vector.o mesh01.o mesh02.o mesh03.o trigrid01.o
trigrid02.o trigrid03.o points.o node01.o node02.o ef.o bathy01.o bathy02.o
axes.o polygones.o animation.o extraction01.o extraction02.o make.o
filtre.o coast.o buffer.o SHOM.o continuity.o scan.o geo.o stations.o cefmo.o
script.o analysis03.o analysis01.o analysis02.o analysis04.o functions.o
GridB01.o GridB02.o Criterion.o Export.o Info.o Legend.o ScanInfo.o Model.o
Title.o Image.o xviris.o xvgifwr.o xvtiffwr.o xvgif.o x_main01.o x_main02.o
x_main03.o xmenu_00.o xmenu_01.o xmenu_02.o xmenu_03.o xmenu_04.o xmenu_05.o
xmenu_06.o xmenu_07.o xmenu_08.o xmenu_09.o xmenu_10.o xmenu_11.o xmenu_12.o
xmenu_Z.o x_mouse.o xmenu_13.o xmenu_14.o xmenu_3333.o xvmisc.o xv24to8.o
logo.o ScanToNode.o Extract.o x_pref01.o x_pref02.o x_pref03.o x_pref04.o
x_pref05.o x_pref06.o x_view.o xscan.o xscanw.o x_TextBox.o
-L/home/pchapman/Genesis-4.0/lib -L/usr/local/LessTif/Motif1.2/lib
-L/usr/X11/lib -lxkernel -lkernel -lXrot -lpixB -llinpack -lfftpack -llinpack
-ltiff -lXm -lXt -lX11 -lm -lots -lFutil -lUfor -lfor -lc -o
/home/pchapman/Genesis-4.0/xscan/exe/xscan.exe
/home/pchapman/newbinutils/bin/ld:
/home/pchapman/Genesis-4.0/xscan/exe/xscan.exe: Not enough room
for program headers (allocated 6, need 7)
/home/pchapman/newbinutils/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
-----
Is this a bug in the linker? Smaller programs link without problems.
Again, I'm using RH 6.1, with the released versions of ccc and fort. I
have also tried gcc for the C parts, with the same results. The
Fortran parts require Fortran 90, so I can't test with g77.
Thanks in Advance,
-Paul Chapman
pchapman@fury.bio.dfo.ca
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compiler/linker oddness?
2000-03-06 15:14 ` pchapman
@ 2000-03-06 17:40 ` W Bauske
2000-03-07 16:24 ` pchapman
2000-03-08 2:39 ` Richard Henderson
0 siblings, 2 replies; 10+ messages in thread
From: W Bauske @ 2000-03-06 17:40 UTC (permalink / raw)
To: axp-list
pchapman@fury.bio.dfo.ca wrote:
>
> On 2 Mar, To: axp-list@redhat.com wrote:
> > Hi,
>
> ...
>
> Replying to my own message here. I thought it might be a linker
> problem, so I built binutils-2.9.5.0.29, whose linker produces this
> (word wrapped for your convenience):
>
> -----
>
> ccc main00.o plot01.o plot02.o palette.o method01.o method02.o sample01.o
> sample02.o sample03.o sample04.o startup.o main.o perf.o interactif.o io.o
> scalar01.o scalar02.o vector.o mesh01.o mesh02.o mesh03.o trigrid01.o
> trigrid02.o trigrid03.o points.o node01.o node02.o ef.o bathy01.o bathy02.o
> axes.o polygones.o animation.o extraction01.o extraction02.o make.o
> filtre.o coast.o buffer.o SHOM.o continuity.o scan.o geo.o stations.o cefmo.o
> script.o analysis03.o analysis01.o analysis02.o analysis04.o functions.o
> GridB01.o GridB02.o Criterion.o Export.o Info.o Legend.o ScanInfo.o Model.o
> Title.o Image.o xviris.o xvgifwr.o xvtiffwr.o xvgif.o x_main01.o x_main02.o
> x_main03.o xmenu_00.o xmenu_01.o xmenu_02.o xmenu_03.o xmenu_04.o xmenu_05.o
> xmenu_06.o xmenu_07.o xmenu_08.o xmenu_09.o xmenu_10.o xmenu_11.o xmenu_12.o
> xmenu_Z.o x_mouse.o xmenu_13.o xmenu_14.o xmenu_3333.o xvmisc.o xv24to8.o
> logo.o ScanToNode.o Extract.o x_pref01.o x_pref02.o x_pref03.o x_pref04.o
> x_pref05.o x_pref06.o x_view.o xscan.o xscanw.o x_TextBox.o
> -L/home/pchapman/Genesis-4.0/lib -L/usr/local/LessTif/Motif1.2/lib
> -L/usr/X11/lib -lxkernel -lkernel -lXrot -lpixB -llinpack -lfftpack -llinpack
> -ltiff -lXm -lXt -lX11 -lm -lots -lFutil -lUfor -lfor -lc -o
> /home/pchapman/Genesis-4.0/xscan/exe/xscan.exe
>
> /home/pchapman/newbinutils/bin/ld:
> /home/pchapman/Genesis-4.0/xscan/exe/xscan.exe: Not enough room
> for program headers (allocated 6, need 7)
>
> /home/pchapman/newbinutils/bin/ld: final link failed: Bad value
> collect2: ld returned 1 exit status
>
> -----
>
> Is this a bug in the linker? Smaller programs link without problems.
> Again, I'm using RH 6.1, with the released versions of ccc and fort. I
> have also tried gcc for the C parts, with the same results. The
> Fortran parts require Fortran 90, so I can't test with g77.
>
Looks like you exceeded ld's guess at how many program headers
your code would need. Do a "info ld", go to the index, and look
at the ELF program header section and it talks about PHDRS and how
to change them. Must be an unusual piece of code.
Wes
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compiler/linker oddness?
2000-03-06 17:40 ` W Bauske
@ 2000-03-07 16:24 ` pchapman
2000-03-08 2:39 ` Richard Henderson
1 sibling, 0 replies; 10+ messages in thread
From: pchapman @ 2000-03-07 16:24 UTC (permalink / raw)
To: axp-list
On 6 Mar, W Bauske wrote:
> Looks like you exceeded ld's guess at how many program headers
> your code would need. Do a "info ld", go to the index, and look
> at the ELF program header section and it talks about PHDRS and how
> to change them. Must be an unusual piece of code.
Thanks for the help. This program is the Thing that Should Not Be.
I'm actively trying to convince the higher-ups that it needs to be
dumped and replaced before it claims another victim. It's taken me
three weeks just to get it to compile.
-Paul
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compiler/linker oddness?
2000-03-06 17:40 ` W Bauske
2000-03-07 16:24 ` pchapman
@ 2000-03-08 2:39 ` Richard Henderson
2000-03-08 20:28 ` W Bauske
2000-03-08 21:15 ` linker works [Was: Re: Compiler/linker oddness?] Andrei A. Dergatchev
1 sibling, 2 replies; 10+ messages in thread
From: Richard Henderson @ 2000-03-08 2:39 UTC (permalink / raw)
To: axp-list
On Mon, Mar 06, 2000 at 11:40:48AM -0600, W Bauske wrote:
> > /home/pchapman/Genesis-4.0/xscan/exe/xscan.exe: Not enough room
> > for program headers (allocated 6, need 7)
> >
> Looks like you exceeded ld's guess at how many program headers
> your code would need. Do a "info ld", go to the index...
No, it's either a bug in the linker or a bug in ccc in building
the object files. Someone who understands how the linker works
(probably me) would have to examine the object files to be sure
which.
r~
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compiler/linker oddness?
2000-03-08 2:39 ` Richard Henderson
@ 2000-03-08 20:28 ` W Bauske
2000-03-09 17:38 ` Richard Henderson
2000-03-08 21:15 ` linker works [Was: Re: Compiler/linker oddness?] Andrei A. Dergatchev
1 sibling, 1 reply; 10+ messages in thread
From: W Bauske @ 2000-03-08 20:28 UTC (permalink / raw)
To: axp-list
Richard Henderson wrote:
>
> On Mon, Mar 06, 2000 at 11:40:48AM -0600, W Bauske wrote:
> > > /home/pchapman/Genesis-4.0/xscan/exe/xscan.exe: Not enough room
> > > for program headers (allocated 6, need 7)
> > >
> > Looks like you exceeded ld's guess at how many program headers
> > your code would need. Do a "info ld", go to the index...
>
> No, it's either a bug in the linker or a bug in ccc in building
> the object files. Someone who understands how the linker works
> (probably me) would have to examine the object files to be sure
> which.
>
OK.
Then why have the option to specify them with PHDRS??
Wes
^ permalink raw reply [flat|nested] 10+ messages in thread
* linker works [Was: Re: Compiler/linker oddness?]
2000-03-08 2:39 ` Richard Henderson
2000-03-08 20:28 ` W Bauske
@ 2000-03-08 21:15 ` Andrei A. Dergatchev
2000-03-10 2:47 ` Richard Henderson
1 sibling, 1 reply; 10+ messages in thread
From: Andrei A. Dergatchev @ 2000-03-08 21:15 UTC (permalink / raw)
To: axp-list
[...]
> Someone who understands how the linker works
> (probably me) would have to examine the object files to be sure
> which.
While we are in it, could someone please advise on what would be
a useful description of "how the linker works" in a programmer's
language
with examples preferrably based on real-life available products ? Except
the ld's source itself of course :-)
>
> r~
>
Rgds,
Andrei
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: Compiler/linker oddness?
2000-03-08 20:28 ` W Bauske
@ 2000-03-09 17:38 ` Richard Henderson
0 siblings, 0 replies; 10+ messages in thread
From: Richard Henderson @ 2000-03-09 17:38 UTC (permalink / raw)
To: axp-list
On Wed, Mar 08, 2000 at 02:28:05PM -0600, W Bauske wrote:
> Then why have the option to specify them with PHDRS??
For doing weird stuff. Just linking a linux application
shouldn't require you mess with linker scripts.
r~
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: linker works [Was: Re: Compiler/linker oddness?]
2000-03-08 21:15 ` linker works [Was: Re: Compiler/linker oddness?] Andrei A. Dergatchev
@ 2000-03-10 2:47 ` Richard Henderson
2000-03-11 3:05 ` Jeffrey Sturm
0 siblings, 1 reply; 10+ messages in thread
From: Richard Henderson @ 2000-03-10 2:47 UTC (permalink / raw)
To: axp-list
On Wed, Mar 08, 2000 at 10:15:33PM +0100, Andrei A. Dergatchev wrote:
> While we are in it, could someone please advise on what would be
> a useful description of "how the linker works" in a programmer's
> language with examples ...
Hum.. There is _Linkers and Loaders_ by John Levine. Never
read it to see how good it is. There's not much else, really.
The subject is not theoretically difficult, merely tedious and
full of arbitrary special cases, which prompts most authors to
gloss over the whole thing.
r~
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: linker works [Was: Re: Compiler/linker oddness?]
2000-03-10 2:47 ` Richard Henderson
@ 2000-03-11 3:05 ` Jeffrey Sturm
0 siblings, 0 replies; 10+ messages in thread
From: Jeffrey Sturm @ 2000-03-11 3:05 UTC (permalink / raw)
To: axp-list
Richard Henderson wrote:
> On Wed, Mar 08, 2000 at 10:15:33PM +0100, Andrei A. Dergatchev wrote:
> > While we are in it, could someone please advise on what would be
> > a useful description of "how the linker works" in a programmer's
> > language with examples ...
>
> Hum.. There is _Linkers and Loaders_ by John Levine. Never
> read it to see how good it is. There's not much else, really.
> The subject is not theoretically difficult, merely tedious and
> full of arbitrary special cases, which prompts most authors to
> gloss over the whole thing.
I'll vouch for it... L&L is a fascinating book for those interested in
that sort of thing (picked up my copy this week).
--
Jeff Sturm
jsturm@sigma6.com
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2000-03-11 3:00 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2000-03-02 15:58 Compiler/linker oddness? pchapman
2000-03-06 15:14 ` pchapman
2000-03-06 17:40 ` W Bauske
2000-03-07 16:24 ` pchapman
2000-03-08 2:39 ` Richard Henderson
2000-03-08 20:28 ` W Bauske
2000-03-09 17:38 ` Richard Henderson
2000-03-08 21:15 ` linker works [Was: Re: Compiler/linker oddness?] Andrei A. Dergatchev
2000-03-10 2:47 ` Richard Henderson
2000-03-11 3:05 ` Jeffrey Sturm
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox