public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/101766] New: Microblaze gcc misses symver but __has_attribute(symver) returns true
@ 2021-08-03 20:03 giulio.benetti at benettiengineering dot com
  2021-08-03 20:16 ` [Bug c/101766] " pinskia at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: giulio.benetti at benettiengineering dot com @ 2021-08-03 20:03 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766

            Bug ID: 101766
           Summary: Microblaze gcc misses symver but
                    __has_attribute(symver) returns true
           Product: gcc
           Version: 10.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: giulio.benetti at benettiengineering dot com
  Target Milestone: ---

Microblaze gcc can't use .symver attribute leading to:
error: symver is only supported on ELF platforms

This is a simple test-case(taken from libfuse3) that reproduce the problem:
'''
# if !__has_attribute (symver)
# error symver attribute not supported
# endif
#else
#error __has_attribute not defined, assume we do not have symver
#endif

__attribute__ ((symver ("fuse_new@FUSE_3.0")))
void func1(void)
{

}

int main(void) {
    return 0;
}

'''
The problem is the discrepancy I've found between __has_attribute(symver)
that return true, while in gcc/gcc/config.gcc 'elfos.h' is not listed under
Microblaze cases. Trying adding elfos.h to it leads to other linker problems
and this makes me think that Microblaze doesn't actually support
__ELF__(symver).
So I thought to build gcc using --disable-symvers explictly until a fix is
found, but that doesn't either work.

Can you please give help?

Thanks a lot!

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

* [Bug c/101766] Microblaze gcc misses symver but __has_attribute(symver) returns true
  2021-08-03 20:03 [Bug c/101766] New: Microblaze gcc misses symver but __has_attribute(symver) returns true giulio.benetti at benettiengineering dot com
@ 2021-08-03 20:16 ` pinskia at gcc dot gnu.org
  2021-08-03 21:30 ` giulio.benetti at benettiengineering dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-03 20:16 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
__has_attribute is broken for many attributes.  If GCC supports them in a
generic way but does not really support them, __has_attribute still returns
true.

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

* [Bug c/101766] Microblaze gcc misses symver but __has_attribute(symver) returns true
  2021-08-03 20:03 [Bug c/101766] New: Microblaze gcc misses symver but __has_attribute(symver) returns true giulio.benetti at benettiengineering dot com
  2021-08-03 20:16 ` [Bug c/101766] " pinskia at gcc dot gnu.org
@ 2021-08-03 21:30 ` giulio.benetti at benettiengineering dot com
  2021-08-03 23:02 ` giulio.benetti at benettiengineering dot com
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: giulio.benetti at benettiengineering dot com @ 2021-08-03 21:30 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766

--- Comment #2 from Giulio Benetti <giulio.benetti at benettiengineering dot com> ---
Ah ok, so the workaround is to check with a little build test, right?

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

* [Bug c/101766] Microblaze gcc misses symver but __has_attribute(symver) returns true
  2021-08-03 20:03 [Bug c/101766] New: Microblaze gcc misses symver but __has_attribute(symver) returns true giulio.benetti at benettiengineering dot com
  2021-08-03 20:16 ` [Bug c/101766] " pinskia at gcc dot gnu.org
  2021-08-03 21:30 ` giulio.benetti at benettiengineering dot com
@ 2021-08-03 23:02 ` giulio.benetti at benettiengineering dot com
  2021-08-27 21:55 ` pinskia at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: giulio.benetti at benettiengineering dot com @ 2021-08-03 23:02 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766

--- Comment #3 from Giulio Benetti <giulio.benetti at benettiengineering dot com> ---
I've done this:
https://github.com/libfuse/libfuse/pull/620/commits/3aba09a5c56e017746c5c1652dbc845f4db7374a

and works fine. It doesn't seem to have pitfalls.

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

* [Bug c/101766] Microblaze gcc misses symver but __has_attribute(symver) returns true
  2021-08-03 20:03 [Bug c/101766] New: Microblaze gcc misses symver but __has_attribute(symver) returns true giulio.benetti at benettiengineering dot com
                   ` (2 preceding siblings ...)
  2021-08-03 23:02 ` giulio.benetti at benettiengineering dot com
@ 2021-08-27 21:55 ` pinskia at gcc dot gnu.org
  2023-03-13  0:35 ` vfazio at gmail dot com
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-08-27 21:55 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hjl.tools at gmail dot com

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 102110 has been marked as a duplicate of this bug. ***

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

* [Bug c/101766] Microblaze gcc misses symver but __has_attribute(symver) returns true
  2021-08-03 20:03 [Bug c/101766] New: Microblaze gcc misses symver but __has_attribute(symver) returns true giulio.benetti at benettiengineering dot com
                   ` (3 preceding siblings ...)
  2021-08-27 21:55 ` pinskia at gcc dot gnu.org
@ 2023-03-13  0:35 ` vfazio at gmail dot com
  2023-03-13  0:36 ` vfazio at gmail dot com
  2023-03-13  0:37 ` vfazio at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: vfazio at gmail dot com @ 2023-03-13  0:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766

Vincent Fazio <vfazio at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |vfazio at gmail dot com

--- Comment #5 from Vincent Fazio <vfazio at gmail dot com> ---
There's a mail discussion about this topic

https://gcc.gnu.org/pipermail/gcc/2023-March/240834.html

The "easy" route is to just add the proper macro to
config/microblaze/microblaze.h

The more correct, but more arduous, route is "porting" microblaze to correctly
use the elfos.h header and provide the proper overrides in a separate header.

I've tested the former with zero issues and tested a version of the latter and
was able to compile both a kernel and ramfs and successfully boot but doubt all
cases are accounted for. attaching patches for posterity

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

* [Bug c/101766] Microblaze gcc misses symver but __has_attribute(symver) returns true
  2021-08-03 20:03 [Bug c/101766] New: Microblaze gcc misses symver but __has_attribute(symver) returns true giulio.benetti at benettiengineering dot com
                   ` (4 preceding siblings ...)
  2023-03-13  0:35 ` vfazio at gmail dot com
@ 2023-03-13  0:36 ` vfazio at gmail dot com
  2023-03-13  0:37 ` vfazio at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: vfazio at gmail dot com @ 2023-03-13  0:36 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766

--- Comment #6 from Vincent Fazio <vfazio at gmail dot com> ---
Created attachment 54645
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54645&action=edit
add macro to microblaze.h

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

* [Bug c/101766] Microblaze gcc misses symver but __has_attribute(symver) returns true
  2021-08-03 20:03 [Bug c/101766] New: Microblaze gcc misses symver but __has_attribute(symver) returns true giulio.benetti at benettiengineering dot com
                   ` (5 preceding siblings ...)
  2023-03-13  0:36 ` vfazio at gmail dot com
@ 2023-03-13  0:37 ` vfazio at gmail dot com
  6 siblings, 0 replies; 8+ messages in thread
From: vfazio at gmail dot com @ 2023-03-13  0:37 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101766

--- Comment #7 from Vincent Fazio <vfazio at gmail dot com> ---
Created attachment 54646
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=54646&action=edit
partial patch for microblaze migration to elfos.h

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

end of thread, other threads:[~2023-03-13  0:37 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-03 20:03 [Bug c/101766] New: Microblaze gcc misses symver but __has_attribute(symver) returns true giulio.benetti at benettiengineering dot com
2021-08-03 20:16 ` [Bug c/101766] " pinskia at gcc dot gnu.org
2021-08-03 21:30 ` giulio.benetti at benettiengineering dot com
2021-08-03 23:02 ` giulio.benetti at benettiengineering dot com
2021-08-27 21:55 ` pinskia at gcc dot gnu.org
2023-03-13  0:35 ` vfazio at gmail dot com
2023-03-13  0:36 ` vfazio at gmail dot com
2023-03-13  0:37 ` vfazio at gmail dot com

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).