Closed
Bug 523435
Opened 15 years ago
Closed 11 years ago
Implement dehydra primitive write_section
Categories
(Developer Infrastructure :: Source Code Analysis, defect)
Tracking
(Not tracked)
RESOLVED
WONTFIX
People
(Reporter: dnovillo, Assigned: taras.mozilla)
Details
Attachments
(1 file, 1 obsolete file)
3.80 KB,
patch
|
dnovillo
:
review+
|
Details | Diff | Splinter Review |
This patch implements a new primitive to emit strings to named sections in the output object file: write_section(section_name, string) Adds the contents of 'string' to the section named 'section_name'. function process_decl(v) { write_section (".my_section", "v.name = '" + v.name + "'::"); } $ g++ -fplugin=dehydra.so '-fplugin-arg-dehydra-=test.js' -c test.cc $ objdump -j .my_section -s test.o test.o: file format elf64-x86-64 Contents of section .my_section: 0000 762e6e61 6d65203d 20275827 3a3a762e v.name = 'X'::v. 0010 6e616d65 203d2027 666f6f27 3a3a762e name = 'foo'::v. 0020 6e616d65 203d2027 59273a3a 762e6e61 name = 'Y'::v.na 0030 6d65203d 20276261 72282927 3a3a me = 'bar()':: The script is responsible for generating the section names, they can be intermixed arbitrarily and the string with contents is also any arbitrary string of bytes to dump to the section. Duplicate sections are combined by the linker. After the object files are generated, standard object file manipulation tools can be used to examine and remove these sections. This implementation has a minor hack needed because GCC is not exporting the header file needed to call the asm section manipulation routines (output.h). I will be changing GCC to export output.h, but in the meantime I've surrounded the extra declarations around #ifdef HAS_OUTPUT_H which should be defined in the Makefile if using a GCC that exports output.h. The other problem I have is with testing. I could add a test to call write_section() but the harness does not seem prepared to examine object/assembler files. What would be the best way to do this? The patch may apply with fuzz. I'm moving my patch collection over to quilt and cleaning it up so it's suitable for inclusion in dehydra.
Assignee | ||
Comment 1•15 years ago
|
||
This crashes with -save-temps. For some reason asm_file_name is set to the .ii file. No idea why previous patch didn't crash. It would be pretty easy to change this code to group stuff by sections, but I'll leave that as a later optimization.
Attachment #407356 -
Attachment is obsolete: true
Attachment #408120 -
Flags: review?(dnovillo)
Reporter | ||
Comment 2•15 years ago
|
||
(In reply to comment #1) > Created an attachment (id=408120) [details] > Use a js array, add simplistic testcase > > This crashes with -save-temps. For some reason asm_file_name is set to the .ii > file. No idea why previous patch didn't crash. Isn't your patch missing some bits from my original patch? I had registered the write_section command. Other than that, it looks fine to me. > It would be pretty easy to change this code to group stuff by sections, but > I'll leave that as a later optimization. I don't think you'll notice much performance difference in grouping the sections.
Reporter | ||
Updated•15 years ago
|
Attachment #408120 -
Flags: review?(dnovillo) → review+
Assignee | ||
Comment 3•15 years ago
|
||
>
> Isn't your patch missing some bits from my original patch? I had registered
> the write_section command. Other than that, it looks fine to me.
I implemented it in JS.
Comment 4•11 years ago
|
||
Dehydra and treehydra are no longer maintained by Mozilla.
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → WONTFIX
Updated•6 years ago
|
Product: Core → Firefox Build System
Updated•2 years ago
|
Product: Firefox Build System → Developer Infrastructure
You need to log in
before you can comment on or make changes to this bug.
Description
•