Red Hat axp-list: Linux on Alpha (1995-2022)
 help / color / mirror / Atom feed
From: jkmccarthy at pacbell.net (Jim McCarthy)
Subject: Best practice in C to support 64-bit or 32-bit address length with same source file ?
Date: Sat, 3 May 2008 12:20:40 -0700	[thread overview]
Message-ID: <EHEJKJMDHFLPCNPFAMOKOEJAMEAA.jkmccarthy@pacbell.net> (raw)
In-Reply-To: <EHEJKJMDHFLPCNPFAMOKEENNLOAA.jkmccarthy@pacbell.net>

In the thread "RE: Broken dbus" Jay Estabrook wrote:
>> Nyah, what's up Doc?
>
> Same old, same old; doing mostly Opteron, some IA64 Linux for
> clusters these days, mostly kernel support but whatever needs
> doing. Keeping my hand in WRT supporting Alpha Linux as time
> allows.

Jay (or anyone) --

Just recently I've gained access to an HP zx6000 Itanium-2 workstation,
running Scientific Linux for ia64 [a free distro built on RHEL4 sources],
and I have also noticed the recent announcement of FC9 beta for ia64 ... but
it seems there is no "ld -taso" linker option on ia64 Linux :-(meaning the C
source codes I use _will_ require some work, if I want to run on that
platform )-:

As I get into modifying C source code on Alpha Linux to enforce 64-bit
pointer address lengths, rather than have modified source code that _only_
works on 64-bit machines separate from source code that _only_ works on
32-bit machines, it seems preferable to insert branches in the code as
needed to support either architecture (certainly this is NOT a new/original
idea :-).  But what is the proper compiler -D<flag> to test against that
would also work identically on ia64 Linux ?  Granted I'm free (I think) to
invent a flag with any name I choose, but is there a widely-used convention
I should follow ?

Namely, what is the commonly accepted "best practice" for branching in C
code using

> #ifdef _______
>    ...treat address pointers as 64-bit...
> #else
>    ...treat address pointers as 32-bit...
> #endif

that would work most transparently on Alpha Linux _and_ ia64 Linux ?  (i.e.,
what -D<flag> should I test against at "______" above ?)  Or is it better to
insert C code that branches (during execution?) based on some test involving
sizeof( ) ... or maybe instead use sizeof( ) somehow in declarations so any
integers equated to address pointers get declared appropriately for either
32-bit or 64-bit architectures ?

I'd appreciate any expert opinions and/or code fragment examples of how best
to implement this (given the myriad of possibilities a novice in my position
might come up with ...).

Thanks,

     -- Jim


-----Original Message-----
From: Jim McCarthy
Sent: Tuesday, April 22, 2008 11:23 PM
To: axp-list at redhat.com
Subject: FC 8 on Alpha question: GNU linker "ld -taso" option?

<snip>

Arguably this would be "good medicine" and motivation to properly upgrade
the IA32 data analysis package's source codes to allow (enforce) 64-bit
pointers on all 64-bit architectures (Alpha, ia64 = Itanium, AMD64, EM64T,
etc.) -- a very sizeable effort [somewhere between "daunting" and
"monumental" for me by myself] but one that would no doubt pay future
dividends....  Still, I'd appreciate knowing if in the meantime the new FC 8
on Alpha might have the "-taso" shortcut I could use to get up-and-running
quickly after upgrading from RH7.2 Alpha.

Thanks,

     -- Jim
_________________________________________
axp-list mailing list
axp-list at redhat.com
https://www.redhat.com/mailman/listinfo/axp-list



  parent reply	other threads:[~2008-05-03 19:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-04-23  6:23 FC 8 on Alpha question: GNU linker "ld -taso" option? jkmccarthy
2008-04-23  9:24 ` oliver
2008-04-24  1:32 ` rm.riches
2008-05-03 19:20 ` jkmccarthy [this message]
2008-05-03 20:49   ` Best practice in C to support 64-bit or 32-bit address length with same source file ? davis
2008-05-04 15:05     ` raeburn
2008-05-04 16:38       ` davis
2008-05-05  1:25         ` raeburn
2008-05-03 23:03   ` Jay.Estabrook
2008-05-04 15:13     ` raeburn
read-only archive

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox