[Bug ld/15302] Branching to linker script symbol is resolved to improperly BLX instruction for cortex-m3

2013-06-04 Thread terry.guo at arm dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=15302

--- Comment #3 from Terry Guo  ---
(In reply to Nick Clifton from comment #1)
> Created attachment 6968 [details]
> Do not enable blx use on thumb-only architectures.
> 
> Hi Terry,
> 
>   Please could you try out the uploaded patch and let me know if it works
> for you.
> 
> Cheers
>   Nick

Apologize for my slow response. With your patch I got code like:

terguo01@terry-pc01:case$ ../install-native/bin/arm-none-eabi-objdump -d a.out 

a.out: file format elf32-littlearm


Disassembly of section .text:

 :
   0:b580  push{r7, lr}
   2:af00  addr7, sp, #0
   4:f000 f804 bl10 <__extFunc_from_thumb>
   8:bd80  pop{r7, pc}
   a:bf00  nop
   c:  movsr0, r0
...

0010 <__extFunc_from_thumb>:
  10:4778  bxpc
  12:46c0  nop; (mov r8, r8)
  14:ea0003f9 b1000 <__extFunc_from_thumb+0xff0>
terguo01@terry-pc01:case$ 

It's same with Pavel's issue. Can you please continue to look into it?

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils


[Bug gold/15574] New: Gold is overly pedantic for dynamic references to symbols with hidden visibility

2013-06-04 Thread law at redhat dot com
http://sourceware.org/bugzilla/show_bug.cgi?id=15574

Bug ID: 15574
   Summary: Gold is overly pedantic for dynamic references to
symbols with hidden visibility
   Product: binutils
   Version: unspecified
Status: NEW
  Severity: normal
  Priority: P2
 Component: gold
  Assignee: ian at airs dot com
  Reporter: law at redhat dot com
CC: ccoutant at google dot com

$ cat t.c
#include 
#include 

void foo(void) __attribute__((visibility("hidden")));
void foo(void) {
  puts("In executable: foo - before forwarding to DSO");
  ((void(*)(void))dlsym(RTLD_DEFAULT,"foo"))();
  puts("In executable: foo - after forwarding to DSO");
}

void bar(void);

int main() {
  foo();
  bar();
}

$ cat u.c
#include 

void foo(void);
void bar(void) {
  puts("In DSO: bar");
  foo();
}

$ cat v.c
#include 

void foo(void) {
  puts("In DSO: foo");
}


$ gcc v.c -fPIC -shared -olibv.so
$ gcc u.c -fPIC -shared -olibu.so
$ gcc -D_GNU_SOURCE t.c -L. -lu -lv -ldl -Wl,-rpath,`pwd`


When linking with the bfd linker, there is no error or warning.  However,
linking with gold produces:

/usr/bin/ld: warning: hidden symbol 'foo' in /tmp/ccAF4VIi.o is referenced by
DSO ./libu.so


Note we have two definitions of "foo".  One with default visibilty in libv and
one that is hidden (main executable) and a reference to foo with default
visibility (libu). 


>From the ELF standard:

---
 None of the visibility attributes affects resolution of symbols within an
executable or shared object during link-editing -- such resolution is
controlled by the binding type. Once the link-editor has chosen its resolution,
these attributes impose two requirements, both based on the fact that
references in the code being linked may have been optimized to take advantage
of the attributes.

* First, all of the non-default visibility attributes, when applied to a
symbol reference, imply that a definition to satisfy that reference must be
provided within the current executable or shared object. If such a symbol
reference has no definition within the component being linked, then the
reference must have STB_WEAK binding and is resolved to zero.

* Second, if any reference to or definition of a name is a symbol with a
non-default visibility attribute, the visibility attribute must be propagated
to the resolving symbol in the linked object. If different visibility
attributes are specified for distinct references to or definitions of a symbol,
the most constraining visibility attribute must be propagated to the resolving
symbol in the linked object. The attributes, ordered from least to most
constraining, are: STV_PROTECTED, STV_HIDDEN and STV_INTERNAL.
---

Note carefully that visibility attributes do not affect symbol resolution
(which is controlled by the binding type).  Based on that wording I believe the
warning from gold is unnecessary and confusing.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

___
bug-binutils mailing list
bug-binutils@gnu.org
https://lists.gnu.org/mailman/listinfo/bug-binutils