public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/24863] New: New __attribute__((alias("target"))) requirement break aliasing assembler functions
@ 2005-11-14 21:47 arnold-j at t-online dot de
2005-11-14 21:49 ` [Bug c/24863] " arnold-j at t-online dot de
` (6 more replies)
0 siblings, 7 replies; 8+ messages in thread
From: arnold-j at t-online dot de @ 2005-11-14 21:47 UTC (permalink / raw)
To: gcc-bugs
The new requirement for (weak) symbol aliasing:
<Quote from GCC 4.0.x release notes>
Given __attribute__((alias("target"))) it is now an error if target is not a
symbol, defined in the same translation unit. This also applies to aliases
created by #pragma weak alias=target. This is because it's meaningless to
define
an alias to an undefined symbol. On Solaris, the native assembler would have
caught this error, but GNU as does not.
</Quote>
breaks compilation of code like this (example from an sh-elf target, but the
effect is architecture-independent):
extern __attribute__((weak,alias("UIE11"))) void NMI(void);
void UIE11 (void);
asm(
"_UIE11:\tbsr\t_UIE\n\tmov.l\t@r15+,r4\t\n"
);
which is perfectly valid and worked in all of gcc 3.0.x, gcc 3.3.x and gcc
3.4.x
--
Summary: New __attribute__((alias("target"))) requirement break
aliasing assembler functions
Product: gcc
Version: 4.0.2
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: arnold-j at t-online dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24863
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/24863] New __attribute__((alias("target"))) requirement break aliasing assembler functions
2005-11-14 21:47 [Bug c/24863] New: New __attribute__((alias("target"))) requirement break aliasing assembler functions arnold-j at t-online dot de
@ 2005-11-14 21:49 ` arnold-j at t-online dot de
2005-11-14 22:20 ` pinskia at gcc dot gnu dot org
` (5 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: arnold-j at t-online dot de @ 2005-11-14 21:49 UTC (permalink / raw)
To: gcc-bugs
--
arnold-j at t-online dot de changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|normal |major
GCC target triplet| |all
Keywords| |rejects-valid
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24863
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/24863] New __attribute__((alias("target"))) requirement break aliasing assembler functions
2005-11-14 21:47 [Bug c/24863] New: New __attribute__((alias("target"))) requirement break aliasing assembler functions arnold-j at t-online dot de
2005-11-14 21:49 ` [Bug c/24863] " arnold-j at t-online dot de
@ 2005-11-14 22:20 ` pinskia at gcc dot gnu dot org
2005-11-14 22:55 ` arnold-j at t-online dot de
` (4 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-14 22:20 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2005-11-14 22:19 -------
I don't think this is valid to do this, you are hiding away a lot of code.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24863
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/24863] New __attribute__((alias("target"))) requirement break aliasing assembler functions
2005-11-14 21:47 [Bug c/24863] New: New __attribute__((alias("target"))) requirement break aliasing assembler functions arnold-j at t-online dot de
2005-11-14 21:49 ` [Bug c/24863] " arnold-j at t-online dot de
2005-11-14 22:20 ` pinskia at gcc dot gnu dot org
@ 2005-11-14 22:55 ` arnold-j at t-online dot de
2005-11-14 23:02 ` pinskia at gcc dot gnu dot org
` (3 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: arnold-j at t-online dot de @ 2005-11-14 22:55 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from arnold-j at t-online dot de 2005-11-14 22:55 -------
I am indeed hiding a lot of code, but hopefully in order to pinpoint the issue.
This code snippet is taken from the rockbox project http://www.rockbox.org/ ,
precisely from
http://www.rockbox.org/viewcvs.cgi/firmware/system.c?annotate=1.73
Check lines 652-1019.
This is part of the exception handling on the SH1 target CPU. All exceptions
are
handled in one C handler function, UIE(). However, the only way to get the
exception number on SH1 is checking the called handler address, so all
exceptions that aren't handled by other code are handled by tiny assembler
snippets which just fetch their callee address and pass it to UIE(), which then
checks the address it was called from.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24863
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/24863] New __attribute__((alias("target"))) requirement break aliasing assembler functions
2005-11-14 21:47 [Bug c/24863] New: New __attribute__((alias("target"))) requirement break aliasing assembler functions arnold-j at t-online dot de
` (2 preceding siblings ...)
2005-11-14 22:55 ` arnold-j at t-online dot de
@ 2005-11-14 23:02 ` pinskia at gcc dot gnu dot org
2005-11-14 23:16 ` arnold-j at t-online dot de
` (2 subsequent siblings)
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-11-14 23:02 UTC (permalink / raw)
To: gcc-bugs
------- Comment #3 from pinskia at gcc dot gnu dot org 2005-11-14 23:02 -------
(In reply to comment #2)
This seems like a hack instead of using different files for the asm and C
function and then only link in the files which are needed.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24863
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/24863] New __attribute__((alias("target"))) requirement break aliasing assembler functions
2005-11-14 21:47 [Bug c/24863] New: New __attribute__((alias("target"))) requirement break aliasing assembler functions arnold-j at t-online dot de
` (3 preceding siblings ...)
2005-11-14 23:02 ` pinskia at gcc dot gnu dot org
@ 2005-11-14 23:16 ` arnold-j at t-online dot de
2006-04-26 21:12 ` pinskia at gcc dot gnu dot org
2009-03-30 1:19 ` jsm28 at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: arnold-j at t-online dot de @ 2005-11-14 23:16 UTC (permalink / raw)
To: gcc-bugs
------- Comment #4 from arnold-j at t-online dot de 2005-11-14 23:16 -------
How do you mean, it seems like a hack? Obviously we can't put the asm in a
different file, because then the symbols would clearly be defined in a
different translation unit. As-is they are not, but gcc 4.0.x errors because it
doesn't see the symbols in the inline asm.
There are two main points which require the code to work like it does:
(1) As mentioned, the exception number can only be derived from the called
address. UIE() is there to catch all unexpected interrupts and exceptions, i.e.
those for which there are no specific handlers. That's why all _UIE##number
symbols are defined in the asm block, in a regular structure that allows to
compute the vector number from the called address easily.
(2) We need to weak-alias these asm symbols because they should only be used
when there is no dedicated handler for the specific interrupt or exception
defined in any other source file. Perhaps it would be possible to hard code
which handlers are implemented elsewhere and which are not, but that would be
rather hard to maintain.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24863
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/24863] New __attribute__((alias("target"))) requirement break aliasing assembler functions
2005-11-14 21:47 [Bug c/24863] New: New __attribute__((alias("target"))) requirement break aliasing assembler functions arnold-j at t-online dot de
` (4 preceding siblings ...)
2005-11-14 23:16 ` arnold-j at t-online dot de
@ 2006-04-26 21:12 ` pinskia at gcc dot gnu dot org
2009-03-30 1:19 ` jsm28 at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2006-04-26 21:12 UTC (permalink / raw)
To: gcc-bugs
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|major |normal
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24863
^ permalink raw reply [flat|nested] 8+ messages in thread
* [Bug c/24863] New __attribute__((alias("target"))) requirement break aliasing assembler functions
2005-11-14 21:47 [Bug c/24863] New: New __attribute__((alias("target"))) requirement break aliasing assembler functions arnold-j at t-online dot de
` (5 preceding siblings ...)
2006-04-26 21:12 ` pinskia at gcc dot gnu dot org
@ 2009-03-30 1:19 ` jsm28 at gcc dot gnu dot org
6 siblings, 0 replies; 8+ messages in thread
From: jsm28 at gcc dot gnu dot org @ 2009-03-30 1:19 UTC (permalink / raw)
To: gcc-bugs
------- Comment #5 from jsm28 at gcc dot gnu dot org 2009-03-30 01:19 -------
I think it's correct for the compiler to reject this and require that you
make the function definition visible to the compiler. You can do that using
a naked function; if naked functions aren't supported for your target, that's
a separate feature request for that target to add support for that attribute.
--
jsm28 at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24863
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-03-30 1:19 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-14 21:47 [Bug c/24863] New: New __attribute__((alias("target"))) requirement break aliasing assembler functions arnold-j at t-online dot de
2005-11-14 21:49 ` [Bug c/24863] " arnold-j at t-online dot de
2005-11-14 22:20 ` pinskia at gcc dot gnu dot org
2005-11-14 22:55 ` arnold-j at t-online dot de
2005-11-14 23:02 ` pinskia at gcc dot gnu dot org
2005-11-14 23:16 ` arnold-j at t-online dot de
2006-04-26 21:12 ` pinskia at gcc dot gnu dot org
2009-03-30 1:19 ` jsm28 at gcc dot gnu dot org
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).