clang++ linker issues on Ubuntu AMD64.

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

clang++ linker issues on Ubuntu AMD64.

Lang Hames
Hi All,

I'm attempting to compile the following function

int main() {}

under Ubuntu 10.10 AMD64 with

clang++ -o empty empty.cpp

and it's yielding

/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1 has invalid symbol index 12
<--- snip (there's about 17 more lines of this...) --->
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 20 has invalid symbol index 20
/usr/lib/gcc/x86_64-linux-gnu/4.5.1/../../../../lib/crt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

If I run

clang++ -c -o empty.o empty.cpp
nm empty.o

I see

0000000000000000 T :main

Is that colon the issue? (Object file formats and symbol names are not my area of expertise). In any case renaming ":main" to "main" with objcopy and then running ld manually yields a working executable.

So is this an invalid symbol name? A valid but incorrect one? Is there some flag that clang should be passing to ld to get it to recognise this symbol? I'd file a bug report, but as you can tell I'm slightly hazy on what the bug is.

Cheers,
Lang.





_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang++ linker issues on Ubuntu AMD64.

İsmail Dönmez
Hi;

On Wed, Jan 5, 2011 at 9:03 AM, Lang Hames <[hidden email]> wrote:
Hi All,

I'm attempting to compile the following function

int main() {}

under Ubuntu 10.10 AMD64 with

clang++ -o empty empty.cpp

and it's yielding

/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1 has invalid symbol index 12

Works with clang trunk (tested on openSUSE 11.4 M4)

Regards,
ismail
 

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang++ linker issues on Ubuntu AMD64.

Lang Hames
Hi,

Specifically I was running with r122866, which was ToT as of earlier today. Updating to r122869, the current ToT, does not fix this issue, and (if I recall correctly) I saw the same issue when I checked clang out on a different AMD64 Ubuntu box a week or so back. Both were Debug+Asserts builds.

Cheers,
Lang.

On Wed, Jan 5, 2011 at 6:46 PM, İsmail Dönmez <[hidden email]> wrote:
Hi;

On Wed, Jan 5, 2011 at 9:03 AM, Lang Hames <[hidden email]> wrote:
Hi All,

I'm attempting to compile the following function

int main() {}

under Ubuntu 10.10 AMD64 with

clang++ -o empty empty.cpp

and it's yielding

/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0 has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1 has invalid symbol index 12

Works with clang trunk (tested on openSUSE 11.4 M4)

Regards,
ismail
 


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang++ linker issues on Ubuntu AMD64.

İsmail Dönmez
Hi;

On Wed, Jan 5, 2011 at 10:16 AM, Lang Hames <[hidden email]> wrote:
Specifically I was running with r122866, which was ToT as of earlier today. Updating to r122869, the current ToT, does not fix this issue, and (if I recall correctly) I saw the same issue when I checked clang out on a different AMD64 Ubuntu box a week or so back. Both were Debug+Asserts builds.

I am also on x86-64 so this might be a Ubuntu specific problem.

Regards,
ismail
 

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang++ linker issues on Ubuntu AMD64.

Török Edwin
On 2011-01-05 10:19, İsmail Dönmez wrote:

> Hi;
>
> On Wed, Jan 5, 2011 at 10:16 AM, Lang Hames <[hidden email]> wrote:
>
>> Specifically I was running with r122866, which was ToT as of earlier today.
>> Updating to r122869, the current ToT, does not fix this issue, and (if I
>> recall correctly) I saw the same issue when I checked clang out on a
>> different AMD64 Ubuntu box a week or so back. Both were Debug+Asserts
>> builds.
>>
>
> I am also on x86-64 so this might be a Ubuntu specific problem.

I think this depends on your version of binutils, I get the same on
Debian with gcc on empty file. Ignore the invalid symbol index, the
problem is the missing 'main' function :)

$ gcc empty.c
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0
has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1
has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 2
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 3
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 4
has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 5
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 6
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 7
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 8
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 9
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 10
has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 11
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 12
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 13
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 14
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 15
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 16
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 17
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 18
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 19
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 20
has invalid symbol index 20
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o: In function
`_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status



>
> Regards,
> ismail
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang++ linker issues on Ubuntu AMD64.

İsmail Dönmez
Hi;

2011/1/5 Török Edwin <[hidden email]>:

> On 2011-01-05 10:19, İsmail Dönmez wrote:
>> Hi;
>>
>> On Wed, Jan 5, 2011 at 10:16 AM, Lang Hames <[hidden email]> wrote:
>>
>>> Specifically I was running with r122866, which was ToT as of earlier today.
>>> Updating to r122869, the current ToT, does not fix this issue, and (if I
>>> recall correctly) I saw the same issue when I checked clang out on a
>>> different AMD64 Ubuntu box a week or so back. Both were Debug+Asserts
>>> builds.
>>>
>>
>> I am also on x86-64 so this might be a Ubuntu specific problem.
>
> I think this depends on your version of binutils, I get the same on
> Debian with gcc on empty file. Ignore the invalid symbol index, the
> problem is the missing 'main' function :)
>
> $ gcc empty.c
> /usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0
> has invalid symbol index 11

Ah! I have binutils 2.21. That might explain it.

Regards,
ismail

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang++ linker issues on Ubuntu AMD64.

Lang Hames
In reply to this post by Török Edwin
Hi Török,

I should have been more clear on this detail too: My "empty" file contained an empty main function, rather than being completely empty. So the issue with the "missing" main is due to the main symbol being named ":main" instead of "main".

- Lang.

2011/1/5 Török Edwin <[hidden email]>
On 2011-01-05 10:19, İsmail Dönmez wrote:
> Hi;
>
> On Wed, Jan 5, 2011 at 10:16 AM, Lang Hames <[hidden email]> wrote:
>
>> Specifically I was running with r122866, which was ToT as of earlier today.
>> Updating to r122869, the current ToT, does not fix this issue, and (if I
>> recall correctly) I saw the same issue when I checked clang out on a
>> different AMD64 Ubuntu box a week or so back. Both were Debug+Asserts
>> builds.
>>
>
> I am also on x86-64 so this might be a Ubuntu specific problem.

I think this depends on your version of binutils, I get the same on
Debian with gcc on empty file. Ignore the invalid symbol index, the
problem is the missing 'main' function :)

$ gcc empty.c
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0
has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1
has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 2
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 3
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 4
has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 5
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 6
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 7
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 8
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 9
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 10
has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 11
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 12
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 13
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 14
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 15
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 16
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 17
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 18
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 19
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 20
has invalid symbol index 20
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o: In function
`_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status



>
> Regards,
> ismail
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang++ linker issues on Ubuntu AMD64.

Lang Hames
Further details:

The assembly output from "int main() {}", compiled with "clang -S -o empty empty.c" is

    .file   "empty.c"
    .text
    .globl  ":main"
    .align  16, 0x90
":main":                                # @main
.Leh_func_begin0:
# BB#0:                                 # %entry
    pushq   %rbp
.Ltmp0:
    movq    %rsp, %rbp
.Ltmp1:
    movl    $0, %eax
    popq    %rbp
    ret
.Leh_func_end0:

    .section    .eh_frame,"a",@progbits
.LEH_frame0:
.Lsection_eh_frame0:
.Leh_frame_common0:
.Lset0 = .Leh_frame_common_end0-.Leh_frame_common_begin0 # Length of Common Information Entry
    .long   .Lset0
.Leh_frame_common_begin0:
    .long   0                       # CIE Identifier Tag
    .byte   1                       # DW_CIE_VERSION
    .asciz   "zR"                   # CIE Augmentation
    .byte   1                       # CIE Code Alignment Factor
    .byte   120                     # CIE Data Alignment Factor
    .byte   16                      # CIE Return Address Column
    .byte   1                       # Augmentation Size
    .byte   3                       # FDE Encoding = udata4
    .byte   12                      # DW_CFA_def_cfa
    .byte   7                       # Register
    .byte   8                       # Offset
    .byte   144                     # DW_CFA_offset + Reg (16)
    .byte   1                       # Offset
    .align  8
.Leh_frame_common_end0:
".L:main.eh":
.Lset1 = .Leh_frame_end0-.Leh_frame_begin0 # Length of Frame Information Entry
    .long   .Lset1
.Leh_frame_begin0:
.Lset2 = .Leh_frame_begin0-.Leh_frame_common0 # FDE CIE offset
    .long   .Lset2
    .long   .Leh_func_begin0        # FDE initial location
.Lset3 = .Leh_func_end0-.Leh_func_begin0 # FDE address range
    .long   .Lset3
    .byte   0                       # Augmentation size
    .byte   4                       # DW_CFA_advance_loc4
.Lset4 = .Ltmp0-.Leh_func_begin0
    .long   .Lset4
    .byte   14                      # DW_CFA_def_cfa_offset
    .byte   16                      # Offset
    .byte   134                     # DW_CFA_offset + Reg (6)
    .byte   2                       # Offset
    .byte   4                       # DW_CFA_advance_loc4
.Lset5 = .Ltmp1-.Ltmp0
    .long   .Lset5
    .byte   13                      # DW_CFA_def_cfa_register
    .byte   6                       # Register
    .align  8
.Leh_frame_end0:


    .section    .note.GNU-stack,"",@progbits

It's pretty clear the colon is being prepended in there, I'm just curious as to why?

Ismail - do you see the same output on your Linux AMD64 system?

- Lang.

2011/1/5 Lang Hames <[hidden email]>
Hi Török,

I should have been more clear on this detail too: My "empty" file contained an empty main function, rather than being completely empty. So the issue with the "missing" main is due to the main symbol being named ":main" instead of "main".

- Lang.

2011/1/5 Török Edwin <[hidden email]>
On 2011-01-05 10:19, İsmail Dönmez wrote:

> Hi;
>
> On Wed, Jan 5, 2011 at 10:16 AM, Lang Hames <[hidden email]> wrote:
>
>> Specifically I was running with r122866, which was ToT as of earlier today.
>> Updating to r122869, the current ToT, does not fix this issue, and (if I
>> recall correctly) I saw the same issue when I checked clang out on a
>> different AMD64 Ubuntu box a week or so back. Both were Debug+Asserts
>> builds.
>>
>
> I am also on x86-64 so this might be a Ubuntu specific problem.

I think this depends on your version of binutils, I get the same on
Debian with gcc on empty file. Ignore the invalid symbol index, the
problem is the missing 'main' function :)

$ gcc empty.c
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0
has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1
has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 2
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 3
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 4
has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 5
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 6
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 7
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 8
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 9
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 10
has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 11
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 12
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 13
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 14
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 15
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 16
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 17
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 18
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 19
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 20
has invalid symbol index 20
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o: In function
`_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status



>
> Regards,
> ismail
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang++ linker issues on Ubuntu AMD64.

İsmail Dönmez
Hi;

2011/1/5 Lang Hames <[hidden email]>
Further details:

The assembly output from "int main() {}", compiled with "clang -S -o empty empty.c" is

    .file   "empty.c"
    .text
    .globl  ":main"
    .align  16, 0x90

Nope, what I see is

        .file   "empty.c"
        .text
        .globl  main
        .align  16, 0x90
        .type   main,@function

Regards,
ismail


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang++ linker issues on Ubuntu AMD64.

Lang Hames
Ok, I guess this is somehow Ubuntu specific.

-Lang.

On Wed, Jan 5, 2011 at 8:02 PM, İsmail Dönmez <[hidden email]> wrote:
Hi;

2011/1/5 Lang Hames <[hidden email]>
Further details:

The assembly output from "int main() {}", compiled with "clang -S -o empty empty.c" is

    .file   "empty.c"
    .text
    .globl  ":main"
    .align  16, 0x90

Nope, what I see is

        .file   "empty.c"
        .text
        .globl  main
        .align  16, 0x90
        .type   main,@function

Regards,
ismail



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: clang++ linker issues on Ubuntu AMD64.

Lang Hames
In reply to this post by Lang Hames
And of course a clean rebuild has fixed everything. Thanks to Takumi Nakamura for pointing that out. :)

- Lang.

2011/1/5 Lang Hames <[hidden email]>
Further details:

The assembly output from "int main() {}", compiled with "clang -S -o empty empty.c" is

    .file   "empty.c"
    .text
    .globl  ":main"
    .align  16, 0x90
":main":                                # @main
.Leh_func_begin0:
# BB#0:                                 # %entry
    pushq   %rbp
.Ltmp0:
    movq    %rsp, %rbp
.Ltmp1:
    movl    $0, %eax
    popq    %rbp
    ret
.Leh_func_end0:

    .section    .eh_frame,"a",@progbits
.LEH_frame0:
.Lsection_eh_frame0:
.Leh_frame_common0:
.Lset0 = .Leh_frame_common_end0-.Leh_frame_common_begin0 # Length of Common Information Entry
    .long   .Lset0
.Leh_frame_common_begin0:
    .long   0                       # CIE Identifier Tag
    .byte   1                       # DW_CIE_VERSION
    .asciz   "zR"                   # CIE Augmentation
    .byte   1                       # CIE Code Alignment Factor
    .byte   120                     # CIE Data Alignment Factor
    .byte   16                      # CIE Return Address Column
    .byte   1                       # Augmentation Size
    .byte   3                       # FDE Encoding = udata4
    .byte   12                      # DW_CFA_def_cfa
    .byte   7                       # Register
    .byte   8                       # Offset
    .byte   144                     # DW_CFA_offset + Reg (16)
    .byte   1                       # Offset
    .align  8
.Leh_frame_common_end0:
".L:main.eh":
.Lset1 = .Leh_frame_end0-.Leh_frame_begin0 # Length of Frame Information Entry
    .long   .Lset1
.Leh_frame_begin0:
.Lset2 = .Leh_frame_begin0-.Leh_frame_common0 # FDE CIE offset
    .long   .Lset2
    .long   .Leh_func_begin0        # FDE initial location
.Lset3 = .Leh_func_end0-.Leh_func_begin0 # FDE address range
    .long   .Lset3
    .byte   0                       # Augmentation size
    .byte   4                       # DW_CFA_advance_loc4
.Lset4 = .Ltmp0-.Leh_func_begin0
    .long   .Lset4
    .byte   14                      # DW_CFA_def_cfa_offset
    .byte   16                      # Offset
    .byte   134                     # DW_CFA_offset + Reg (6)
    .byte   2                       # Offset
    .byte   4                       # DW_CFA_advance_loc4
.Lset5 = .Ltmp1-.Ltmp0
    .long   .Lset5
    .byte   13                      # DW_CFA_def_cfa_register
    .byte   6                       # Register
    .align  8
.Leh_frame_end0:


    .section    .note.GNU-stack,"",@progbits

It's pretty clear the colon is being prepended in there, I'm just curious as to why?

Ismail - do you see the same output on your Linux AMD64 system?

- Lang.

2011/1/5 Lang Hames <[hidden email]>

Hi Török,

I should have been more clear on this detail too: My "empty" file contained an empty main function, rather than being completely empty. So the issue with the "missing" main is due to the main symbol being named ":main" instead of "main".

- Lang.

2011/1/5 Török Edwin <[hidden email]>
On 2011-01-05 10:19, İsmail Dönmez wrote:

> Hi;
>
> On Wed, Jan 5, 2011 at 10:16 AM, Lang Hames <[hidden email]> wrote:
>
>> Specifically I was running with r122866, which was ToT as of earlier today.
>> Updating to r122869, the current ToT, does not fix this issue, and (if I
>> recall correctly) I saw the same issue when I checked clang out on a
>> different AMD64 Ubuntu box a week or so back. Both were Debug+Asserts
>> builds.
>>
>
> I am also on x86-64 so this might be a Ubuntu specific problem.

I think this depends on your version of binutils, I get the same on
Debian with gcc on empty file. Ignore the invalid symbol index, the
problem is the missing 'main' function :)

$ gcc empty.c
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 0
has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 1
has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 2
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 3
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 4
has invalid symbol index 11
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 5
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 6
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 7
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 8
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 9
has invalid symbol index 2
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 10
has invalid symbol index 12
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 11
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 12
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 13
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 14
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 15
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 16
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 17
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 18
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 19
has invalid symbol index 13
/usr/bin/ld: /usr/lib/debug/usr/lib/crt1.o(.debug_info): relocation 20
has invalid symbol index 20
/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o: In function
`_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status



>
> Regards,
> ismail
>
>
>
>
> _______________________________________________
> cfe-dev mailing list
> [hidden email]
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev