This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: linker behaviour for sections having flags SHF_MERGE/SHF_STRINGS
Hi Alan,
Thanks for your message. Made it more clear for me.
I dont know how critical are the linker and the gold bugs, think they are
not so critical.
I had more questions on the same topic and want to know
1) How is sh_entsize relevant when the section flags have SHF_STRINGS set ?
Thanks
Shankar Easwaran
Alan Modra-3 wrote:
>
> On Fri, Nov 09, 2012 at 09:14:30AM -0800, shankarke@gmail.com wrote:
>> $gold merge_test.o
>> $ readelf -p 2 a.out
>>
>> String dump of section '.rodata':
>> [ 0] abc
>> [ 4] c
>>
>> Question :-
>> Why is the difference ?
>
> Possibly a gold bug.
>
>> merge_test.s
>> --------------
>> .section .rodata.str,"aM","progbits",3
>> .LC0:
>> .asciz "abc"
>> .LC1:
>> .asciz "abc"
>> .LC2:
>> .asciz "cde"
>> .LC3:
>> .asciz "cde"
>
> Your testcase is broken. With an entsize of 3, the elements are
> abc,\0ab,c\0c,de\0,cde,\0
>
>> .section .rodata.str,"aMS","progbits",2
>> .LC0:
>> .asciz "ab"
>> .LC1:
>> .asciz "ab"
>
> Similarly here. The zero terminator should be entsize bytes wide.
>
>> $gold merge_test.o
>> gold: warning: merge_test.o: last entry in mergeable string section
>> '.rodata.str' not null terminated
>>
>> $ld merge_test.o
>> (no error)
>
> And this is a ld bug. It should complain too. Nitpick on the gold
> message: strings aren't null terminated, they are NUL terminated.
>
> --
> Alan Modra
> Australia Development Lab, IBM
>
>
--
View this message in context: http://old.nabble.com/linker-behaviour-for-sections-having-flags-SHF_MERGE-SHF_STRINGS-tp34661603p34669646.html
Sent from the Sourceware - binutils list mailing list archive at Nabble.com.