Git Product home page Git Product logo

vas's People

Contributors

spytheman avatar v420v avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vas's Issues

Indirect memory reference that uses symbols causes unnecessary relocation

Describe the bug

# ./vas main.s

.global _start

.section .text, "ax"

_start:
	pushq %rbp
	movq %rsp, %rbp
	subq $16, %rsp

	movq $1, %rax
	movq $1, %rdi
	leaq msg(%rip), %rsi
	movq $13, %rdx
	syscall

	movq $60, %rax
	movq $0, %rdi
	syscall

msg:
	.string "Hello, world!"

In the current assembler being developed, unnecessary relocation occurs with the "msg(%rip)" operation, even though the "msg" label is defined in the same section as the instruction/operation.

└─$ readelf -r main.o

再配置セクション '.rela.text' at offset 0x110 contains 1 entry:
  オフセット      情報           型             シンボル値    シンボル名 + 加数
000000000019  000100000002 R_X86_64_PC32     0000000000000000 .text + 32

Expected behavior

The assembler should not perform unnecessary relocation for "msg(%rip)" when the "msg" label is defined in the same section as the instruction/operation. This is because the address of the "msg" label can be determined at assembly time and does not need to be resolved at runtime. Therefore, the assembled code should not contain any relocation entries for "msg(%rip)" in this case.

Safety for macros

Report an error when a macro expansion enters an infinite loop.

.macro FOO
    movq $60, %rax
    FOO
.end

FOO

.align directive

Describe the feature

The .align directive causes the next data generated to be aligned modulo integer bytes. Integer must be a positive integer expression and must be a power of 2.

.align 8

Use Case

...

Proposed Solution

...

Other Information

...

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

.type directive

Describe the feature

Declares the type of symbol

.type main, @function
.global main
main:
    retq

Use Case

...

Proposed Solution

...

Other Information

...

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

A bug occurs in relocations that use global symbols.

Describe the bug

# Hello world!

.global _start

.section .data, "wa"
msg:
	.string "Hello, world!\n"

.section .text, "ax"
_start:
	pushq %rbp
	movq %rsp, %rbp
	subq $16, %rsp

	callq test1 # something wrong with the relocation process here.

	movq $1, %rax
	movq $1, %rdi
	leaq msg(%rip), %rsi
	movq $14, %rdx
	syscall

	movq $60, %rax
	movq $0, %rdi
	syscall

.section something, "ax"
.global test1
test1:
	retq

Expected behavior

┌──(ibuki🧀kali)-[~/test/vas]
└─$ readelf -r as.o  

再配置セクション '.rela.text' at offset 0x120 contains 2 entries:
  オフセット      情報           型             シンボル値    シンボル名 + 加数
000000000009  000400000004 R_X86_64_PLT32    0000000000000000 test1 - 4
00000000001e  000100000002 R_X86_64_PC32     0000000000000000 .data - 4
 

Current Behavior

┌──(ibuki🧀kali)-[~/test/vas]
└─$ readelf -r test.o

再配置セクション '.rela.text' at offset 0x163 contains 2 entries:
  オフセット      情報           型             シンボル値    シンボル名 + 加数
000000000009  000300000004 R_X86_64_PLT32    0000000000000000 msg - 4
00000000001e  000200000002 R_X86_64_PC32     0000000000000000 .data - 4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.