OSDev.org

The Place to Start for Operating System Developers
It is currently Thu Mar 28, 2024 5:42 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: C++ Undefined Reference to .rodata._ZTI9Port32Bit[_ZT) Error
PostPosted: Thu Apr 28, 2022 9:28 am 
Offline

Joined: Fri Apr 01, 2022 10:06 am
Posts: 23
Location: Türkiye, Uşak/Merkez
C++ Undefined Reference to .rodata._ZTI9Port32Bit[_ZT There Is An Error How Can I Solve It. Source Codes. I'm leaving the screenshot of the error and my Github Repository.

Github Reposity: https://github.com/mehmetprogramci/Kapilar_OS

Port.cpp Source Code:
Code:
#include "port.h"

Port::Port(uint16_t portnumber)
{
  this ->portnumber = portnumber;
}

Port::~Port()
{
}



Port8Bit::Port8Bit(uint16_t portnumber)
: Port(portnumber)
{
}

Port8Bit::~Port8Bit()
{
}

void Port8Bit::Write(uint8_t data)
{
   __asm__ volatile("outb %0, %1" : : "a" (data), "Nd" (portnumber));
}

uint8_t Port8Bit::Read()
{
     uint8_t result;
    __asm__ volatile("inb %1, %0" : "=a" (result) : "Nd" (portnumber));
    return result;
}




Port8BitSlow::Port8BitSlow(uint16_t portnumber)
: Port8Bit(portnumber)
{
}

Port8BitSlow::~Port8BitSlow()
{
}

void Port8BitSlow::Write(uint8_t data)
{
   __asm__ volatile("outb %0, %1\njmp 1f\n1: jmp 1f\n1:" : : "a" (data), "Nd" (portnumber));
}





Port16Bit::Port16Bit(uint16_t portnumber)
: Port(portnumber)
{
}

Port16Bit::~Port16Bit()
{
}

void Port16Bit::Write(uint16_t data)
{
   __asm__ volatile("outw %0, %1" : : "a" (data), "Nd" (portnumber));
}

uint16_t Port16Bit::Read()
{
      uint16_t result;
    __asm__ volatile("inw %1, %0" : "=a" (result) : "Nd" (portnumber));
    return result;
}



Port32Bit::Port32Bit(uint16_t portnumber)
: Port(portnumber)
{
}

Port32Bit::~Port32Bit()
{
}

void Port32Bit::Write(uint32_t data)
{
   __asm__ volatile("outl %0, %1" : : "a" (data), "Nd" (portnumber));
}

uint32_t Port32Bit::Read()
{
      uint16_t result;
    __asm__ volatile("inl %1, %0" : "=a" (result) : "Nd" (portnumber));
    return result;
}


Port.h Source Code:
Code:
#ifndef __PORT_H
#define __PORT_H


#include "types.h"



    class Port
    {
    protected:
        uint16_t portnumber;
        Port(uint16_t portnumber);
   ~Port();
    };
   
   
    class Port8Bit : public Port
    {
    public:
        Port8Bit(uint16_t portnumber);
   ~Port8Bit();
   virtual void Write(uint8_t data);
   virtual uint8_t Read();
    };
   
   
     class Port8BitSlow : public Port8Bit
    {
    public:
        Port8BitSlow(uint16_t portnumber);
   ~Port8BitSlow();
   virtual void Write(uint8_t data);
    };
   
   
   
      class Port16Bit : public Port
    {
    public:
        Port16Bit(uint16_t portnumber);
   ~Port16Bit();
   virtual void Write(uint16_t data);
   virtual uint16_t Read();
    };
   
   
      class Port32Bit : public Port
    {
    public:
        Port32Bit(uint16_t portnumber);
   ~Port32Bit();
   virtual void Write(uint32_t data);
   virtual uint32_t Read();
    };
   
   
#endif


Attachments:
Port.cpp Hata.png
Port.cpp Hata.png [ 58.84 KiB | Viewed 1434 times ]

_________________
M. Alp
Top
 Profile  
 
 Post subject: Re: C++ Undefined Reference to .rodata._ZTI9Port32Bit[_ZT) E
PostPosted: Thu Apr 28, 2022 8:38 pm 
Offline
Member
Member
User avatar

Joined: Tue Dec 25, 2007 6:03 am
Posts: 734
Location: Perth, Western Australia
Your linker script isn't including all `.rodata.*` sections

A common pattern is to use the line `*(.rodata .rodata.*)` to import them (and use the same pattern for all other sections)

_________________
Kernel Development, It's the brain surgery of programming.
Acess2 OS (c) | Tifflin OS (rust) | mrustc - Rust compiler
Currently Working on: mrustc


Top
 Profile  
 
 Post subject: Re: C++ Undefined Reference to .rodata._ZTI9Port32Bit[_ZT) E
PostPosted: Fri Apr 29, 2022 8:35 am 
Offline

Joined: Fri Apr 01, 2022 10:06 am
Posts: 23
Location: Türkiye, Uşak/Merkez
I Got The Problem Now How Should I Write a Code?

_________________
M. Alp


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: No registered users and 33 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group