unexpected gpc command line behaviour

trevor-b at ovi.com trevor-b at ovi.com
Thu Jan 19 14:24:18 CET 2012


Hi,
I've built gpc-20070904 for openSuSE 12.1 and the gpc command fails unless I type the full path name of gpc on the command line.

For example, if I type gpc -- verbose hello.pas , gpc calls the assembler in 32 bit mode.  Like this ...

trevor at linux-z54m:~/projects/gpc/gpc-20070904/p/demos> gpc --verbose hello.pas 
Reading specs from /usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/specs
Configured with: ./configure --host=x86_64-suse-linux-gnu --build=x86_64-suse-linux-gnu --enable-languages=pascal --disable-mapped-location --enable-threads=posix --disable-nls --prefix=/usr/local/gpc --infodir=/usr/local/info --mandir=/usr/local/man
Thread model: posix
gpc version 20070904, based on gcc-3.4.6
 /usr/local/gpc/lib/gcc/x86_64-suse-linux-gnu/3.4.6/gpc1 -quiet -v hello.pas -quiet -dumpbase hello.pas -mtune=k8 -auxbase hello -famtmpfile=/tmp/ccsijV8f.gpa -version -o /tmp/cclfaLHH.s
GNU Pascal version 20070904, based on gcc-3.4.6 (x86_64-suse-linux-gnu)
        compiled by GNU C version 3.4.6.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Pascal Compiler PreProcessor version 20070904, based on gcc-3.4.6

 as -V -Qy --32 -o /tmp/ccrX1Zh9.o /tmp/cclfaLHH.s
GNU assembler version 2.21.1 (x86_64-suse-linux) using BFD version (GNU Binutils; openSUSE 12.1) 2.21.1
/tmp/cclfaLHH.s: Assembler messages:
/tmp/cclfaLHH.s:10: Error: bad register name `%rbp'
/tmp/cclfaLHH.s:12: Error: bad register name `%rsp'
/tmp/cclfaLHH.s:15: Error: bad register name `%rip)'
/tmp/cclfaLHH.s:17: Error: `movabs' is only supported in 64-bit mode
/tmp/cclfaLHH.s:20: Error: bad register name `%rip)'
/tmp/cclfaLHH.s:22: Error: bad register name `%rip)'
...
/tmp/cclfaLHH.s:67: Error: bad register name `%rbp)'




On the other hand, when I call gpc using its full path name, everything works as expected ...

trevor at linux-z54m:~/projects/gpc/gpc-20070904/p/demos> /usr/local/bin/gpc --verbose hello.pas 
Reading specs from /usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/specs
Configured with: ./configure --host=x86_64-suse-linux-gnu --build=x86_64-suse-linux-gnu --enable-languages=pascal --disable-mapped-location --enable-threads=posix --disable-nls --prefix=/usr/local/gpc --infodir=/usr/local/info --mandir=/usr/local/man
Thread model: posix
gpc version 20070904, based on gcc-3.4.6
 /usr/local/gpc/lib/gcc/x86_64-suse-linux-gnu/3.4.6/gpc1 -quiet -v hello.pas -quiet -dumpbase hello.pas -mtune=k8 -auxbase hello -famtmpfile=/tmp/ccVD338Z.gpa -version -o /tmp/ccxCBcyY.s
GNU Pascal version 20070904, based on gcc-3.4.6 (x86_64-suse-linux-gnu)
        compiled by GNU C version 3.4.6.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
GNU Pascal Compiler PreProcessor version 20070904, based on gcc-3.4.6

 as -V -Qy -o /tmp/ccBkjEYW.o /tmp/ccxCBcyY.s
GNU assembler version 2.21.1 (x86_64-suse-linux) using BFD version (GNU Binutils; openSUSE 12.1) 2.21.1
 ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/crtbegin.o -L/usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6 -L/usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/../../../../lib64 -L/usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 /tmp/ccBkjEYW.o -lgpc -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/crtend.o /usr/lib/../lib64/crtn.o
trevor at linux-z54m:~/projects/gpc/gpc-20070904/p/demos> ./a.out
Hello, world.
trevor at linux-z54m:~/projects/gpc/gpc-20070904/p/demos> 



Similar (but not identical) problem when I call gpc with no arguments:  When I omit the full pathname, gpc fails because it tries to link an empty file ...


trevor at linux-z54m:~/projects/gpc/gpc-20070904/p/demos> gpc --verbose
Reading specs from /usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/specs
Configured with: ./configure --host=x86_64-suse-linux-gnu --build=x86_64-suse-linux-gnu --enable-languages=pascal --disable-mapped-location --enable-threads=posix --disable-nls --prefix=/usr/local/gpc --infodir=/usr/local/info --mandir=/usr/local/man
Thread model: posix
gpc version 20070904, based on gcc-3.4.6
 ld --eh-frame-hdr -m elf_x86_64 -dynamic-linker /lib64/ld-linux-x86-64.so.2 /usr/lib/../lib64/crt1.o /usr/lib/../lib64/crti.o /usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/crtbegin.o -L/usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6 -L/usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/../../../../lib64 -L/usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/../../.. -L/lib/../lib64 -L/usr/lib/../lib64 --no-warn-search-mismatch -lgpc -lm -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/crtend.o /usr/lib/../lib64/crtn.o
/usr/lib/../lib64/crt1.o: In function `_start':
/home/abuild/rpmbuild/BUILD/glibc-2.14.1/csu/../sysdeps/x86_64/elf/start.S:109: undefined reference to `main'
trevor at linux-z54m:~/projects/gpc/gpc-20070904/p/demos> 



With a full pathname, gpc prints some version info and exits (as expected)


trevor at linux-z54m:~/projects/gpc/gpc-20070904/p/demos> /usr/local/bin/gpc --verbose
Reading specs from /usr/local/gpc/lib64/gcc/x86_64-suse-linux-gnu/3.4.6/specs
Configured with: ./configure --host=x86_64-suse-linux-gnu --build=x86_64-suse-linux-gnu --enable-languages=pascal --disable-mapped-location --enable-threads=posix --disable-nls --prefix=/usr/local/gpc --infodir=/usr/local/info --mandir=/usr/local/man
Thread model: posix
gpc version 20070904, based on gcc-3.4.6
trevor at linux-z54m:~/projects/gpc/gpc-20070904/p/demos>

Note:  /usr/local/bin/gpc is a link:   

trevor at linux-z54m:~/projects/gpc/gpc-20070904/p/demos> file /usr/local/bin/gpc
/usr/local/bin/gpc: symbolic link to `/usr/local/gpc/bin/gpc'
trevor at linux-z54m:~/projects/gpc/gpc-20070904/p/demos> 


Also,

trevor at linux-z54m:~/projects/gpc/gcc-3.4.6/gcc/p/test> uname -a
Linux linux-z54m 3.1.0-1.2-desktop #1 SMP PREEMPT Thu Nov 3 14:45:45 UTC 2011 (187dde0) x86_64 x86_64 x86_64 GNU/Linux
trevor at linux-z54m:~/projects/gpc/gcc-3.4.6/gcc/p/test> 


Also, calling gpc (ie in short form, not using full pathname) from a shell script works as expected, so the test scripts work.   Results copied below.
I built gpc on openSuSE 11.3using the same build process (as far as I know) and there were no problems.



OK, it's not a catastrophic failure, but I would like to fix it.
Does anyone know what causes this, and what I need to do about it?
Any ideas much appreciated.


Test summary:

                === gpc Summary ===

# of tests                5111
# of expected passes      5102
# of unexpected failures  7
# of unsupported tests    2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.g-n-u.de/pipermail/gpc/attachments/20120119/a3bc5f81/attachment.htm>


More information about the Gpc mailing list