public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Configuration issues on Itanium VMS
@ 2004-11-10 12:15 Richard Kenner
  2004-11-10 19:06 ` Zack Weinberg
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Kenner @ 2004-11-10 12:15 UTC (permalink / raw)
  To: zack; +Cc: gcc

    > Wouldn't it be *much* easier just to force GCC to include the
    > system-supplied file that has all the proper definitions with prototypes?

    No.

Why?  Writing a program to get all the names of the functions to handle
specially isn't at all trivial and you don't get the prototypes.

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Configuration issues on Itanium VMS
  2004-11-10 12:15 Configuration issues on Itanium VMS Richard Kenner
@ 2004-11-10 19:06 ` Zack Weinberg
  2004-11-11 15:15   ` Geert Bosch
  0 siblings, 1 reply; 10+ messages in thread
From: Zack Weinberg @ 2004-11-10 19:06 UTC (permalink / raw)
  To: Richard Kenner; +Cc: gcc

kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:

>     > Wouldn't it be *much* easier just to force GCC to include the
>     > system-supplied file that has all the proper definitions with
>     > prototypes?
>
>     No.
>
> Why?  Writing a program to get all the names of the functions to
> handle specially isn't at all trivial and you don't get the
> prototypes.

It makes the entire C library visible even if you don't include the
headers.  This breaks real code.  It's even worse in C++ where the
library isn't supposed to be in the global namespace normally.

I suppose it would be _easier_, but it would still be _wrong_.

zw

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Configuration issues on Itanium VMS
  2004-11-10 19:06 ` Zack Weinberg
@ 2004-11-11 15:15   ` Geert Bosch
  0 siblings, 0 replies; 10+ messages in thread
From: Geert Bosch @ 2004-11-11 15:15 UTC (permalink / raw)
  To: Zack Weinberg; +Cc: gcc, Richard Kenner


On Nov 10, 2004, at 13:44, Zack Weinberg wrote:
> It makes the entire C library visible even if you don't include the
> headers.  This breaks real code.  It's even worse in C++ where the
> library isn't supposed to be in the global namespace normally.
>
> I suppose it would be _easier_, but it would still be _wrong_.

Thanks for the explanation.

   -Geert

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Configuration issues on Itanium VMS
  2004-11-10  2:41 Richard Kenner
@ 2004-11-10  7:59 ` Zack Weinberg
  0 siblings, 0 replies; 10+ messages in thread
From: Zack Weinberg @ 2004-11-10  7:59 UTC (permalink / raw)
  To: Richard Kenner; +Cc: gcc

kenner@vlsi1.ultra.nyu.edu (Richard Kenner) writes:

>     It would be better to provide accurate prototypes for them whenever
>     possible, but I recognize that this is intractable in some cases
>     (e.g. those involving FILE*).
>
> Wouldn't it be *much* easier just to force GCC to include the
> system-supplied file that has all the proper definitions with prototypes?

No.

zw

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Configuration issues on Itanium VMS
@ 2004-11-10  2:41 Richard Kenner
  2004-11-10  7:59 ` Zack Weinberg
  0 siblings, 1 reply; 10+ messages in thread
From: Richard Kenner @ 2004-11-10  2:41 UTC (permalink / raw)
  To: zack; +Cc: gcc

    It would be better to provide accurate prototypes for them whenever
    possible, but I recognize that this is intractable in some cases
    (e.g. those involving FILE*).

Wouldn't it be *much* easier just to force GCC to include the
system-supplied file that has all the proper definitions with prototypes?

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Configuration issues on Itanium VMS
  2004-11-10  0:52     ` Douglas B Rupp
@ 2004-11-10  1:33       ` Zack Weinberg
  0 siblings, 0 replies; 10+ messages in thread
From: Zack Weinberg @ 2004-11-10  1:33 UTC (permalink / raw)
  To: Douglas B Rupp; +Cc: Joseph S. Myers, gcc

"Douglas B Rupp" <rupp@gnat.com> writes:

>> The TARGET_INIT_BUILTINS hook could, perhaps, be used to construct
>> invisible declarations for every function that requires a prefix (or
>> augment the invisible declarations for the functions that already have
>> them), setting DECL_ASSEMBLER_NAME appropriately.
>
> Something like this?  It seems to work OK for functions that are not
> listed in builtins.def For those functions, e.g. memmove, my new
> libname gets overwritten/ignored when the builtin is "built" Not
> sure how to fix that...

Something like that, yes.  You should be using
lang_hooks.builtin_function instead of calling build_decl and pushdecl
directly.  For functions not already in builtins.def, a call similar
to

  lang_hooks.builtin_function (name, type, *, BUILT_IN_NORMAL, libname, 0);

should suffice.  [I am not sure what ought to go in the slot marked
with an *.]

It would be better to provide accurate prototypes for them whenever
possible, but I recognize that this is intractable in some cases
(e.g. those involving FILE*).

To deal properly with builtins with a target-independent meaning, I
think you should be able to call identifier_global_value at this
point, and if it returns something, just set its DECL_ASSEMBLER_NAME
rather than creating a new decl.  Note that this may cause link errors
in front ends other than C/C++/ObjC - the appropriate thing would be
to turn i_g_v into a langhook.

zw

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Configuration issues on Itanium VMS
  2004-11-08 18:55   ` Zack Weinberg
@ 2004-11-10  0:52     ` Douglas B Rupp
  2004-11-10  1:33       ` Zack Weinberg
  0 siblings, 1 reply; 10+ messages in thread
From: Douglas B Rupp @ 2004-11-10  0:52 UTC (permalink / raw)
  To: Joseph S. Myers, Zack Weinberg; +Cc: gcc

> The TARGET_INIT_BUILTINS hook could, perhaps, be used to construct
> invisible declarations for every function that requires a prefix (or
> augment the invisible declarations for the functions that already have
> them), setting DECL_ASSEMBLER_NAME appropriately.

Something like this?
It seems to work OK for functions that are not listed in builtins.def
For those functions, e.g. memmove, my new libname gets overwritten/ignored 
when the builtin is "built"
Not sure how to fix that...

--------------

/* Initialize the assembler name of function NAME to LIBNAME */

static void
vms_init_library_name (name, libname, type)
     const char *name, *libname;
     tree type;
{
  rtx symbol;
  tree decl
    = build_decl (FUNCTION_DECL, get_identifier (name),
    build_function_type (type, NULL_TREE));

  SET_DECL_ASSEMBLER_NAME (decl, get_identifier (libname));
  DECL_ARTIFICIAL (decl) = 1;
  DECL_EXTERNAL (decl) = 1;
  TREE_PUBLIC (decl) = 1;
  pushdecl (decl);
  make_decl_rtl (decl, NULL);
  symbol = XEXP (DECL_RTL (decl), 0);
  SYMBOL_REF_DECL (symbol) = 0;
}

void
ia64_init_builtins (void)
{
...
  vms_init_library_name ("memmove", "decc$memmove", ptr_type_node);
}

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Configuration issues on Itanium VMS
  2004-11-08 18:53 ` Joseph S. Myers
@ 2004-11-08 18:55   ` Zack Weinberg
  2004-11-10  0:52     ` Douglas B Rupp
  0 siblings, 1 reply; 10+ messages in thread
From: Zack Weinberg @ 2004-11-08 18:55 UTC (permalink / raw)
  To: Joseph S. Myers; +Cc: Douglas B Rupp, gcc

"Joseph S. Myers" <joseph@codesourcery.com> writes:

> On Mon, 8 Nov 2004, Douglas B Rupp wrote:
>
>> Configure, e.g. libiberty/configure,  generates conftest programs to decide if
>> particular CRTL functions exist in the host. If the compile or link is
>> unsucessful, e.g. undefined symbols in the link, then the function is
>> assumed not to exist.  *Configure doesn't bother to include the necessary
>> header files in the programs it generates, so all CRTL functions show up as
>> undefined with Gcc*.
>
> Standard C and POSIX say that you don't need to include the headers to use 
> standard functions which can be used without using any type defined in a 
> header, so requiring headers to be included is a bug in the GCC 
> configuration.  That doesn't mean it's easy to fix in GCC.

The TARGET_INIT_BUILTINS hook could, perhaps, be used to construct
invisible declarations for every function that requires a prefix (or
augment the invisible declarations for the functions that already have
them), setting DECL_ASSEMBLER_NAME appropriately.

zw

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: Configuration issues on Itanium VMS
  2004-11-08 18:44 Douglas B Rupp
@ 2004-11-08 18:53 ` Joseph S. Myers
  2004-11-08 18:55   ` Zack Weinberg
  0 siblings, 1 reply; 10+ messages in thread
From: Joseph S. Myers @ 2004-11-08 18:53 UTC (permalink / raw)
  To: Douglas B Rupp; +Cc: gcc

On Mon, 8 Nov 2004, Douglas B Rupp wrote:

> Configure, e.g. libiberty/configure,  generates conftest programs to decide if
> particular CRTL functions exist in the host. If the compile or link is
> unsucessful, e.g. undefined symbols in the link, then the function is
> assumed not to exist.  *Configure doesn't bother to include the necessary
> header files in the programs it generates, so all CRTL functions show up as
> undefined with Gcc*.

Standard C and POSIX say that you don't need to include the headers to use 
standard functions which can be used without using any type defined in a 
header, so requiring headers to be included is a bug in the GCC 
configuration.  That doesn't mean it's easy to fix in GCC.

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    joseph@codesourcery.com (CodeSourcery mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Configuration issues on Itanium VMS
@ 2004-11-08 18:44 Douglas B Rupp
  2004-11-08 18:53 ` Joseph S. Myers
  0 siblings, 1 reply; 10+ messages in thread
From: Douglas B Rupp @ 2004-11-08 18:44 UTC (permalink / raw)
  To: gcc

My current problem is with a cross native build, aka
build=alpha-dec-openvms7_1
host=ia64-hp-openvms8_0
target=ia64-hp-openvms8_0
but the same issue will occur regardless of build machine for this host.
Gcc version 3.4.2 (patched)

On VMS, all CRTL function symbols are prefixed, usually by "decc$".  The
HP VMS C  compiler handles this via an internal mechanism. However Gcc
has to have the  proper header file included to add the prefix via an asm 
state-
ment.  On  Alpha/VMS there is a VAX compatibility library that resolves the
function if  the header file is not included. This compatibility library is 
some-
thing of  a kludge and doesn't exist on Itanium VMS.

Configure, e.g. libiberty/configure,  generates conftest programs to decide 
if
particular CRTL functions exist in the host. If the compile or link is
unsucessful, e.g. undefined symbols in the link, then the function is
assumed not to exist.  *Configure doesn't bother to include the necessary
header files in the programs it generates, so all CRTL functions show up as
undefined with Gcc*.

The alternatives are to teach Gcc to add the proper prefix to all CRTL
functions or to teach configure to include the proper header files when
testing for CRTL functions.

Any thoughts on which alternative would be best, or other alternatives?

--Douglas Rupp
Ada Core Technologies, Inc 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-11-11 15:09 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-11-10 12:15 Configuration issues on Itanium VMS Richard Kenner
2004-11-10 19:06 ` Zack Weinberg
2004-11-11 15:15   ` Geert Bosch
  -- strict thread matches above, loose matches on Subject: below --
2004-11-10  2:41 Richard Kenner
2004-11-10  7:59 ` Zack Weinberg
2004-11-08 18:44 Douglas B Rupp
2004-11-08 18:53 ` Joseph S. Myers
2004-11-08 18:55   ` Zack Weinberg
2004-11-10  0:52     ` Douglas B Rupp
2004-11-10  1:33       ` Zack Weinberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).