View Issue Details

IDProjectCategoryView StatusLast Update
0014192FPCCompilerpublic2009-08-26 22:19
ReporterPierre PedeAssigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
PlatformlinuxOSCentosOS Version5.3
Product Version2.3.1Product Build13440 
Target VersionFixed in Version 
Summary0014192: ppdep.pp - unresolvable R_386_32 relocation against symbol `DEBUGINFO_SYSTEM'
DescriptionWhen i try to build utils shared i got the following error:

---<schnipp>---
make -C utils shared
make[2]: Entering directory `/home/daily/build/fpc/utils'
make all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
make[3]: Entering directory `/home/daily/build/fpc/utils'
/bin/mkdir -p units/i386-linux
/home/daily/build/fpc/compiler/ppc386 -CX -gl -Fu/home/daily/build/fpc/rtl/units/i386-linux -Fu/home/daily/build/fpc/packages/fcl-base/units/i386-linux -Fu/home/daily/build/fpc/packages/hash/units/i386-linux -Fu/home/daily/build/fpc/packages/paszlib/units/i386-linux -FE. -FUunits/i386-linux -Cg -Aas -XD -di386 -dDEBUG ppdep.pp
/usr/bin/ar: creating units/i386-linux/libpppdep.a
/usr/bin/ld: units/i386-linux/ppdep.o(.fpc+0xc): unresolvable R_386_32 relocation against symbol `DEBUGINFO_SYSTEM'
/usr/bin/ld: final link failed: Nonrepresentable section on output
ppdep.pp(524,90) Error: Error while linking
ppdep.pp(524,90) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
make[3]: *** [ppdep] Fehler 1
make[3]: Leaving directory `/home/daily/build/fpc/utils'
make[2]: *** [fpc_shared] Fehler 2
make[2]: Leaving directory `/home/daily/build/fpc/utils'
make[1]: *** [utils_shared] Fehler 2
make[1]: Leaving directory `/home/daily/build/fpc'
make: *** [other.build-stamp.i386-linux] Fehler 2
---<schnapp>---

Any idea to check where R_386_32 comes from ?
Tagsdynamic library
Fixed in Revision
FPCOldBugId
FPCTarget
Attached Files

Activities

Pierre Pede

2009-08-22 19:12

reporter   ~0030078

Please close with "wontfix" if you also think that
>>make all CREATESHARED=1 LINKSHARED=1 CREATESMART=1
is wrong.

Jonas Maebe

2009-08-23 00:21

manager   ~0030087

I don't think it's wrong. Smart linking can still be useful together with shared linking, e.g., for implementation-only procedures that are not called for some reason (e.g., only if some define is active).

It's also quite strange that you get the error for ppdep, but apparently not for the compiler itself (or is the compiler not compiled against a shared rtl?)

Pierre Pede

2009-08-23 17:06

reporter   ~0030098

Last edited: 2009-08-23 17:07

i think compiler is build with static rtl in compiler cycle. ppdep is utils package, so should not be a problem.

ok, when it it not wrong then go in detail. (I got the same error when try to link lazarus with rtl that is build shared and smart, shared only does work)

summary:

program ppdep is a simple program from utils package. when build with "make all CREATESHARED=1 LINKSHARED=1 CREATESMART=1" smart linker is not able to find DEBUGINFO_SYSTEM.

When look though object file relocations i could see the following:

---<schnipp>---
...
ppdep0s14.o: file format elf32-i386

RELOCATION RECORDS FOR [.text]:
OFFSET TYPE VALUE
00000010 R_386_GOTPC _GLOBAL_OFFSET_TABLE_
00000015 R_386_PLT32 FPC_INITIALIZEUNITS
0000001a R_386_PLT32 P$PPDEP_GETPARA
00000020 R_386_GOT32 U_P$PPDEP_PARAFILE
00000025 R_386_PLT32 P$PPDEP_LISTDEPEND$SHORTSTRING
0000002a R_386_PLT32 P$PPDEP_SHOWDEPEND
0000002f R_386_PLT32 FPC_DO_EXIT


RELOCATION RECORDS FOR [.stab]:
OFFSET TYPE VALUE
00000014 R_386_32 main
00000020 R_386_32 .text


RELOCATION RECORDS FOR [.fpc]:
OFFSET TYPE VALUE
00000000 R_386_32 DEBUGINFO_P$PPDEP
00000004 R_386_32 DEBUGSTART_P$PPDEP
00000008 R_386_32 DEBUGEND_P$PPDEP
0000000c R_386_32 DEBUGINFO_SYSTEM
00000010 R_386_32 DEBUGSTART_SYSTEM
00000014 R_386_32 DEBUGEND_SYSTEM
...
---<schnapp>---

where i have to look for the DEBUGINFO_SYSTEM export ?

Jonas Maebe

2009-08-23 17:12

manager   ~0030100

It's a hack to keep the debug info from being "smart linked" out, since normally it's not referred from anywhere so the linker could throw it away.

The creation of the DEBUGINFO symbols and the table that references them is in dbgstabs.pas (search for DEBUGINFO)

I think it would be easier and cleaner to simply disable smart linking if debugging information is desired.

Pierre Pede

2009-08-26 20:48

reporter   ~0030182

It't not clear to me why this hack is needed. But it's ok for my to disable smartlinking when debug is enabled. i will play in this direction.

Jonas Maebe

2009-08-26 21:05

manager   ~0030183

It's necessary because "smart linking" means "throw away everything that is not reachable when recursively following all code and data references starting from the program's entry point". Debug information is not referred at all from the code/data, and hence can always be thrown away. It's possibly due to the way smart linking has been traditionally emulated by FPC, by placing every global symbol in a separate object file. Maybe it's not necessary anymore when the internal linker is used (on Windows), or when the --gc-sections option of ld is used instead.

Also, it may not be feasible to disable smart linking when generating debug information, because some units require smart linking. The only one I know of is the windows unit, but there may be more.

Pierre Pede

2009-08-26 22:19

reporter   ~0030186

Could it be that the problem is a other one ? If you have a look on snap from this issue the problem does occur when trying to link smart object files ( i think against libfprtl-2.3.1.so - but i am not sure ). In my understanding this is smart creating (-CX) and not smart linking (-XC).

If i dump symbols from libfprtl-2.3.1.so i can see that DEBUGINFO_SYSTEM is missing but i can see others like DEBUGINFO_EXEINFO and all others from rtl.

If the time comes i try to dig deeper.

Issue History

Date Modified Username Field Change
2009-07-25 17:15 Pierre Pede New Issue
2009-08-22 19:12 Pierre Pede Note Added: 0030078
2009-08-23 00:21 Jonas Maebe Note Added: 0030087
2009-08-23 17:06 Pierre Pede Note Added: 0030098
2009-08-23 17:07 Pierre Pede Note Edited: 0030098
2009-08-23 17:12 Jonas Maebe Note Added: 0030100
2009-08-26 20:48 Pierre Pede Note Added: 0030182
2009-08-26 21:05 Jonas Maebe Note Added: 0030183
2009-08-26 22:19 Pierre Pede Note Added: 0030186
2009-11-11 21:47 Marco van de Voort Tag Attached: dynamic library