Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2011-07

Gnu ld on Solaris

5 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ludo Brands

A while ago I reported the problems encountered with glib and libc when using lazarus on Solaris. Further testing shows that the problem isn't with glib and libc but gld creating apparently a non solaris ABI compatible program. In an fpc program linked with gld a libc malloc will always return a null pointer. The crashes encountered with glib and libc where also linked to malloc, called from g_malloc, returning a null pointer. Readelf -h on a gld linked program shows OS/ABI: UNIX - System V instead of UNIX - Solaris although gld's default script specifies an elf32-i386-sol2 target.

After manually crafting a ld command to use the solaris linker with info from link.res, the resulting program uses malloc without any problems... This explains also why gcc uses the solaris ld and why the corrupted default script in gld from the solaris 11 gnu-binutils hasn't made more noise. Recent Gnu ld postings on mailing lists indicate that gld is still work in progress and far from stable. Since gcc is happily using solaris ld, I guess the pressure to move on is low. So, I'm looking into modifying t_sunos.pas to use solaris ld. When converting link.res to something ld understood I have encoutered a few problems I need some help on:

- ld doesn't use the PATH nor the library paths (-R -L or -Y P,) to find the system.o, etc. All .o files are to be specified as relative or absolute path. Truss confirms this. Gcc also uses absolute paths when calling ld. Other than searching the unit paths in sunos_t.pas and creating the full path, any other suggestion?
- using {$ .res} raises undefined symbol FPC_RESSYMBOL. Where is it defined?

Thanks, Ludo

Reply by email

Jonas Maebe
to Ludo Brands
Ludo Brands wrote
progress and far from stable. Since gcc is happily using solaris ld, I guess the pressure to move on is low. So, I'm looking into modifying t_sunos.pas to use solaris ld. When converting link.res to something ld understood I have encoutered a few problems I need some help on:

FPC (in svn trunk) already supports using the native Solaris ld by using the -Xn parameter. It doesn't appear to be documented yet though.

Jonas

Reply by email

Ludo Brands
to Jonas Maebe
Show quoted text 5 lines
FPC (in svn trunk) already supports using the native Solaris ld by using the -Xn parameter. It doesn't appear to be documented yet though.

Just found that out from t_sunos.pas (cs_link_native in init_settings.globalswitches)...

Ludo

Reply by email

Mark Morgan Lloyd
to Ludo Brands
Ludo Brands wrote 6 lines
> FPC (in svn trunk) already supports using the native Solaris > ld by using the -Xn parameter. It doesn't appear to be > documented yet though. > 2.4.4 works also with -Xn

Thanks for that Ludo, I'm currently trying to get all systems here onto 2.4.4 as the stable version before going any further.

Mark Morgan Lloyd markMLl .AT. telemetry.co .DOT. uk [Opinions above are the author's, not those of his employers or colleagues]

Reply by email