Ian Lance Taylor | 1 Jun 08:24 2010
Picon

Re: Relative imports and GNU linker... ?

Trojany <troianor <at> trash-mail.com> writes:

> That new language has a feature which I'm not sure about whether and how it
> can be done with gnu linker:
> In that language it is allowed, when importing symbols from other source
> files, to explicitly specify which imported symbol comes from which source
> file.

That's a tough one.  I faced a similar issue with Go.  Go permits
multiple packages in a single executable with the same name.  Simple
name mangling rule cause collisions in such a case.  For Go, I wimped
out: I added a -fgo-prefix option to the compiler which essentially
sets the name to use.  This name is then recorded in the exported
information, so that other packages which import that package know the
symbol names to use.

Another approach I considered was to give each package a UUID and use
that in the names.  This has the disadvantage of making debugging
harder.

Both these approaches assume that at compile time there is some way to
discover the naming convention used by an imported package.  I don't
know if that is true of your language.

In general, you will need a naming trick of this sort to make your
import statements work with the GNU linker.  The GNU linker does not
rename symbols on the fly.

Ian

(Continue reading)

Ian Lance Taylor | 1 Jun 08:38 2010
Picon

Re: get current core id

fozzie <david_aiken <at> yahoo.com> writes:

> Does anyone know if it is possible to get the ID of the core which is
> executing code at a given point in a C++ program? I'm running code built
> using gcc 4.4.1 on Ubuntu Koala 64-bit with an Intel core 2 quad and would
> like to see whether external code calling a function in a shared library is
> making use of multiple cores.

This isn't a gcc question.  The compiler doesn't know anything about
different cores.  I say this not to chastise you, but to let you know
that you are more likely to get the answer if you ask on a more
appropriate forum.  The answer may be operating system specific.

I don't know the answer myself.

Ian

Ian Lance Taylor | 1 Jun 08:40 2010
Picon

Re: extended asm - memory constraint

mc2718 <mc2718 <at> gmail.com> writes:

>  i)  : "=m" (res)      

I would expect something like "=&m" (res), listed as an output, to
work.  If that doesn't work, can you show the entire insn?

Ian

Ian Lance Taylor | 1 Jun 08:49 2010
Picon

Re: Strict-aliasing in GCC

Jan Engelhardt <jengelh <at> medozas.de> writes:

> In http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43637 , I had a case 
> where I apparently ran into strict-aliasing artifacts. As Richard 
> Guenther points out in comment #2, I may have dereferenced through a 
> pointer of wrong type. Yet I could not quite spot that yet as I added in 
> comment #3.
> If somebody has a deeper insight into C's spots of undefinedness, a 
> reply would be greatly appreciated.

#ifndef containerof
#	define containerof(var, type, member) \
		(type *)((char *)var - offsetof(type, member))
#endif

#define list_entry(ptr, type, member) containerof((ptr), type, member)

struct list_head {
	struct list_head *next, *prev;
};

#define LIST_HEAD_INIT(name) {&(name), &(name)}
#define LIST_HEAD(name) \
	struct list_head name = LIST_HEAD_INIT(name)

...

#define list_for_each_entry(pos, head, member) \
	for ((pos) = list_entry((head)->next, typeof(*(pos)), member); \
	     &(pos)->member != (void *)(head); \
(Continue reading)

Ian Lance Taylor | 1 Jun 08:51 2010
Picon

Re: Option not supported error in GCC cross compilation

Xiao-lei Cui <climber.cui <at> gmail.com> writes:

>     Thanks. If I am trying to build a cross GCC 3.4 (sparc-coff). Do I
> need to firstly build a sparc-coff GNU binutils before that?

Yes.

> Since
> gcc3.4.6 is a rather old release, which release of GNU binutils would
> do such a job?

The GNU binutils still support sparc-coff, so any version should do.

Ian

Ian Lance Taylor | 1 Jun 08:55 2010
Picon

Re: Warn for certain integer overflows

Frank Mehnert <Frank.Mehnert <at> Sun.COM> writes:

> consider the following case:
>
>   uint32_t foo, bar;
>   ...
>   foo = bar << 20;
>
> Of course, this operation can overflow and warning about this
> probably does not make sense as the programmer should be aware
> of this case. However, a warning in the following case could be
> appropriate IMO:
>
>   uint32_t bar;
>   uint64_t foo;
>   ...
>   foo = bar << 20;
>
> The intension is to catch the overflow case, therefore the
> assignment to a 64-bit variable. The intended code would be
>
>   uint32_t bar;
>   uint64_t foo;
>   ...
>   foo = (uint64_t)bar << 20;
>
> I think it would be a big help if gcc could warn in the 2nd case.
>
> What do you think? Or is such a warning already available? I'm
> a big fan of -Wlogical-op which catches suspicious uses of certain
(Continue reading)

Axel Freyn | 1 Jun 09:49 2010
Picon
Picon

Re: get current core id

Hello,
> 
> > Does anyone know if it is possible to get the ID of the core which is
> > executing code at a given point in a C++ program? I'm running code built
> > using gcc 4.4.1 on Ubuntu Koala 64-bit with an Intel core 2 quad and would
> > like to see whether external code calling a function in a shared library is
> > making use of multiple cores.
> 
> This isn't a gcc question.  The compiler doesn't know anything about
> different cores.  I say this not to chastise you, but to let you know
> that you are more likely to get the answer if you ask on a more
> appropriate forum.  The answer may be operating system specific.
I don't know a system-independent solution, however on Linux the easiest
way is probably to read it from /proc/PID/stat. It should be the
column 39 (?) - see "man 5 proc":
processor %d (since Linux 2.2.8)
       CPU number last executed on.
But I'm not sure whether you can get this information also for multiple
threads sharing the same process-ID? That might depend on the threading
library used.

Axel

Kai Ruottu | 1 Jun 11:09 2010

Re: Option not supported error in GCC cross compilation

Xiao-lei Cui<climber.cui <at> gmail.com>  writes:
>
>> I am building a coff-gcc to fulfill some requirements at work.
>> The tool chain we are trying to develop based on GCC needs to
>> support coff format on SPARC V7/V8.

This requirement puts one to think the ESA/ESTEC ERC32 CPU, the
commercial "XGC" GCC maybe used COFF with SPARC. It is hard to
remember any other toolchain where coff-sparc could have been
used as the default format...

>> I forgot to mention that the version I am trying to build is
>> GCC-3.4.6, and the native GCC on my Linux is version 4.1.

The gcc-3.4.6 doesn't support 'sparc-coff' as target, it should support
'sparclite-coff' but that will fail because of a bug. The earlier 3.3.6
too :(

> Ian Lance Taylor writes:
>
> As far as I know gcc 3.4.6 should support sparc-coff.

Probably 'sparc-coff' was never supported in the FSF GCC
sources :(

Generally the clause "needs to support coff format on SPARC V7/V8"
would require more elaboration...

The ESA/ESTEC ERC32 CPU ("radiation hardened") used RTEMS, so the
usual $target name was 'sparc-rtems', not 'sparc-aout', 'sparc-coff'
(Continue reading)

fozzie | 1 Jun 11:12 2010
Picon

Re: get current core id


ok.. evidently the wrong forum. I'll ask elsewhere.
--

-- 
View this message in context: http://old.nabble.com/get-current-core-id-tp28724562p28739342.html
Sent from the gcc - Help mailing list archive at Nabble.com.

christophe.jarry | 1 Jun 13:12 2010

GCC documentation in .info

> christophe.jarry <at> ouvaton.org writes:
>
>> I browsed your html documentation at http://gcc.gnu.org/onlinedocs/
>> and would like to know if there is a way to obtain GCC documentation
>> in .info format from your website, as is proposed by almost all other
>> software projects from GNU (see
>> http://www.gnu.org/software/gawk/manual/ for example).
>
> This message would be more appropriate for the mailing list
> gcc-help <at> gcc.gnu.org.  Please take any followups to gcc-help.
> Thanks.
>
> The gcc .info files are not currently distributed separately.  They
> are included if you download a gcc release.
>
> Ian

Why doesn't GCC make its documentation in .info format available on  
its website, while almost all other software projects from GNU (see  
http://www.gnu.org/software/gawk/manual/ for example), do?

Christophe

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


Gmane