* [ia64] objcopy and constant-gp
@ 2007-11-12 8:37 Jakub Jermar
2007-11-12 9:21 ` Nick Clifton
2007-11-12 9:22 ` Tristan Gingold
0 siblings, 2 replies; 8+ messages in thread
From: Jakub Jermar @ 2007-11-12 8:37 UTC (permalink / raw)
To: binutils
Hi,
the following stopped working for me in ia64 binutils 2.18:
1. I have a binary file and want to objcopy it from the binary format to
elf64-ia64-little, creating one ELF section in it, the result is called
empty.o
2. I want to link empty.o with other .o files that were compiled with
-mconstant-gp
3. ld returns an error complaining about linking constant-gp and
non-constant-gp object files
So I would like to know if you consider this a regression or if it is
actually a feature or a fix introduced in the newest version.
Anyway, what I am now most concerned about is if there is a
straightforward way to specify that empty.o should be constructed with
the constant-gp flag. (There is an easy workaround for this: after
objcopy, patch the ELF file manually and set the constant-gp bit using
some hex editor).
Please respond directly to my email address as I am not subscribed in
this list.
Thanks,
Jakub
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [ia64] objcopy and constant-gp
2007-11-12 8:37 [ia64] objcopy and constant-gp Jakub Jermar
@ 2007-11-12 9:21 ` Nick Clifton
2007-11-12 16:18 ` Jakub Jermar
2007-11-12 9:22 ` Tristan Gingold
1 sibling, 1 reply; 8+ messages in thread
From: Nick Clifton @ 2007-11-12 9:21 UTC (permalink / raw)
To: Jakub Jermar; +Cc: binutils
Hi Jakub,
> 1. I have a binary file and want to objcopy it from the binary format to
> elf64-ia64-little, creating one ELF section in it, the result is called
> empty.o
> 2. I want to link empty.o with other .o files that were compiled with
> -mconstant-gp
> 3. ld returns an error complaining about linking constant-gp and
> non-constant-gp object files
> So I would like to know if you consider this a regression or if it is
> actually a feature or a fix introduced in the newest version.
I think I would count this as a feature rather than a bug, purely because there
is a better way of achieving what you want to do:
1. Create a small assembler file that includes the binary file you are
interested in:
.section foo, "a", @progbits
.incbin "the_binary_file"
2. Assemble this file, and make sure that you include the -mconstant-gp
option on the command line:
ia64-linux-as -mconstant-gp foo.s -o foo.o
3. Link in this new object file with the rest of your application.
Cheers
Nick
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [ia64] objcopy and constant-gp
2007-11-12 8:37 [ia64] objcopy and constant-gp Jakub Jermar
2007-11-12 9:21 ` Nick Clifton
@ 2007-11-12 9:22 ` Tristan Gingold
1 sibling, 0 replies; 8+ messages in thread
From: Tristan Gingold @ 2007-11-12 9:22 UTC (permalink / raw)
To: Jakub Jermar; +Cc: binutils
On Nov 12, 2007, at 9:36 AM, Jakub Jermar wrote:
> the following stopped working for me in ia64 binutils 2.18:
>
> 1. I have a binary file and want to objcopy it from the binary
> format to elf64-ia64-little, creating one ELF section in it, the
> result is called empty.o
> 2. I want to link empty.o with other .o files that were compiled
> with -mconstant-gp
> 3. ld returns an error complaining about linking constant-gp and
> non-constant-gp object files
>
> So I would like to know if you consider this a regression or if it
> is actually a feature or a fix introduced in the newest version.
>
> Anyway, what I am now most concerned about is if there is a
> straightforward way to specify that empty.o should be constructed
> with the constant-gp flag. (There is an easy workaround for this:
> after objcopy, patch the ELF file manually and set the constant-gp
> bit using some hex editor).
This behaviour sounds reasonable.
You'd better to create empty.s which .incbin (see gas manual) the
binary file. Then you assemble empty.s
using the right options (--mconstant-gp).
The link should be successful.
Tristan.
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [ia64] objcopy and constant-gp
2007-11-12 9:21 ` Nick Clifton
@ 2007-11-12 16:18 ` Jakub Jermar
2007-11-12 16:57 ` Nick Clifton
2007-11-12 17:57 ` Dave Korn
0 siblings, 2 replies; 8+ messages in thread
From: Jakub Jermar @ 2007-11-12 16:18 UTC (permalink / raw)
To: binutils; +Cc: Nick Clifton, gingold
Hi Nick and Tristan,
Nick Clifton wrote:
> .section foo, "a", @progbits
> .incbin "the_binary_file"
this works. But it is rather an acceptable workaround.
Moreover, I need to use the same trick for different platforms and some
platforms' assemblers use '%' instead of '@' (but that's managable).
I think that adding a flag to objcopy that would allow one to set file
header flags will be a little bit better.
Anyway, thanks a lot!
Jakub
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [ia64] objcopy and constant-gp
2007-11-12 16:18 ` Jakub Jermar
@ 2007-11-12 16:57 ` Nick Clifton
2007-11-12 17:20 ` Jakub Jermar
2007-11-12 17:57 ` Dave Korn
1 sibling, 1 reply; 8+ messages in thread
From: Nick Clifton @ 2007-11-12 16:57 UTC (permalink / raw)
To: Jakub Jermar; +Cc: binutils, gingold
Hi Jakub,
>> .section foo, "a", @progbits
>> .incbin "the_binary_file"
>
> this works. But it is rather an acceptable workaround.
I think that you might mean "unacceptable" here... :-)
> Moreover, I need to use the same trick for different platforms and some
> platforms' assemblers use '%' instead of '@' (but that's managable).
True.
> I think that adding a flag to objcopy that would allow one to set file
> header flags will be a little bit better.
But very target specific if you want to use printable names for the flag bits.
Still it is a feature that might prove useful to other people, so if you want
to implement it then please go ahead.
Cheers
Nick
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [ia64] objcopy and constant-gp
2007-11-12 16:57 ` Nick Clifton
@ 2007-11-12 17:20 ` Jakub Jermar
0 siblings, 0 replies; 8+ messages in thread
From: Jakub Jermar @ 2007-11-12 17:20 UTC (permalink / raw)
To: Nick Clifton; +Cc: binutils, gingold
Nick Clifton wrote:
> Hi Jakub,
>
>>> .section foo, "a", @progbits
>>> .incbin "the_binary_file"
>>
>> this works. But it is rather an acceptable workaround.
>
> I think that you might mean "unacceptable" here... :-)
Acceptable was just right.
It did the job for me, but I'd do it differently if the tool supported it.
>> I think that adding a flag to objcopy that would allow one to set file
>> header flags will be a little bit better.
>
> But very target specific if you want to use printable names for the flag
> bits. Still it is a feature that might prove useful to other people, so
> if you want to implement it then please go ahead.
Hm, then maybe hex values would do... Anyway, objdump and readelf can
print those hex values in human-readable ways (eg. constant-gp). Sorry,
I don't see myself implementing this anytime soon :-)
Regards,
Jakub
^ permalink raw reply [flat|nested] 8+ messages in thread
* RE: [ia64] objcopy and constant-gp
2007-11-12 16:18 ` Jakub Jermar
2007-11-12 16:57 ` Nick Clifton
@ 2007-11-12 17:57 ` Dave Korn
2007-11-12 18:02 ` Jakub Jermar
1 sibling, 1 reply; 8+ messages in thread
From: Dave Korn @ 2007-11-12 17:57 UTC (permalink / raw)
To: 'Jakub Jermar', binutils; +Cc: 'Nick Clifton', gingold
On 12 November 2007 16:19, Jakub Jermar wrote:
> Moreover, I need to use the same trick for different platforms
Are you sure? Surely other platforms don't have "-mconstant-gp"?
cheers,
DaveK
--
Can't think of a witty .sigline today....
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [ia64] objcopy and constant-gp
2007-11-12 17:57 ` Dave Korn
@ 2007-11-12 18:02 ` Jakub Jermar
0 siblings, 0 replies; 8+ messages in thread
From: Jakub Jermar @ 2007-11-12 18:02 UTC (permalink / raw)
To: Dave Korn; +Cc: binutils, 'Nick Clifton', gingold
Hi,
Dave Korn wrote:
>> Moreover, I need to use the same trick for different platforms
>
> Are you sure? Surely other platforms don't have "-mconstant-gp"?
This is a misunderstanding. Other platforms don't have -mconstant-gp,
but I need to link empty.o with HelenOS kernel on all other supported
platforms. So I need a mechanism that is preferably universal and can be
part of the main Makefile. (And I have found that mechanism thanks to
the help I received here.)
Jakub
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2007-11-12 18:02 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-11-12 8:37 [ia64] objcopy and constant-gp Jakub Jermar
2007-11-12 9:21 ` Nick Clifton
2007-11-12 16:18 ` Jakub Jermar
2007-11-12 16:57 ` Nick Clifton
2007-11-12 17:20 ` Jakub Jermar
2007-11-12 17:57 ` Dave Korn
2007-11-12 18:02 ` Jakub Jermar
2007-11-12 9:22 ` Tristan Gingold
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).