Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ld: Overlapped sections found in dynamic ELF binaries #2022

Closed
gopherbot opened this issue Jun 29, 2011 · 2 comments
Closed

ld: Overlapped sections found in dynamic ELF binaries #2022

gopherbot opened this issue Jun 29, 2011 · 2 comments

Comments

@gopherbot
Copy link

by qyzhai:

8g check.go && 8l -o check check.go
objdump -h ~/go/bin/goinstall  | awk '/[ ]+[0-9]+/{print 
$1,$2,"0x"$3,"0x"$4}' | ./check 

.rodata 813d000-81fe3af  overlaps .dynsym 813d2cc-813d3eb
.rodata 813d000-81fe3af  overlaps .dynstr 813d3ec-813d517
.rodata 813d000-81fe3af  overlaps .gnu.version 813d008-813d02b
.rodata 813d000-81fe3af  overlaps .gnu.version_r 813d02c-813d08b
.rodata 813d000-81fe3af  overlaps .rel.plt 813d0f4-813d15b
.rodata 813d000-81fe3af  overlaps .plt 813d1ec-813d2cb
.rodata 813d000-81fe3af  overlaps .hash 813d08c-813d0f3
.rodata 813d000-81fe3af  overlaps .dynamic 813d15c-813d1eb
.data 82bb000-82bd847  overlaps .got.plt 82bb260-82bb29f


cat check.go
//------------check.go-----------
package main

import (
    "fmt"
    "os"
)

type Sectinfo struct {
    id     int
    name   string
    length int
    base   int
}
type Sects []Sectinfo

func check(base, length, b2, l2 int) bool {
    if length&l2 == 0 {
        return false
    }
    b1, l1 := base, length
    if b1 > b2 {
        b1, l1, b2, l2 = b2, l2, b1, l1
    }
    if b1+l1 > b2 {
        return true
    }
    return false
}
func main() {
    var sects Sects
    for {
        var s Sectinfo
        state, err := fmt.Scan(&s.id, &s.name, &s.length, &s.base)
        if err == os.EOF {
            break
        }
        if err != nil {
            panic(err)
        }
        sects = append(sects, s)
        _ = state
    }
    for i := 1; i < len(sects); i++ {
        if sects[i].base > 0 {
            for j := 0; j < i; j++ {
                if check(sects[i].base, sects[i].length,
                    sects[j].base, sects[j].length) {
                    fmt.Printf("%s %x-%x  overlaps %s %x-%x\n",
                        sects[i].name, sects[i].base, sects[i].base+sects[i].length-1,
                        sects[j].name, sects[j].base, sects[j].base+sects[j].length-1)
                }
            }
        }
    }
}
@niemeyer
Copy link
Contributor

Comment 1:

Labels changed: added priority-low, removed priority-medium.

Owner changed to @niemeyer.

Status changed to Accepted.

@niemeyer
Copy link
Contributor

Comment 2:

This issue was closed by revision ba2e3af.

Status changed to Fixed.

@golang golang locked and limited conversation to collaborators Jun 24, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants