* division in ld scripts
@ 2009-09-09 13:38 Jan Beulich
2009-09-09 14:46 ` John Reiser
2009-09-09 14:48 ` Ian Lance Taylor
0 siblings, 2 replies; 5+ messages in thread
From: Jan Beulich @ 2009-09-09 13:38 UTC (permalink / raw)
To: binutils
Is it known/intended/documented that using the division operator (/) in
ld scripts requires a blank to follow, at least in some cases (see below)?
All other operators seem to behave as expected (apart from the missing
but unlikely to be needed ^), while / results in a "syntax error" failure.
Thanks, Jan
OUTPUT_FORMAT("elf64-x86-64", "elf64-x86-64", "elf64-x86-64")
OUTPUT_ARCH(i386:x86-64)
ENTRY(test)
PHDRS
{
text PT_LOAD ;
}
SECTIONS
{
. = 0x00401000+2;
. = 0x00401000-2;
. = 0x00401000*2;
. = 0x00401000/2;
. = 0x00401000%2;
. = 0x00401000&2;
. = 0x00401000|2;
/* . = 0x00401000^2;*/
.text : {
_stext = .;
*(.text)
*(.gnu.warning)
_etext = .;
} :text = 0x9090
.rodata : {
*(.rodata)
*(.rodata.*)
} :text
.data : {
*(.data)
} :text
.bss : {
*(.bss)
} :text
_end = . ;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: division in ld scripts
2009-09-09 13:38 division in ld scripts Jan Beulich
@ 2009-09-09 14:46 ` John Reiser
2009-09-09 14:48 ` Ian Lance Taylor
1 sibling, 0 replies; 5+ messages in thread
From: John Reiser @ 2009-09-09 14:46 UTC (permalink / raw)
To: binutils
> Is it known/intended/documented that using the division operator (/) in
> ld scripts requires a blank to follow, at least in some cases (see below)?
> SECTIONS
> {
> . = 0x00401000/2;
It's a bug: forgetting to put back the look-ahead character
when checking for "/*" as start-of-comment, but not finding '*'.
--
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: division in ld scripts
2009-09-09 13:38 division in ld scripts Jan Beulich
2009-09-09 14:46 ` John Reiser
@ 2009-09-09 14:48 ` Ian Lance Taylor
2009-09-09 14:59 ` Jan Beulich
1 sibling, 1 reply; 5+ messages in thread
From: Ian Lance Taylor @ 2009-09-09 14:48 UTC (permalink / raw)
To: Jan Beulich; +Cc: binutils
"Jan Beulich" <JBeulich@novell.com> writes:
> Is it known/intended/documented that using the division operator (/) in
> ld scripts requires a blank to follow, at least in some cases (see below)?
> All other operators seem to behave as expected (apart from the missing
> but unlikely to be needed ^), while / results in a "syntax error" failure.
The linker language is kind of a mess. The problem here is that '/' can
appear in a file name, so the whole string gets picked up as a file name
rather than a number. I think it would be pretty hard to change without
breaking existing scripts.
Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: division in ld scripts
2009-09-09 14:48 ` Ian Lance Taylor
@ 2009-09-09 14:59 ` Jan Beulich
2009-09-09 15:14 ` Ian Lance Taylor
0 siblings, 1 reply; 5+ messages in thread
From: Jan Beulich @ 2009-09-09 14:59 UTC (permalink / raw)
To: Ian Lance Taylor; +Cc: binutils
>>> Ian Lance Taylor <iant@google.com> 09.09.09 16:48 >>>
>"Jan Beulich" <JBeulich@novell.com> writes:
>
>> Is it known/intended/documented that using the division operator (/) in
>> ld scripts requires a blank to follow, at least in some cases (see below)?
>> All other operators seem to behave as expected (apart from the missing
>> but unlikely to be needed ^), while / results in a "syntax error" failure.
>
>The linker language is kind of a mess. The problem here is that '/' can
>appear in a file name, so the whole string gets picked up as a file name
>rather than a number. I think it would be pretty hard to change without
>breaking existing scripts.
But why would that "can appear in a file name" argument not also apply
to the other operators? Especially '-' shouldn't be that uncommon, albeit
perhaps not at the beginning of a file name.
Jan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: division in ld scripts
2009-09-09 14:59 ` Jan Beulich
@ 2009-09-09 15:14 ` Ian Lance Taylor
0 siblings, 0 replies; 5+ messages in thread
From: Ian Lance Taylor @ 2009-09-09 15:14 UTC (permalink / raw)
To: Jan Beulich; +Cc: binutils
"Jan Beulich" <JBeulich@novell.com> writes:
>>>> Ian Lance Taylor <iant@google.com> 09.09.09 16:48 >>>
>>"Jan Beulich" <JBeulich@novell.com> writes:
>>
>>> Is it known/intended/documented that using the division operator (/) in
>>> ld scripts requires a blank to follow, at least in some cases (see below)?
>>> All other operators seem to behave as expected (apart from the missing
>>> but unlikely to be needed ^), while / results in a "syntax error" failure.
>>
>>The linker language is kind of a mess. The problem here is that '/' can
>>appear in a file name, so the whole string gets picked up as a file name
>>rather than a number. I think it would be pretty hard to change without
>>breaking existing scripts.
>
> But why would that "can appear in a file name" argument not also apply
> to the other operators? Especially '-' shouldn't be that uncommon, albeit
> perhaps not at the beginning of a file name.
Yes, the issue is which characters the linker script language will
permit at the start of a file name. I was wrong in saying that the
whole string gets picked up as a file name. What gets picked up as a
file name is the part starting with the slash. The characters which are
permitted at the start of a file name are, from ldlex.l:
FILENAMECHAR1 [_a-zA-Z\/\.\\\$\_\~]
Ian
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-09-09 15:14 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-09 13:38 division in ld scripts Jan Beulich
2009-09-09 14:46 ` John Reiser
2009-09-09 14:48 ` Ian Lance Taylor
2009-09-09 14:59 ` Jan Beulich
2009-09-09 15:14 ` Ian Lance Taylor
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).